summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrbyers@chromium.org <rbyers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-14 20:08:09 +0000
committerrbyers@chromium.org <rbyers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-14 20:08:09 +0000
commitacd64fe157eba6e1e3aa83902547cf9074ffb58e (patch)
tree769a30bd9f3a087a1a4a074c0c7694bb8754c4eb
parentbc1b18ecfc890dde4aae0a5a5db27dde2796b25e (diff)
downloadchromium_src-acd64fe157eba6e1e3aa83902547cf9074ffb58e.zip
chromium_src-acd64fe157eba6e1e3aa83902547cf9074ffb58e.tar.gz
chromium_src-acd64fe157eba6e1e3aa83902547cf9074ffb58e.tar.bz2
Simple trace logging of received IPC messages
Adds an entry to chrome://tracing for processing IPC messages that includes either the IPC message type ID (which can be matched to a name with the ipclist tool), or in DEBUG builds (or other builds where IPC_MESSAGE_LOG_ENABLED has been set), the message name. Also updates ipclist to not expect to see content shell messages, and clarifies some comments around cases where message classes are used entirely outside of chrome itself. Identical re-submit of http://codereview.chromium.org/9389020/ which somehow triggered a Windows linker bug (unexpected error LNK1000). BUG=79942 TBR=jam@chromium.org Review URL: https://chromiumcodereview.appspot.com/9360052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121921 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/common/all_messages.h4
-rw-r--r--chrome/tools/ipclist/ipclist.cc13
-rw-r--r--ipc/ipc_channel_proxy.cc13
3 files changed, 25 insertions, 5 deletions
diff --git a/chrome/common/all_messages.h b/chrome/common/all_messages.h
index 7eec49d..5b396b6 100644
--- a/chrome/common/all_messages.h
+++ b/chrome/common/all_messages.h
@@ -3,9 +3,11 @@
// found in the LICENSE file.
// Multiply-included file, hence no include guard.
-// Inclusion of all message files present in the system. Keep this file
+// Inclusion of all message files present in chrome. Keep this file
// up-to-date when adding a new value to enum IPCMessageStart in
// ipc/ipc_message_utils.h to include the corresponding message file.
+// Messages classes used exclusively outside of chrome should instead get an
+// exemption in chrome/tools/ipclist/ipclist.cc.
#include "chrome/browser/importer/profile_import_process_messages.h"
// We can't make common_message_generator.h include automation_messages, since
// otherwise the Chrome Frame binaries will link in a lot of unrelated chrome
diff --git a/chrome/tools/ipclist/ipclist.cc b/chrome/tools/ipclist/ipclist.cc
index 9a2faab..419a05b 100644
--- a/chrome/tools/ipclist/ipclist.cc
+++ b/chrome/tools/ipclist/ipclist.cc
@@ -38,10 +38,11 @@ static bool check_msgtable() {
int highest_class_id = 0;
std::vector<int> exemptions;
- // Exclude test files from consideration. Do not include message
- // files used inside the actual chrome browser in this list.
+ // Exclude test and other non-browser files from consideration. Do not
+ // include message files used inside the actual chrome browser in this list.
exemptions.push_back(TestMsgStart);
exemptions.push_back(FirefoxImporterUnittestMsgStart);
+ exemptions.push_back(ShellMsgStart);
for (size_t i = 0; i < MSGTABLE_SIZE; ++i) {
int class_id = IPC_MESSAGE_ID_CLASS(msgtable[i].id);
@@ -64,9 +65,15 @@ static bool check_msgtable() {
highest_class_id = class_id;
}
- if (LastIPCMsgStart > highest_class_id + 1) {
+ while (LastIPCMsgStart > highest_class_id + 1) {
+ std::vector<int>::iterator iter;
+ iter = find(exemptions.begin(), exemptions.end(), highest_class_id+1);
+ if (iter == exemptions.end()) {
std::cout << "Missing message file: gap before LastIPCMsgStart\n";
result = false;
+ break;
+ }
+ ++highest_class_id;
}
if (!result)
diff --git a/ipc/ipc_channel_proxy.cc b/ipc/ipc_channel_proxy.cc
index f542eae..2e8c9b3 100644
--- a/ipc/ipc_channel_proxy.cc
+++ b/ipc/ipc_channel_proxy.cc
@@ -4,6 +4,7 @@
#include "base/bind.h"
#include "base/compiler_specific.h"
+#include "base/debug/trace_event.h"
#include "base/location.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
@@ -238,13 +239,23 @@ void ChannelProxy::Context::AddFilter(MessageFilter* filter) {
// Called on the listener's thread
void ChannelProxy::Context::OnDispatchMessage(const Message& message) {
+#ifdef IPC_MESSAGE_LOG_ENABLED
+ Logging* logger = Logging::GetInstance();
+ std::string name;
+ logger->GetMessageText(message.type(), &name, &message, NULL);
+ TRACE_EVENT1("task", "ChannelProxy::Context::OnDispatchMessage",
+ "name", name);
+#else
+ TRACE_EVENT1("task", "ChannelProxy::Context::OnDispatchMessage",
+ "type", message.type());
+#endif
+
if (!listener_)
return;
OnDispatchConnected();
#ifdef IPC_MESSAGE_LOG_ENABLED
- Logging* logger = Logging::GetInstance();
if (message.type() == IPC_LOGGING_ID) {
logger->OnReceivedLoggingMessage(message);
return;