OLD | NEW |
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 #include "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "ipc/ipc_channel_proxy.h" | 11 #include "ipc/ipc_channel_proxy.h" |
| 12 #include "ipc/ipc_listener.h" |
12 #include "ipc/ipc_logging.h" | 13 #include "ipc/ipc_logging.h" |
13 #include "ipc/ipc_message_macros.h" | 14 #include "ipc/ipc_message_macros.h" |
14 #include "ipc/ipc_message_utils.h" | 15 #include "ipc/ipc_message_utils.h" |
15 | 16 |
16 namespace IPC { | 17 namespace IPC { |
17 | 18 |
18 //------------------------------------------------------------------------------ | 19 //------------------------------------------------------------------------------ |
19 | 20 |
20 ChannelProxy::MessageFilter::MessageFilter() {} | 21 ChannelProxy::MessageFilter::MessageFilter() {} |
21 | 22 |
(...skipping 12 matching lines...) Expand all Loading... |
34 } | 35 } |
35 | 36 |
36 void ChannelProxy::MessageFilter::OnDestruct() const { | 37 void ChannelProxy::MessageFilter::OnDestruct() const { |
37 delete this; | 38 delete this; |
38 } | 39 } |
39 | 40 |
40 ChannelProxy::MessageFilter::~MessageFilter() {} | 41 ChannelProxy::MessageFilter::~MessageFilter() {} |
41 | 42 |
42 //------------------------------------------------------------------------------ | 43 //------------------------------------------------------------------------------ |
43 | 44 |
44 ChannelProxy::Context::Context(Channel::Listener* listener, | 45 ChannelProxy::Context::Context(Listener* listener, |
45 base::MessageLoopProxy* ipc_message_loop) | 46 base::MessageLoopProxy* ipc_message_loop) |
46 : listener_message_loop_(base::MessageLoopProxy::current()), | 47 : listener_message_loop_(base::MessageLoopProxy::current()), |
47 listener_(listener), | 48 listener_(listener), |
48 ipc_message_loop_(ipc_message_loop), | 49 ipc_message_loop_(ipc_message_loop), |
49 channel_connected_called_(false), | 50 channel_connected_called_(false), |
50 peer_pid_(base::kNullProcessId) { | 51 peer_pid_(base::kNullProcessId) { |
51 } | 52 } |
52 | 53 |
53 ChannelProxy::Context::~Context() { | 54 ChannelProxy::Context::~Context() { |
54 } | 55 } |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 // Called on the listener's thread | 268 // Called on the listener's thread |
268 void ChannelProxy::Context::OnDispatchError() { | 269 void ChannelProxy::Context::OnDispatchError() { |
269 if (listener_) | 270 if (listener_) |
270 listener_->OnChannelError(); | 271 listener_->OnChannelError(); |
271 } | 272 } |
272 | 273 |
273 //----------------------------------------------------------------------------- | 274 //----------------------------------------------------------------------------- |
274 | 275 |
275 ChannelProxy::ChannelProxy(const IPC::ChannelHandle& channel_handle, | 276 ChannelProxy::ChannelProxy(const IPC::ChannelHandle& channel_handle, |
276 Channel::Mode mode, | 277 Channel::Mode mode, |
277 Channel::Listener* listener, | 278 Listener* listener, |
278 base::MessageLoopProxy* ipc_thread) | 279 base::MessageLoopProxy* ipc_thread) |
279 : context_(new Context(listener, ipc_thread)), | 280 : context_(new Context(listener, ipc_thread)), |
280 outgoing_message_filter_(NULL), | 281 outgoing_message_filter_(NULL), |
281 did_init_(false) { | 282 did_init_(false) { |
282 Init(channel_handle, mode, true); | 283 Init(channel_handle, mode, true); |
283 } | 284 } |
284 | 285 |
285 ChannelProxy::ChannelProxy(Context* context) | 286 ChannelProxy::ChannelProxy(Context* context) |
286 : context_(context), | 287 : context_(context), |
287 outgoing_message_filter_(NULL), | 288 outgoing_message_filter_(NULL), |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 Channel* channel = context_.get()->channel_.get(); | 389 Channel* channel = context_.get()->channel_.get(); |
389 // Channel must have been created first. | 390 // Channel must have been created first. |
390 DCHECK(channel) << context_.get()->channel_id_; | 391 DCHECK(channel) << context_.get()->channel_id_; |
391 return channel->GetClientEuid(client_euid); | 392 return channel->GetClientEuid(client_euid); |
392 } | 393 } |
393 #endif | 394 #endif |
394 | 395 |
395 //----------------------------------------------------------------------------- | 396 //----------------------------------------------------------------------------- |
396 | 397 |
397 } // namespace IPC | 398 } // namespace IPC |
OLD | NEW |