OLD | NEW |
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 #include "ppapi/proxy/proxy_channel.h" | 5 #include "ppapi/proxy/proxy_channel.h" |
6 | 6 |
7 #include "ipc/ipc_platform_file.h" | 7 #include "ipc/ipc_platform_file.h" |
8 #include "ipc/ipc_test_sink.h" | 8 #include "ipc/ipc_test_sink.h" |
9 | 9 |
10 namespace pp { | 10 namespace pp { |
11 namespace proxy { | 11 namespace proxy { |
12 | 12 |
13 ProxyChannel::ProxyChannel(base::ProcessHandle remote_process_handle) | 13 ProxyChannel::ProxyChannel(base::ProcessHandle remote_process_handle) |
14 : delegate_(NULL), | 14 : delegate_(NULL), |
15 remote_process_handle_(remote_process_handle), | 15 remote_process_handle_(remote_process_handle), |
16 test_sink_(NULL) { | 16 test_sink_(NULL) { |
17 } | 17 } |
18 | 18 |
19 ProxyChannel::~ProxyChannel() { | 19 ProxyChannel::~ProxyChannel() { |
20 } | 20 } |
21 | 21 |
22 bool ProxyChannel::InitWithChannel(Delegate* delegate, | 22 bool ProxyChannel::InitWithChannel(Delegate* delegate, |
23 const IPC::ChannelHandle& channel_handle, | 23 const IPC::ChannelHandle& channel_handle, |
24 bool is_client) { | 24 bool is_client) { |
25 delegate_ = delegate; | 25 delegate_ = delegate; |
26 IPC::Channel::Mode mode = is_client ? IPC::Channel::MODE_CLIENT | 26 IPC::Channel::Mode mode = is_client ? IPC::Channel::MODE_CLIENT |
27 : IPC::Channel::MODE_SERVER; | 27 : IPC::Channel::MODE_SERVER; |
28 channel_.reset(new IPC::SyncChannel(channel_handle, mode, this, | 28 channel_.reset(new IPC::SyncChannel(channel_handle, mode, this, |
29 delegate->GetIPCMessageLoop(), false, | 29 delegate->GetIPCMessageLoop(), true, |
30 delegate->GetShutdownEvent())); | 30 delegate->GetShutdownEvent())); |
31 return true; | 31 return true; |
32 } | 32 } |
33 | 33 |
34 void ProxyChannel::InitWithTestSink(IPC::TestSink* test_sink) { | 34 void ProxyChannel::InitWithTestSink(IPC::TestSink* test_sink) { |
35 DCHECK(!test_sink_); | 35 DCHECK(!test_sink_); |
36 test_sink_ = test_sink; | 36 test_sink_ = test_sink; |
37 } | 37 } |
38 | 38 |
39 void ProxyChannel::OnChannelError() { | 39 void ProxyChannel::OnChannelError() { |
(...skipping 20 matching lines...) Expand all Loading... |
60 if (channel_.get()) | 60 if (channel_.get()) |
61 return channel_->Send(msg); | 61 return channel_->Send(msg); |
62 | 62 |
63 // Remote side crashed, drop this message. | 63 // Remote side crashed, drop this message. |
64 delete msg; | 64 delete msg; |
65 return false; | 65 return false; |
66 } | 66 } |
67 | 67 |
68 } // namespace proxy | 68 } // namespace proxy |
69 } // namespace pp | 69 } // namespace pp |
OLD | NEW |