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

Side by Side Diff: ipc/ipc_sync_channel.h

Issue 6901146: Switch IPC::ChannelProxy to use MessageLoopProxy instead of MessageLoop. This allows us to remov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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 | Annotate | Revision Log
« 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_SENDER_H__ 5 #ifndef IPC_IPC_SYNC_SENDER_H__
6 #define IPC_IPC_SYNC_SENDER_H__ 6 #define IPC_IPC_SYNC_SENDER_H__
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <deque> 10 #include <deque>
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // Note that care must be taken that the lifetime of the ipc_thread argument 59 // Note that care must be taken that the lifetime of the ipc_thread argument
60 // is more than this object. If the message loop goes away while this object 60 // is more than this object. If the message loop goes away while this object
61 // is running and it's used to send a message, then it will use the invalid 61 // is running and it's used to send a message, then it will use the invalid
62 // message loop pointer to proxy it to the ipc thread. 62 // message loop pointer to proxy it to the ipc thread.
63 class SyncChannel : public ChannelProxy, 63 class SyncChannel : public ChannelProxy,
64 public base::WaitableEventWatcher::Delegate { 64 public base::WaitableEventWatcher::Delegate {
65 public: 65 public:
66 SyncChannel(const IPC::ChannelHandle& channel_handle, 66 SyncChannel(const IPC::ChannelHandle& channel_handle,
67 Channel::Mode mode, 67 Channel::Mode mode,
68 Channel::Listener* listener, 68 Channel::Listener* listener,
69 MessageLoop* ipc_message_loop, 69 base::MessageLoopProxy* ipc_message_loop,
70 bool create_pipe_now, 70 bool create_pipe_now,
71 base::WaitableEvent* shutdown_event); 71 base::WaitableEvent* shutdown_event);
72 virtual ~SyncChannel(); 72 virtual ~SyncChannel();
73 73
74 virtual bool Send(Message* message); 74 virtual bool Send(Message* message);
75 virtual bool SendWithTimeout(Message* message, int timeout_ms); 75 virtual bool SendWithTimeout(Message* message, int timeout_ms);
76 76
77 // Whether we allow sending messages with no time-out. 77 // Whether we allow sending messages with no time-out.
78 void set_sync_messages_with_no_timeout_allowed(bool value) { 78 void set_sync_messages_with_no_timeout_allowed(bool value) {
79 sync_messages_with_no_timeout_allowed_ = value; 79 sync_messages_with_no_timeout_allowed_ = value;
(...skipping 14 matching lines...) Expand all
94 class ReceivedSyncMsgQueue; 94 class ReceivedSyncMsgQueue;
95 friend class ReceivedSyncMsgQueue; 95 friend class ReceivedSyncMsgQueue;
96 96
97 // SyncContext holds the per object data for SyncChannel, so that SyncChannel 97 // SyncContext holds the per object data for SyncChannel, so that SyncChannel
98 // can be deleted while it's being used in a different thread. See 98 // can be deleted while it's being used in a different thread. See
99 // ChannelProxy::Context for more information. 99 // ChannelProxy::Context for more information.
100 class SyncContext : public Context, 100 class SyncContext : public Context,
101 public base::WaitableEventWatcher::Delegate { 101 public base::WaitableEventWatcher::Delegate {
102 public: 102 public:
103 SyncContext(Channel::Listener* listener, 103 SyncContext(Channel::Listener* listener,
104 MessageLoop* ipc_thread, 104 base::MessageLoopProxy* ipc_thread,
105 base::WaitableEvent* shutdown_event); 105 base::WaitableEvent* shutdown_event);
106 106
107 // Adds information about an outgoing sync message to the context so that 107 // Adds information about an outgoing sync message to the context so that
108 // we know how to deserialize the reply. 108 // we know how to deserialize the reply.
109 void Push(SyncMessage* sync_msg); 109 void Push(SyncMessage* sync_msg);
110 110
111 // Cleanly remove the top deserializer (and throw it away). Returns the 111 // Cleanly remove the top deserializer (and throw it away). Returns the
112 // result of the Send call for that message. 112 // result of the Send call for that message.
113 bool Pop(); 113 bool Pop();
114 114
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 191
192 // Used to signal events between the IPC and listener threads. 192 // Used to signal events between the IPC and listener threads.
193 base::WaitableEventWatcher dispatch_watcher_; 193 base::WaitableEventWatcher dispatch_watcher_;
194 194
195 DISALLOW_COPY_AND_ASSIGN(SyncChannel); 195 DISALLOW_COPY_AND_ASSIGN(SyncChannel);
196 }; 196 };
197 197
198 } // namespace IPC 198 } // namespace IPC
199 199
200 #endif // IPC_IPC_SYNC_SENDER_H__ 200 #endif // IPC_IPC_SYNC_SENDER_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