diff options
author | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-18 21:12:34 +0000 |
---|---|---|
committer | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-18 21:12:34 +0000 |
commit | aacd63895cb4e2482778332d5d82b3001e41c9dd (patch) | |
tree | 0868ce3273daf13aa166c672e6a2dd45aabd2584 | |
parent | 9be42c820957b78508a30042138b1121dafd703a (diff) | |
download | chromium_src-aacd63895cb4e2482778332d5d82b3001e41c9dd.zip chromium_src-aacd63895cb4e2482778332d5d82b3001e41c9dd.tar.gz chromium_src-aacd63895cb4e2482778332d5d82b3001e41c9dd.tar.bz2 |
Only clears the unblock flag on sync IPCs during other sync dispatches
BUG=22210 (this is not a partial mitigation, not a fix)
Review URL: http://codereview.chromium.org/399043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32397 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/plugin/plugin_channel.cc | 2 | ||||
-rw-r--r-- | chrome/plugin/plugin_channel_base.cc | 16 | ||||
-rw-r--r-- | chrome/plugin/plugin_channel_base.h | 14 |
3 files changed, 17 insertions, 15 deletions
diff --git a/chrome/plugin/plugin_channel.cc b/chrome/plugin/plugin_channel.cc index be8e5f9..44779a8 100644 --- a/chrome/plugin/plugin_channel.cc +++ b/chrome/plugin/plugin_channel.cc @@ -161,7 +161,7 @@ PluginChannel::PluginChannel() in_send_(0), off_the_record_(false), filter_(new MessageFilter()) { - SendUnblockingOnlyDuringDispatch(); + SendUnblockingOnlyDuringSyncDispatch(); ChildProcess::current()->AddRefProcess(); const CommandLine* command_line = CommandLine::ForCurrentProcess(); log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages); diff --git a/chrome/plugin/plugin_channel_base.cc b/chrome/plugin/plugin_channel_base.cc index e996919..f4bcac9 100644 --- a/chrome/plugin/plugin_channel_base.cc +++ b/chrome/plugin/plugin_channel_base.cc @@ -60,8 +60,8 @@ PluginChannelBase::PluginChannelBase() peer_pid_(0), in_remove_route_(false), channel_valid_(false), - in_dispatch_(0), - send_unblocking_only_during_dispatch_(false) { + in_sync_dispatch_(0), + send_unblocking_only_during_sync_dispatch_(false) { } PluginChannelBase::~PluginChannelBase() { @@ -100,7 +100,7 @@ bool PluginChannelBase::Send(IPC::Message* message) { return false; } - if (send_unblocking_only_during_dispatch_ && in_dispatch_ == 0 && + if (send_unblocking_only_during_sync_dispatch_ && in_sync_dispatch_ == 0 && message->is_sync()) { message->set_unblock(false); } @@ -117,7 +117,8 @@ void PluginChannelBase::OnMessageReceived(const IPC::Message& message) { // ourself so that we can send the reply and decrement back in_dispatch_. scoped_refptr<PluginChannelBase> me(this); - in_dispatch_++; + if (message.is_sync()) + in_sync_dispatch_++; if (message.routing_id() == MSG_ROUTING_CONTROL) { OnControlMessageReceived(message); } else { @@ -130,7 +131,8 @@ void PluginChannelBase::OnMessageReceived(const IPC::Message& message) { Send(reply); } } - in_dispatch_--; + if (message.is_sync()) + in_sync_dispatch_--; } void PluginChannelBase::OnChannelConnected(int32 peer_pid) { @@ -214,6 +216,6 @@ void PluginChannelBase::OnChannelError() { channel_valid_ = false; } -void PluginChannelBase::SendUnblockingOnlyDuringDispatch() { - send_unblocking_only_during_dispatch_ = true; +void PluginChannelBase::SendUnblockingOnlyDuringSyncDispatch() { + send_unblocking_only_during_sync_dispatch_ = true; } diff --git a/chrome/plugin/plugin_channel_base.h b/chrome/plugin/plugin_channel_base.h index 0263e9b..38bb87b 100644 --- a/chrome/plugin/plugin_channel_base.h +++ b/chrome/plugin/plugin_channel_base.h @@ -85,8 +85,8 @@ class PluginChannelBase : public IPC::Channel::Listener, virtual void OnChannelError(); // If this is set, sync messages that are sent will only unblock the receiver - // if this channel is in the middle of a dispatch. - void SendUnblockingOnlyDuringDispatch(); + // if this channel is in the middle of a sync dispatch. + void SendUnblockingOnlyDuringSyncDispatch(); virtual bool Init(MessageLoop* ipc_message_loop, bool create_pipe_now); @@ -114,13 +114,13 @@ class PluginChannelBase : public IPC::Channel::Listener, // error. This flag is used to indicate the same. bool channel_valid_; - // Track whether we're within a dispatch; works like a refcount, 0 when we're - // not. - int in_dispatch_; + // Track whether we're within a synchronous dispatch; works like a refcount, + // 0 when we're not. + int in_sync_dispatch_; // If true, sync messages will only be marked as unblocking if the channel is - // in the middle of dispatching a message. - bool send_unblocking_only_during_dispatch_; + // in the middle of dispatching a synchronous message. + bool send_unblocking_only_during_sync_dispatch_; DISALLOW_COPY_AND_ASSIGN(PluginChannelBase); }; |