summaryrefslogtreecommitdiffstats
path: root/chrome/plugin/plugin_channel.cc
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-24 23:07:45 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-24 23:07:45 +0000
commitbf24d2c7ded5c2072ce211cd4de6af61b8e209d5 (patch)
tree2fa229d2ab5b18fe5e49b2a7794f277f0297237d /chrome/plugin/plugin_channel.cc
parent55f81fe6b97331c509b0dfbc0665813b41f526a4 (diff)
downloadchromium_src-bf24d2c7ded5c2072ce211cd4de6af61b8e209d5.zip
chromium_src-bf24d2c7ded5c2072ce211cd4de6af61b8e209d5.tar.gz
chromium_src-bf24d2c7ded5c2072ce211cd4de6af61b8e209d5.tar.bz2
Add logging to ExtensionsService, UserScriptMaster,
and PluginChannel to be able to see what happens when chrome runs extensions headless. It would be better to modify the existing IPC::Logging mechanism than add logging to PluginChannel, so that it could be useful for debugging other types of IPC problems. But I don't have time to do that right now. Review URL: http://codereview.chromium.org/28091 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10302 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin/plugin_channel.cc')
-rw-r--r--chrome/plugin/plugin_channel.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/chrome/plugin/plugin_channel.cc b/chrome/plugin/plugin_channel.cc
index ab2d508..d9da495 100644
--- a/chrome/plugin/plugin_channel.cc
+++ b/chrome/plugin/plugin_channel.cc
@@ -7,7 +7,9 @@
#include "chrome/plugin/plugin_channel.h"
#include "chrome/common/plugin_messages.h"
+#include "base/command_line.h"
#include "base/string_util.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/plugin/plugin_process.h"
#include "chrome/plugin/plugin_thread.h"
@@ -34,6 +36,8 @@ PluginChannel* PluginChannel::GetPluginChannel(
PluginChannel::PluginChannel() : in_send_(0) {
SendUnblockingOnlyDuringDispatch();
PluginProcess::current()->AddRefProcess();
+ const CommandLine* command_line = CommandLine::ForCurrentProcess();
+ log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages);
}
PluginChannel::~PluginChannel() {
@@ -42,11 +46,23 @@ PluginChannel::~PluginChannel() {
bool PluginChannel::Send(IPC::Message* msg) {
in_send_++;
+ if (log_messages_) {
+ LOG(INFO) << "sending message @" << msg << " on channel @" << this
+ << " with type " << msg->type();
+ }
bool result = PluginChannelBase::Send(msg);
in_send_--;
return result;
}
+void PluginChannel::OnMessageReceived(const IPC::Message& msg) {
+ if (log_messages_) {
+ LOG(INFO) << "received message @" << &msg << " on channel @" << this
+ << " with type " << msg.type();
+ }
+ PluginChannelBase::OnMessageReceived(msg);
+}
+
void PluginChannel::OnControlMessageReceived(const IPC::Message& msg) {
IPC_BEGIN_MESSAGE_MAP(PluginChannel, msg)
IPC_MESSAGE_HANDLER(PluginMsg_CreateInstance, OnCreateInstance)