Make IPC_MESSAGE_EXPORT more robust.

Currently, files that want to export ipc messages currently do

  #undef IPC_MESSAGE_EXPORT
  #define IPC_MESSAGE_EXPORT  CONTENT_EXPORT

at the top, and files that don't want to export ipc messages just do nothing. This is problematic if a cc file does

  #include "exported_messages.h"
  #include "not_exported_messages.h"

because the second header file picks up the #define from the first file and declares all its messages as exported. In other translation units, where not_exported_messages.h is #included without another header above it, the messages will get default visibility – so the same class ends up with different visibilities in different translation units.

Instead, let ipc_message_macros.h #undef IPC_MESSAGE_EXPORT outside of the include guard, so that all files that don't set the define see it as defined to nothing. (Idea from jam@)

Also disable about:ipc in the component build, since ipc logging adds a dependency from chrome on all ipc message classes, so they would all have to be exported.

BUG=90078
TEST=No linker errors about IPC messages when doing components build on mac. (Other linker errors remain for now.)
TBR=brettw

Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=122689

Review URL: http://codereview.chromium.org/9425006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122828 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/common/p2p_messages.h b/content/common/p2p_messages.h
index c2593bd..7c847a57 100644
--- a/content/common/p2p_messages.h
+++ b/content/common/p2p_messages.h
@@ -1,15 +1,18 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
 // IPC messages for the P2P Transport API.
 // Multiply-included message file, hence no include guard.
 
+#include "content/common/content_export.h"
 #include "content/common/p2p_sockets.h"
 #include "ipc/ipc_message_macros.h"
 #include "net/base/ip_endpoint.h"
 #include "net/base/net_util.h"
 
+#undef IPC_MESSAGE_EXPORT
+#define IPC_MESSAGE_EXPORT CONTENT_EXPORT
 #define IPC_MESSAGE_START P2PMsgStart
 
 IPC_ENUM_TRAITS(content::P2PSocketType)