summaryrefslogtreecommitdiffstats
path: root/ipc/ipc_sync_channel.h
diff options
context:
space:
mode:
authorpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-30 21:29:30 +0000
committerpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-30 21:29:30 +0000
commit298ee7d563620ce6253e393ec92b60c33a9042d3 (patch)
treee37dafab37a47a7af1410006cc030c330bdb3ce3 /ipc/ipc_sync_channel.h
parent7e58cb27d8563d4c04016ce1e6fb46744acb9330 (diff)
downloadchromium_src-298ee7d563620ce6253e393ec92b60c33a9042d3.zip
chromium_src-298ee7d563620ce6253e393ec92b60c33a9042d3.tar.gz
chromium_src-298ee7d563620ce6253e393ec92b60c33a9042d3.tar.bz2
IPC: change sync channel dispatch restriction to allow dispatch to other channels within the same "group"
This prevents 4-way deadlocks with 2 renderers talking to 2 different pepper plugins. BUG=120530 TEST=RestrictedDispatch4WayDeadlock, load chromeos chrome with 2 gmail tabs (on 2 domains), quit and restore session multiple times. Review URL: https://chromiumcodereview.appspot.com/9917002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129944 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_sync_channel.h')
-rw-r--r--ipc/ipc_sync_channel.h31
1 files changed, 23 insertions, 8 deletions
diff --git a/ipc/ipc_sync_channel.h b/ipc/ipc_sync_channel.h
index 448d355..3157279 100644
--- a/ipc/ipc_sync_channel.h
+++ b/ipc/ipc_sync_channel.h
@@ -1,4 +1,4 @@
-// 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.
@@ -62,6 +62,10 @@ class SyncMessage;
class IPC_EXPORT SyncChannel : public ChannelProxy,
public base::WaitableEventWatcher::Delegate {
public:
+ enum RestrictDispatchGroup {
+ kRestrictDispatchGroup_None = 0,
+ };
+
// Creates and initializes a sync channel. If create_pipe_now is specified,
// the channel will be initialized synchronously.
SyncChannel(const IPC::ChannelHandle& channel_handle,
@@ -88,16 +92,22 @@ class IPC_EXPORT SyncChannel : public ChannelProxy,
sync_messages_with_no_timeout_allowed_ = value;
}
- // Sets this channel to only dispatch its incoming unblocking messages when it
- // is itself blocked on sending a sync message, not when other channels are.
+ // Sets the dispatch group for this channel, to only allow re-entrant dispatch
+ // of messages to other channels in the same group.
//
// Normally, any unblocking message coming from any channel can be dispatched
// when any (possibly other) channel is blocked on sending a message. This is
// needed in some cases to unblock certain loops (e.g. necessary when some
// processes share a window hierarchy), but may cause re-entrancy issues in
// some cases where such loops are not possible. This flags allows the tagging
- // of some particular channels to not re-enter in such cases.
- void SetRestrictDispatchToSameChannel(bool value);
+ // of some particular channels to only re-enter in known correct cases.
+ //
+ // Incoming messages on channels belonging to a group that is not
+ // kRestrictDispatchGroup_None will only be dispatched while a sync message is
+ // being sent on a channel of the *same* group.
+ // Incoming messages belonging to the kRestrictDispatchGroup_None group (the
+ // default) will be dispatched in any case.
+ void SetRestrictDispatchChannelGroup(int group);
protected:
class ReceivedSyncMsgQueue;
@@ -146,8 +156,13 @@ class IPC_EXPORT SyncChannel : public ChannelProxy,
return received_sync_msgs_;
}
- void set_restrict_dispatch(bool value) { restrict_dispatch_ = value; }
- bool restrict_dispatch() const { return restrict_dispatch_; }
+ void set_restrict_dispatch_group(int group) {
+ restrict_dispatch_group_ = group;
+ }
+
+ int restrict_dispatch_group() const {
+ return restrict_dispatch_group_;
+ }
private:
virtual ~SyncContext();
@@ -176,7 +191,7 @@ class IPC_EXPORT SyncChannel : public ChannelProxy,
base::WaitableEvent* shutdown_event_;
base::WaitableEventWatcher shutdown_watcher_;
- bool restrict_dispatch_;
+ int restrict_dispatch_group_;
};
private: