summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-04 20:10:12 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-04 20:10:12 +0000
commitf91cb991c81afccc52824d369973098398c5ce31 (patch)
treec698170734dd31dc4bdafd87b71b15b351b9fbc8
parent844b9cc2b48467247968edefc145488901f9a3fd (diff)
downloadchromium_src-f91cb991c81afccc52824d369973098398c5ce31.zip
chromium_src-f91cb991c81afccc52824d369973098398c5ce31.tar.gz
chromium_src-f91cb991c81afccc52824d369973098398c5ce31.tar.bz2
Commit just the changes to make creating new IPC channel types easier.
TBR=mpcomplete Review URL: http://codereview.chromium.org/21052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9167 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/resource_message_filter.cc1
-rw-r--r--chrome/browser/tab_contents/ipc_status_view.cc33
-rw-r--r--chrome/chrome.xcodeproj/project.pbxproj4
-rw-r--r--chrome/common/common.scons3
-rw-r--r--chrome/common/common.vcproj8
-rw-r--r--chrome/common/ipc_fuzzing_tests.cc7
-rw-r--r--chrome/common/ipc_logging.cc30
-rw-r--r--chrome/common/ipc_logging.h17
-rw-r--r--chrome/common/ipc_message_macros.h38
-rw-r--r--chrome/common/ipc_message_utils.h32
-rw-r--r--chrome/common/ipc_sync_channel_unittest.cc7
-rw-r--r--chrome/common/ipc_sync_channel_unittest.h19
-rw-r--r--chrome/common/ipc_sync_message_unittest.cc8
-rw-r--r--chrome/common/ipc_sync_message_unittest.h11
-rw-r--r--chrome/common/plugin_messages.cc23
-rw-r--r--chrome/common/plugin_messages.h24
-rw-r--r--chrome/common/plugin_messages_internal.h10
-rw-r--r--chrome/common/render_messages.cc22
-rw-r--r--chrome/common/render_messages.h28
-rw-r--r--chrome/common/render_messages_internal.h6
-rw-r--r--chrome/test/automation/automation_messages.h23
-rw-r--r--chrome/test/automation/automation_messages_internal.h4
-rw-r--r--chrome/test/automation/automation_proxy.cc1
23 files changed, 139 insertions, 220 deletions
diff --git a/chrome/browser/resource_message_filter.cc b/chrome/browser/resource_message_filter.cc
index 02e6230..ec75986 100644
--- a/chrome/browser/resource_message_filter.cc
+++ b/chrome/browser/resource_message_filter.cc
@@ -24,7 +24,6 @@
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
-#include "chrome/common/ipc_message_macros.h"
#include "chrome/common/render_messages.h"
#include "net/base/cookie_monster.h"
#include "net/base/mime_util.h"
diff --git a/chrome/browser/tab_contents/ipc_status_view.cc b/chrome/browser/tab_contents/ipc_status_view.cc
index cd85ee0..a317aac 100644
--- a/chrome/browser/tab_contents/ipc_status_view.cc
+++ b/chrome/browser/tab_contents/ipc_status_view.cc
@@ -2,6 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// Need to include this before any other file because it defines
+// IPC_MESSAGE_LOG_ENABLED.
+#include "chrome/common/ipc_message.h"
+
+#ifdef IPC_MESSAGE_LOG_ENABLED
+#define IPC_MESSAGE_MACROS_LOG_ENABLED
+
#include "chrome/browser/tab_contents/ipc_status_view.h"
#include <stdio.h>
@@ -17,8 +24,6 @@
#include "chrome/common/pref_service.h"
#include "chrome/common/render_messages.h"
-#ifdef IPC_MESSAGE_LOG_ENABLED
-
using base::Time;
namespace {
@@ -39,19 +44,6 @@ enum {
kParamsColumn,
};
-// This class ensures that we have a link dependency on render_messages.cc and
-// plugin_messages.cc, and at the same time sets up the message logger function
-// mappings.
-class RegisterLoggerFuncs {
- public:
- RegisterLoggerFuncs() {
- RenderMessagesInit();
- PluginMessagesInit();
- }
-};
-
-RegisterLoggerFuncs g_register_logger_funcs;
-
} // namespace
IPCStatusView* IPCStatusView::current_;
@@ -70,7 +62,16 @@ IPCStatusView::IPCStatusView()
plugin_process_ = NULL;
plugin_process_host_ = NULL;
- IPC::Logging::current()->SetConsumer(this);
+ IPC::Logging* log = IPC::Logging::current();
+ log->RegisterMessageLogger(ViewStart, ViewMsgLog);
+ log->RegisterMessageLogger(ViewHostStart, ViewHostMsgLog);
+ log->RegisterMessageLogger(PluginProcessStart, PluginProcessMsgLog);
+ log->RegisterMessageLogger(PluginProcessHostStart, PluginProcessHostMsgLog);
+ log->RegisterMessageLogger(PluginStart, PluginMsgLog);
+ log->RegisterMessageLogger(PluginHostStart, PluginHostMsgLog);
+ log->RegisterMessageLogger(NPObjectStart, NPObjectMsgLog);
+
+ log->SetConsumer(this);
}
IPCStatusView::~IPCStatusView() {
diff --git a/chrome/chrome.xcodeproj/project.pbxproj b/chrome/chrome.xcodeproj/project.pbxproj
index 09a9a92..9eb9335 100644
--- a/chrome/chrome.xcodeproj/project.pbxproj
+++ b/chrome/chrome.xcodeproj/project.pbxproj
@@ -262,7 +262,6 @@
B562E2FC0F05845100FB1A4F /* property_bag_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = B562E2F40F05843C00FB1A4F /* property_bag_unittest.cc */; };
B56E281B0F057F2800447108 /* message_router.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BFBD10E9D4C9F009A6919 /* message_router.cc */; };
B5DBEA900EFC60E200C95176 /* ipc_channel_proxy.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BFBAB0E9D4C9F009A6919 /* ipc_channel_proxy.cc */; };
- B5E98B140F0574A8000A37D6 /* render_messages.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BFBF10E9D4C9F009A6919 /* render_messages.cc */; };
B5FCDE5C0F269E9B0099BFAF /* visitedlink_master.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BF95F0E9D4839009A6919 /* visitedlink_master.cc */; };
B5FDC0580EE488E500BEC6E6 /* ipc_channel_posix.cc in Sources */ = {isa = PBXBuildFile; fileRef = B5FDC0570EE488E500BEC6E6 /* ipc_channel_posix.cc */; };
B5FDC1CA0EE48ADB00BEC6E6 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFDD10E9D5295009A6919 /* CoreFoundation.framework */; };
@@ -1788,7 +1787,6 @@
4D7BFBEE0E9D4C9F009A6919 /* process_watcher.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = process_watcher.cc; sourceTree = "<group>"; };
4D7BFBEF0E9D4C9F009A6919 /* process_watcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = process_watcher.h; sourceTree = "<group>"; };
4D7BFBF00E9D4C9F009A6919 /* ref_counted_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ref_counted_util.h; sourceTree = "<group>"; };
- 4D7BFBF10E9D4C9F009A6919 /* render_messages.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = render_messages.cc; sourceTree = "<group>"; };
4D7BFBF20E9D4C9F009A6919 /* render_messages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = render_messages.h; sourceTree = "<group>"; };
4D7BFBF30E9D4C9F009A6919 /* render_messages_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = render_messages_internal.h; sourceTree = "<group>"; };
4D7BFBF40E9D4C9F009A6919 /* resource_bundle.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = resource_bundle.cc; sourceTree = "<group>"; };
@@ -3077,7 +3075,6 @@
B562E2F50F05843C00FB1A4F /* property_bag.h */,
B562E2F60F05843C00FB1A4F /* property_bag.cc */,
4D7BFBF00E9D4C9F009A6919 /* ref_counted_util.h */,
- 4D7BFBF10E9D4C9F009A6919 /* render_messages.cc */,
4D7BFBF20E9D4C9F009A6919 /* render_messages.h */,
4D7BFBF30E9D4C9F009A6919 /* render_messages_internal.h */,
4D7BFBF40E9D4C9F009A6919 /* resource_bundle.cc */,
@@ -4740,7 +4737,6 @@
4D7BFC7A0E9D4D2B009A6919 /* pref_names.cc in Sources */,
E45076850F1530CD003BE099 /* pref_service.cc in Sources */,
B562E2F80F05843C00FB1A4F /* property_bag.cc in Sources */,
- B5E98B140F0574A8000A37D6 /* render_messages.cc in Sources */,
E45076A90F153619003BE099 /* resource_dispatcher.cc in Sources */,
E43A78750F17A95400ABD5D1 /* sandbox_init_wrapper.cc in Sources */,
E40CC5FE0F2E35A800708647 /* security_filter_peer.cc in Sources */,
diff --git a/chrome/common/common.scons b/chrome/common/common.scons
index 5ee52f0..9066f8e 100644
--- a/chrome/common/common.scons
+++ b/chrome/common/common.scons
@@ -94,10 +94,8 @@ input_files = ChromeFileList([
'ipc_sync_channel.h',
'ipc_sync_message.cc',
'ipc_sync_message.h',
- 'plugin_messages.cc',
'plugin_messages.h',
'plugin_messages_internal.h',
- 'render_messages.cc',
'render_messages.h',
'render_messages_internal.h',
]),
@@ -230,7 +228,6 @@ if not env.Bit('windows'):
'gfx/path.cc',
'ipc_logging.cc',
'os_exchange_data.cc',
- 'plugin_messages.cc',
'process_watcher.cc',
)
diff --git a/chrome/common/common.vcproj b/chrome/common/common.vcproj
index c0f6af6..c3986d2b 100644
--- a/chrome/common/common.vcproj
+++ b/chrome/common/common.vcproj
@@ -285,10 +285,6 @@
>
</File>
<File
- RelativePath=".\plugin_messages.cc"
- >
- </File>
- <File
RelativePath=".\plugin_messages.h"
>
</File>
@@ -297,10 +293,6 @@
>
</File>
<File
- RelativePath=".\render_messages.cc"
- >
- </File>
- <File
RelativePath=".\render_messages.h"
>
</File>
diff --git a/chrome/common/ipc_fuzzing_tests.cc b/chrome/common/ipc_fuzzing_tests.cc
index cbd2bd3..0638bb4 100644
--- a/chrome/common/ipc_fuzzing_tests.cc
+++ b/chrome/common/ipc_fuzzing_tests.cc
@@ -96,10 +96,9 @@ TEST(IPCMessageIntegrity, ReadVectorTooLarge2) {
EXPECT_FALSE(ReadParam(&m, &iter, &vec));
}
-// Typically the ipc_message_macros files is included twice but here we only
-// include it once in 'enum mode' because we want more control of the class
-// definitions.
-#define IPC_MESSAGE_MACROS_ENUMS
+// We don't actually use the messages defined in this file, but we do this
+// to get to the IPC macros.
+#define MESSAGES_INTERNAL_FILE "chrome/common/ipc_sync_message_unittest.h"
#include "chrome/common/ipc_message_macros.h"
enum IPCMessageIds {
diff --git a/chrome/common/ipc_logging.cc b/chrome/common/ipc_logging.cc
index ec2fe82..2946093 100644
--- a/chrome/common/ipc_logging.cc
+++ b/chrome/common/ipc_logging.cc
@@ -41,6 +41,8 @@ Logging::Logging()
consumer_(NULL),
queue_invoke_later_pending_(false),
main_thread_(MessageLoop::current()) {
+ memset(log_function_mapping_, sizeof(log_function_mapping_), 0);
+
// Create an event for this browser instance that's set when logging is
// enabled, so child processes can know when logging is enabled.
int browser_pid;
@@ -88,8 +90,18 @@ void Logging::OnObjectSignaled(HANDLE object) {
RegisterWaitForEvent(!enabled_);
}
+void Logging::RegisterMessageLogger(int msg_start, LogFunction* func) {
+ int msg_class = msg_start >> 12;
+ if (msg_class > arraysize(log_function_mapping_)) {
+ NOTREACHED();
+ return;
+ }
+
+ log_function_mapping_[msg_class] = func;
+}
+
std::wstring Logging::GetEventName(bool enabled) {
- return Logging::current()->GetEventName(GetCurrentProcessId(), enabled);
+ return current()->GetEventName(GetCurrentProcessId(), enabled);
}
std::wstring Logging::GetEventName(int browser_pid, bool enabled) {
@@ -188,24 +200,12 @@ void Logging::OnPostDispatchMessage(const Message& message,
}
}
-// static
-LogFunction* g_log_function_mapping[16];
-void RegisterMessageLogger(int msg_start, LogFunction* func) {
- int msg_class = msg_start >> 12;
- if (msg_class > arraysize(g_log_function_mapping)) {
- NOTREACHED();
- return;
- }
-
- g_log_function_mapping[msg_class] = func;
-}
-
void Logging::GetMessageText(uint16 type, std::wstring* name,
const Message* message,
std::wstring* params) {
int message_class = type >> 12;
- if (g_log_function_mapping[message_class] != NULL) {
- g_log_function_mapping[message_class](type, name, message, params);
+ if (current()->log_function_mapping_[message_class] != NULL) {
+ current()->log_function_mapping_[message_class](type, name, message, params);
} else {
DLOG(INFO) << "No logger function associated with message class " <<
message_class;
diff --git a/chrome/common/ipc_logging.h b/chrome/common/ipc_logging.h
index 567ba84..bf49595 100644
--- a/chrome/common/ipc_logging.h
+++ b/chrome/common/ipc_logging.h
@@ -12,6 +12,7 @@
#include "base/lock.h"
#include "base/object_watcher.h"
#include "base/singleton.h"
+#include "chrome/common/ipc_message_utils.h"
class MessageLoop;
@@ -27,7 +28,7 @@ class Logging : public base::ObjectWatcher::Delegate {
// Implemented by consumers of log messages.
class Consumer {
public:
- virtual void Log(const IPC::LogData& data) = 0;
+ virtual void Log(const LogData& data) = 0;
};
void SetConsumer(Consumer* consumer);
@@ -41,7 +42,7 @@ class Logging : public base::ObjectWatcher::Delegate {
// Called by child processes to give the logger object the channel to send
// logging data to the browser process.
- void SetIPCSender(IPC::Message::Sender* sender);
+ void SetIPCSender(Message::Sender* sender);
// Called in the browser process when logging data from a child process is
// received.
@@ -66,8 +67,14 @@ class Logging : public base::ObjectWatcher::Delegate {
// ObjectWatcher::Delegate implementation
void OnObjectSignaled(HANDLE object);
+ typedef void (LogFunction)(uint16 type,
+ std::wstring* name,
+ const Message* msg,
+ std::wstring* params);
+ void RegisterMessageLogger(int msg_start, LogFunction* func);
+
private:
- friend struct DefaultSingletonTraits<IPC::Logging>;
+ friend struct DefaultSingletonTraits<Logging>;
Logging();
std::wstring GetEventName(int browser_pid, bool enabled);
@@ -85,10 +92,12 @@ class Logging : public base::ObjectWatcher::Delegate {
std::vector<LogData> queued_logs_;
bool queue_invoke_later_pending_;
- IPC::Message::Sender* sender_;
+ Message::Sender* sender_;
MessageLoop* main_thread_;
Consumer* consumer_;
+
+ LogFunction* log_function_mapping_[LastMsgIndex];
};
} // namespace IPC
diff --git a/chrome/common/ipc_message_macros.h b/chrome/common/ipc_message_macros.h
index e724e2e..e723ffe 100644
--- a/chrome/common/ipc_message_macros.h
+++ b/chrome/common/ipc_message_macros.h
@@ -41,6 +41,33 @@
#include "chrome/common/ipc_message_utils.h"
+
+#ifndef MESSAGES_INTERNAL_FILE
+#error This file should only be included by X_messages.h, which needs to define MESSAGES_INTERNAL_FILE first.
+#endif
+
+#ifndef IPC_MESSAGE_MACROS_INCLUDE_BLOCK
+#define IPC_MESSAGE_MACROS_INCLUDE_BLOCK
+
+// Multi-pass include of X_messages_internal.h. Preprocessor magic allows
+// us to use 1 header to define the enums and classes for our render messages.
+#define IPC_MESSAGE_MACROS_ENUMS
+#include MESSAGES_INTERNAL_FILE
+
+#define IPC_MESSAGE_MACROS_CLASSES
+#include MESSAGES_INTERNAL_FILE
+
+#ifdef IPC_MESSAGE_MACROS_LOG_ENABLED
+#define IPC_MESSAGE_MACROS_LOG
+#include MESSAGES_INTERNAL_FILE
+#endif
+
+#undef MESSAGES_INTERNAL_FILE
+#undef IPC_MESSAGE_MACROS_INCLUDE_BLOCK
+
+#endif
+
+
// Undefine the macros from the previous pass (if any).
#undef IPC_BEGIN_MESSAGES
#undef IPC_END_MESSAGES
@@ -102,10 +129,11 @@
// 16 channel types (currently using 8) and 4K messages per type. Should
// really make type be 32 bits, but then we break automation with older Chrome
// builds..
-#define IPC_BEGIN_MESSAGES(label, start) \
+
+#define IPC_BEGIN_MESSAGES(label) \
enum label##MsgType { \
- label##Start = start << 12, \
- label##PreStart = (start << 12) - 1, // Do this so that automation messages keep the same id as before
+ label##Start = label##MsgStart << 12, \
+ label##PreStart = (label##MsgStart << 12) - 1, // Do this so that automation messages keep the same id as before
#define IPC_END_MESSAGES(label) \
label##End \
@@ -341,7 +369,7 @@ void class_name::OnMessageReceived(const IPC::Message& msg) \
#elif defined(IPC_MESSAGE_MACROS_LOG)
#undef IPC_MESSAGE_MACROS_LOG
-#define IPC_BEGIN_MESSAGES(label, start) \
+#define IPC_BEGIN_MESSAGES(label) \
void label##MsgLog(uint16 type, std::wstring* name, const IPC::Message* msg, std::wstring* params) { \
switch (type) {
@@ -510,7 +538,7 @@ void class_name::OnMessageReceived(const IPC::Message& msg) \
#elif defined(IPC_MESSAGE_MACROS_CLASSES)
#undef IPC_MESSAGE_MACROS_CLASSES
-#define IPC_BEGIN_MESSAGES(label, start)
+#define IPC_BEGIN_MESSAGES(label)
#define IPC_END_MESSAGES(label)
#define IPC_MESSAGE_CONTROL0(msg_class) \
diff --git a/chrome/common/ipc_message_utils.h b/chrome/common/ipc_message_utils.h
index 39bb231..d76e695 100644
--- a/chrome/common/ipc_message_utils.h
+++ b/chrome/common/ipc_message_utils.h
@@ -34,16 +34,32 @@ namespace webkit_glue {
struct WebApplicationInfo;
} // namespace webkit_glue
-namespace IPC {
+// Used by IPC_BEGIN_MESSAGES so that each message class starts from a unique
+// base. Messages have unique IDs across channels in order for the IPC logging
+// code to figure out the message class from its ID.
+enum IPCMessageStart {
+ // By using a start value of 0 for automation messages, we keep backward
+ // compatibility with old builds.
+ AutomationMsgStart = 0,
+ ViewMsgStart,
+ ViewHostMsgStart,
+ PluginProcessMsgStart,
+ PluginProcessHostMsgStart,
+ PluginMsgStart,
+ PluginHostMsgStart,
+ NPObjectMsgStart,
+ TestMsgStart,
+ // NOTE: When you add a new message class, also update
+ // IPCStatusView::IPCStatusView to ensure logging works.
+ // NOTE: this enum is used by IPC_MESSAGE_MACRO to generate a unique message
+ // id. Only 4 bits are used for the message type, so if this enum needs more
+ // than 16 entries, that code needs to be updated.
+ LastMsgIndex
+};
-// Used by the message macros to register a logging function based on the
-// message class.
-typedef void (LogFunction)(uint16 type,
- std::wstring* name,
- const IPC::Message* msg,
- std::wstring* params);
-void RegisterMessageLogger(int msg_start, LogFunction* func);
+COMPILE_ASSERT(LastMsgIndex <= 16, need_to_update_IPC_MESSAGE_MACRO);
+namespace IPC {
//-----------------------------------------------------------------------------
// An iterator class for reading the fields contained within a Message.
diff --git a/chrome/common/ipc_sync_channel_unittest.cc b/chrome/common/ipc_sync_channel_unittest.cc
index 53d3f2a..2ccbd96 100644
--- a/chrome/common/ipc_sync_channel_unittest.cc
+++ b/chrome/common/ipc_sync_channel_unittest.cc
@@ -20,12 +20,9 @@
#include "chrome/common/stl_util-inl.h"
#include "testing/gtest/include/gtest/gtest.h"
-#define IPC_MESSAGE_MACROS_ENUMS
-#include "chrome/common/ipc_sync_channel_unittest.h"
-// define the classes
-#define IPC_MESSAGE_MACROS_CLASSES
-#include "chrome/common/ipc_sync_channel_unittest.h"
+#define MESSAGES_INTERNAL_FILE "chrome/common/ipc_sync_message_unittest.h"
+#include "chrome/common/ipc_message_macros.h"
using namespace IPC;
using base::WaitableEvent;
diff --git a/chrome/common/ipc_sync_channel_unittest.h b/chrome/common/ipc_sync_channel_unittest.h
deleted file mode 100644
index c4d2354..0000000
--- a/chrome/common/ipc_sync_channel_unittest.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright (c) 2006-2008 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.
-
-#include "chrome/common/ipc_message_macros.h"
-
-// Messages used for IPC::SyncChannel unit test
-IPC_BEGIN_MESSAGES(SyncChannelTest, 9)
- IPC_SYNC_MESSAGE_CONTROL0_0(SyncChannelTestMsg_NoArgs)
-
- IPC_SYNC_MESSAGE_CONTROL0_1(SyncChannelTestMsg_AnswerToLife,
- int /* answer */)
-
- IPC_SYNC_MESSAGE_CONTROL1_1(SyncChannelTestMsg_Double,
- int /* in */,
- int /* out */)
-
-IPC_END_MESSAGES(SyncChannelTest)
-
diff --git a/chrome/common/ipc_sync_message_unittest.cc b/chrome/common/ipc_sync_message_unittest.cc
index ae44acb..6508eaf 100644
--- a/chrome/common/ipc_sync_message_unittest.cc
+++ b/chrome/common/ipc_sync_message_unittest.cc
@@ -14,13 +14,9 @@
#include "base/logging.h"
#include "testing/gtest/include/gtest/gtest.h"
-#define IPC_MESSAGE_MACROS_ENUMS
-#include "chrome/common/ipc_sync_message_unittest.h"
-
-// define the classes
-#define IPC_MESSAGE_MACROS_CLASSES
-#include "chrome/common/ipc_sync_message_unittest.h"
+#define MESSAGES_INTERNAL_FILE "chrome/common/ipc_sync_message_unittest.h"
+#include "chrome/common/ipc_message_macros.h"
static IPC::Message* g_reply;
diff --git a/chrome/common/ipc_sync_message_unittest.h b/chrome/common/ipc_sync_message_unittest.h
index 8393533..3b32c10 100644
--- a/chrome/common/ipc_sync_message_unittest.h
+++ b/chrome/common/ipc_sync_message_unittest.h
@@ -4,7 +4,16 @@
#include "chrome/common/ipc_message_macros.h"
-IPC_BEGIN_MESSAGES(TestMsg, 8)
+IPC_BEGIN_MESSAGES(Test)
+ IPC_SYNC_MESSAGE_CONTROL0_0(SyncChannelTestMsg_NoArgs)
+
+ IPC_SYNC_MESSAGE_CONTROL0_1(SyncChannelTestMsg_AnswerToLife,
+ int /* answer */)
+
+ IPC_SYNC_MESSAGE_CONTROL1_1(SyncChannelTestMsg_Double,
+ int /* in */,
+ int /* out */)
+
// out1 is false
IPC_SYNC_MESSAGE_CONTROL0_1(Msg_C_0_1, bool)
diff --git a/chrome/common/plugin_messages.cc b/chrome/common/plugin_messages.cc
deleted file mode 100644
index cd5b00a..0000000
--- a/chrome/common/plugin_messages.cc
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2006-2008 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.
-
-#include "chrome/common/ipc_message.h"
-
-#ifdef IPC_MESSAGE_LOG_ENABLED
-
-#define IPC_MESSAGE_MACROS_LOG_ENABLED
-
-#endif // IPC_MESSAGE_LOG_ENABLED
-
-#include "chrome/common/plugin_messages.h"
-
-void PluginMessagesInit() {
-#ifdef IPC_MESSAGE_LOG_ENABLED
- IPC::RegisterMessageLogger(PluginProcessStart, PluginProcessMsgLog);
- IPC::RegisterMessageLogger(PluginProcessHostStart, PluginProcessHostMsgLog);
- IPC::RegisterMessageLogger(PluginStart, PluginMsgLog);
- IPC::RegisterMessageLogger(PluginHostStart, PluginHostMsgLog);
- IPC::RegisterMessageLogger(NPObjectStart, NPObjectMsgLog);
-#endif
-}
diff --git a/chrome/common/plugin_messages.h b/chrome/common/plugin_messages.h
index 025acc2..8a6a63a 100644
--- a/chrome/common/plugin_messages.h
+++ b/chrome/common/plugin_messages.h
@@ -15,14 +15,11 @@
#include "base/gfx/rect.h"
#include "base/basictypes.h"
-#include "chrome/common/ipc_message.h"
#include "chrome/common/ipc_message_utils.h"
#include "googleurl/src/gurl.h"
#include "third_party/npapi/bindings/npapi.h"
#include "webkit/glue/npruntime_util.h"
-void PluginMessagesInit();
-
// Name prefix of the event handle when a message box is displayed.
#define kMessageBoxEventPrefix L"message_box_active"
@@ -103,23 +100,6 @@ struct NPVariant_Param {
};
-#define IPC_MESSAGE_MACROS_ENUMS
-#include "chrome/common/plugin_messages_internal.h"
-
-#ifdef IPC_MESSAGE_MACROS_LOG_ENABLED
-# undef IPC_MESSAGE_MACROS_LOG
-# define IPC_MESSAGE_MACROS_CLASSES
-
-# include "chrome/common/plugin_messages_internal.h"
-# define IPC_MESSAGE_MACROS_LOG
-# undef IPC_MESSAGE_MACROS_CLASSES
-
-# include "chrome/common/plugin_messages_internal.h"
-#else
-# define IPC_MESSAGE_MACROS_CLASSES
-# include "chrome/common/plugin_messages_internal.h"
-#endif
-
namespace IPC {
// Traits for PluginMsg_Init_Params structure to pack/unpack.
@@ -475,5 +455,9 @@ struct ParamTraits<NPVariant_Param> {
} // namespace IPC
+
+#define MESSAGES_INTERNAL_FILE "chrome/common/plugin_messages_internal.h"
+#include "chrome/common/ipc_message_macros.h"
+
#endif // CHROME_COMMON_PLUGIN_MESSAGES_H__
diff --git a/chrome/common/plugin_messages_internal.h b/chrome/common/plugin_messages_internal.h
index 85093d5..d8561d0 100644
--- a/chrome/common/plugin_messages_internal.h
+++ b/chrome/common/plugin_messages_internal.h
@@ -9,7 +9,7 @@
//-----------------------------------------------------------------------------
// PluginProcess messages
// These are messages sent from the browser to the plugin process.
-IPC_BEGIN_MESSAGES(PluginProcess, 3)
+IPC_BEGIN_MESSAGES(PluginProcess)
// Tells the plugin process to create a new channel for communication with a
// renderer. The channel name is returned in a
// PluginProcessHostMsg_ChannelCreated message.
@@ -35,7 +35,7 @@ IPC_END_MESSAGES(PluginProcess)
//-----------------------------------------------------------------------------
// PluginProcessHost messages
// These are messages sent from the plugin process to the browser process.
-IPC_BEGIN_MESSAGES(PluginProcessHost, 4)
+IPC_BEGIN_MESSAGES(PluginProcessHost)
// Response to a PluginProcessMsg_CreateChannel message.
IPC_MESSAGE_CONTROL2(PluginProcessHostMsg_ChannelCreated,
int /* process_id */,
@@ -92,7 +92,7 @@ IPC_END_MESSAGES(PluginProcessHost)
//-----------------------------------------------------------------------------
// Plugin messages
// These are messages sent from the renderer process to the plugin process.
-IPC_BEGIN_MESSAGES(Plugin, 5)
+IPC_BEGIN_MESSAGES(Plugin)
// Tells the plugin process to create a new plugin instance with the given
// id. A corresponding WebPluginDelegateStub is created which hosts the
// WebPluginDelegateImpl.
@@ -202,7 +202,7 @@ IPC_END_MESSAGES(Plugin)
// PluginHost messages
// These are messages sent from the plugin process to the renderer process.
// They all map to the corresponding WebPlugin methods.
-IPC_BEGIN_MESSAGES(PluginHost, 6)
+IPC_BEGIN_MESSAGES(PluginHost)
// Sends the plugin window information to the renderer.
// The window parameter is a handle to the window if the plugin is a windowed
// plugin. It is NULL for windowless plugins.
@@ -274,7 +274,7 @@ IPC_END_MESSAGES(PluginHost)
// NPObject messages
// These are messages used to marshall NPObjects. They are sent both from the
// plugin to the renderer and from the renderer to the plugin.
-IPC_BEGIN_MESSAGES(NPObject, 7)
+IPC_BEGIN_MESSAGES(NPObject)
IPC_SYNC_MESSAGE_ROUTED0_0(NPObjectMsg_Release)
IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_HasMethod,
diff --git a/chrome/common/render_messages.cc b/chrome/common/render_messages.cc
deleted file mode 100644
index 55f21552..0000000
--- a/chrome/common/render_messages.cc
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) 2006-2008 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.
-
-#include "chrome/common/ipc_message.h"
-
-#ifdef IPC_MESSAGE_LOG_ENABLED
-
-// Preprocessor magic: render_messages.h defines the enums and debug string
-// functions if this define is set.
-#define IPC_MESSAGE_MACROS_LOG_ENABLED
-
-#endif // IPC_MESSAGE_LOG_ENABLED
-
-#include "chrome/common/render_messages.h"
-
-void RenderMessagesInit() {
-#ifdef IPC_MESSAGE_LOG_ENABLED
- IPC::RegisterMessageLogger(ViewStart, ViewMsgLog);
- IPC::RegisterMessageLogger(ViewHostStart, ViewHostMsgLog);
-#endif
-}
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 95c7e6d..c1f056a 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -15,7 +15,6 @@
#include "base/shared_memory.h"
#include "chrome/common/bitmap_wire_data.h"
#include "chrome/common/filter_policy.h"
-#include "chrome/common/ipc_message.h"
#include "chrome/common/ipc_message_utils.h"
#include "chrome/common/modal_dialog_event.h"
#include "chrome/common/page_transition_types.h"
@@ -31,6 +30,7 @@
#include "webkit/glue/resource_loader_bridge.h"
#include "webkit/glue/screen_info.h"
#include "webkit/glue/webdropdata.h"
+#include "webkit/glue/webinputevent.h"
#include "webkit/glue/webplugin.h"
#include "webkit/glue/webpreferences.h"
#include "webkit/glue/webview_delegate.h"
@@ -446,28 +446,6 @@ enum ViewHostMsg_ImeControl {
IME_COMPLETE_COMPOSITION,
};
-// Multi-pass include of render_messages_internal. Preprocessor magic allows
-// us to use 1 header to define the enums and classes for our render messages.
-#define IPC_MESSAGE_MACROS_ENUMS
-#include "chrome/common/render_messages_internal.h"
-
-#ifdef IPC_MESSAGE_MACROS_LOG_ENABLED
-// When we are supposed to create debug strings, we run it through twice, once
-// with debug strings on, and once with only CLASSES on to generate both types
-// of messages.
-# undef IPC_MESSAGE_MACROS_LOG
-# define IPC_MESSAGE_MACROS_CLASSES
-# include "chrome/common/render_messages_internal.h"
-
-# undef IPC_MESSAGE_MACROS_CLASSES
-# define IPC_MESSAGE_MACROS_LOG
-# include "chrome/common/render_messages_internal.h"
-#else
-// No debug strings requested, just define the classes
-# define IPC_MESSAGE_MACROS_CLASSES
-# include "chrome/common/render_messages_internal.h"
-#endif
-
namespace IPC {
@@ -1761,4 +1739,8 @@ struct ParamTraits<gfx::NativeView> {
} // namespace IPC
+
+#define MESSAGES_INTERNAL_FILE "chrome/common/render_messages_internal.h"
+#include "chrome/common/ipc_message_macros.h"
+
#endif // CHROME_COMMON_RENDER_MESSAGES_H_
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 149dd53..120f033 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -25,8 +25,6 @@
#include "webkit/glue/webinputevent.h"
#include "webkit/glue/webplugin.h"
-void RenderMessagesInit();
-
// TODO(mpcomplete): rename ViewMsg and ViewHostMsg to something that makes
// more sense with our current design.
@@ -34,7 +32,7 @@ void RenderMessagesInit();
// RenderView messages
// These are messages sent from the browser to the renderer process.
-IPC_BEGIN_MESSAGES(View, 1)
+IPC_BEGIN_MESSAGES(View)
// Used typically when recovering from a crash. The new rendering process
// sets its global "next page id" counter to the given value.
IPC_MESSAGE_CONTROL1(ViewMsg_SetNextPageID,
@@ -486,7 +484,7 @@ IPC_END_MESSAGES(View)
// WebContents messages
// These are messages sent from the renderer to the browser process.
-IPC_BEGIN_MESSAGES(ViewHost, 2)
+IPC_BEGIN_MESSAGES(ViewHost)
// Sent by the renderer when it is creating a new window. The browser creates
// a tab for it and responds with a ViewMsg_CreatingNew_ACK. If route_id is
// MSG_ROUTING_NONE, the view couldn't be created. modal_dialog_event is set
diff --git a/chrome/test/automation/automation_messages.h b/chrome/test/automation/automation_messages.h
index e1fdf80..d4e916c 100644
--- a/chrome/test/automation/automation_messages.h
+++ b/chrome/test/automation/automation_messages.h
@@ -8,7 +8,6 @@
#include <string>
#include "base/basictypes.h"
-#include "chrome/common/ipc_message.h"
#include "chrome/common/ipc_message_utils.h"
enum AutomationMsg_NavigationResponseValues {
@@ -17,25 +16,9 @@ enum AutomationMsg_NavigationResponseValues {
AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED,
};
-// Two-pass include of render_messages_internal. Preprocessor magic allows
-// us to use 1 header to define the enums and classes for our render messages.
-#define IPC_MESSAGE_MACROS_ENUMS
-#include "chrome/test/automation/automation_messages_internal.h"
-
-#ifdef IPC_MESSAGE_MACROS_LOG_ENABLED
-# undef IPC_MESSAGE_MACROS_LOG
-# define IPC_MESSAGE_MACROS_CLASSES
-#include "chrome/test/automation/automation_messages_internal.h"
-
-# undef IPC_MESSAGE_MACROS_CLASSES
-# define IPC_MESSAGE_MACROS_LOG
-#include "chrome/test/automation/automation_messages_internal.h"
-#else
-// No debug strings requested, just define the classes
-# define IPC_MESSAGE_MACROS_CLASSES
-#include "chrome/test/automation/automation_messages_internal.h"
-#endif
-
+#define MESSAGES_INTERNAL_FILE \
+ "chrome/test/automation/automation_messages_internal.h"
+#include "chrome/common/ipc_message_macros.h"
#endif // CHROME_TEST_AUTOMATION_AUTOMATION_MESSAGES_H__
diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h
index a22818c..7a604fe 100644
--- a/chrome/test/automation/automation_messages_internal.h
+++ b/chrome/test/automation/automation_messages_internal.h
@@ -31,9 +31,7 @@
// since the PageCyclerReferenceTest depends on the correctness of the
// message IDs across the builds.
-// By using a start value of 0 for automation messages, we keep backward
-// compatability with old builds.
-IPC_BEGIN_MESSAGES(Automation, 0)
+IPC_BEGIN_MESSAGES(Automation)
// This message is fired when the AutomationProvider is up and running
// in the app (the app is not fully up at this point).
diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc
index f8d4b93..0ad753e 100644
--- a/chrome/test/automation/automation_proxy.cc
+++ b/chrome/test/automation/automation_proxy.cc
@@ -8,7 +8,6 @@
#include "base/logging.h"
#include "base/ref_counted.h"
-#include "chrome/common/ipc_message_macros.h"
#include "chrome/test/automation/automation_constants.h"
#include "chrome/test/automation/automation_messages.h"
#include "chrome/test/automation/browser_proxy.h"