Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: ipc/ipc_sync_channel.h

Issue 1262253004: Let IPC::SyncMessageFilter take advantage of thread-safe Send. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minus some code Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ipc/ipc_channel_proxy.cc ('k') | ipc/ipc_sync_channel.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef IPC_IPC_SYNC_CHANNEL_H_ 5 #ifndef IPC_IPC_SYNC_CHANNEL_H_
6 #define IPC_IPC_SYNC_CHANNEL_H_ 6 #define IPC_IPC_SYNC_CHANNEL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <deque> 9 #include <deque>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/synchronization/lock.h" 13 #include "base/synchronization/lock.h"
14 #include "base/synchronization/waitable_event_watcher.h" 14 #include "base/synchronization/waitable_event_watcher.h"
15 #include "ipc/ipc_channel_handle.h" 15 #include "ipc/ipc_channel_handle.h"
16 #include "ipc/ipc_channel_proxy.h" 16 #include "ipc/ipc_channel_proxy.h"
17 #include "ipc/ipc_sync_message.h" 17 #include "ipc/ipc_sync_message.h"
18 #include "ipc/ipc_sync_message_filter.h"
18 19
19 namespace base { 20 namespace base {
20 class WaitableEvent; 21 class WaitableEvent;
21 }; 22 };
22 23
23 namespace IPC { 24 namespace IPC {
24 25
25 class SyncMessage; 26 class SyncMessage;
26 class ChannelFactory; 27 class ChannelFactory;
27 28
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // some cases where such loops are not possible. This flags allows the tagging 110 // some cases where such loops are not possible. This flags allows the tagging
110 // of some particular channels to only re-enter in known correct cases. 111 // of some particular channels to only re-enter in known correct cases.
111 // 112 //
112 // Incoming messages on channels belonging to a group that is not 113 // Incoming messages on channels belonging to a group that is not
113 // kRestrictDispatchGroup_None will only be dispatched while a sync message is 114 // kRestrictDispatchGroup_None will only be dispatched while a sync message is
114 // being sent on a channel of the *same* group. 115 // being sent on a channel of the *same* group.
115 // Incoming messages belonging to the kRestrictDispatchGroup_None group (the 116 // Incoming messages belonging to the kRestrictDispatchGroup_None group (the
116 // default) will be dispatched in any case. 117 // default) will be dispatched in any case.
117 void SetRestrictDispatchChannelGroup(int group); 118 void SetRestrictDispatchChannelGroup(int group);
118 119
120 // Creates a new IPC::SyncMessageFilter and adds it to this SyncChannel.
121 // This should be used instead of directly constructing a new
122 // SyncMessageFilter.
123 scoped_refptr<IPC::SyncMessageFilter> CreateSyncMessageFilter();
124
119 protected: 125 protected:
120 class ReceivedSyncMsgQueue; 126 class ReceivedSyncMsgQueue;
121 friend class ReceivedSyncMsgQueue; 127 friend class ReceivedSyncMsgQueue;
122 128
123 // SyncContext holds the per object data for SyncChannel, so that SyncChannel 129 // SyncContext holds the per object data for SyncChannel, so that SyncChannel
124 // can be deleted while it's being used in a different thread. See 130 // can be deleted while it's being used in a different thread. See
125 // ChannelProxy::Context for more information. 131 // ChannelProxy::Context for more information.
126 class SyncContext : public Context { 132 class SyncContext : public Context {
127 public: 133 public:
128 SyncContext( 134 SyncContext(
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 // Used to signal events between the IPC and listener threads. 236 // Used to signal events between the IPC and listener threads.
231 base::WaitableEventWatcher dispatch_watcher_; 237 base::WaitableEventWatcher dispatch_watcher_;
232 base::WaitableEventWatcher::EventCallback dispatch_watcher_callback_; 238 base::WaitableEventWatcher::EventCallback dispatch_watcher_callback_;
233 239
234 DISALLOW_COPY_AND_ASSIGN(SyncChannel); 240 DISALLOW_COPY_AND_ASSIGN(SyncChannel);
235 }; 241 };
236 242
237 } // namespace IPC 243 } // namespace IPC
238 244
239 #endif // IPC_IPC_SYNC_CHANNEL_H_ 245 #endif // IPC_IPC_SYNC_CHANNEL_H_
OLDNEW
« no previous file with comments | « ipc/ipc_channel_proxy.cc ('k') | ipc/ipc_sync_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698