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 "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 ppapi { | 10 namespace ppapi { |
(...skipping 22 matching lines...) Expand all Loading... |
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() { |
40 channel_.reset(); | 40 channel_.reset(); |
41 } | 41 } |
42 | 42 |
43 #if defined(OS_POSIX) | 43 #if defined(OS_POSIX) && !defined(OS_NACL) |
44 int ProxyChannel::TakeRendererFD() { | 44 int ProxyChannel::TakeRendererFD() { |
45 DCHECK(channel()); | 45 DCHECK(channel()); |
46 return channel()->TakeClientFileDescriptor(); | 46 return channel()->TakeClientFileDescriptor(); |
47 } | 47 } |
48 #endif | 48 #endif |
49 | 49 |
50 IPC::PlatformFileForTransit ProxyChannel::ShareHandleWithRemote( | 50 IPC::PlatformFileForTransit ProxyChannel::ShareHandleWithRemote( |
51 base::PlatformFile handle, | 51 base::PlatformFile handle, |
52 bool should_close_source) { | 52 bool should_close_source) { |
53 return delegate_->ShareHandleWithRemote(handle, *channel_, | 53 return delegate_->ShareHandleWithRemote(handle, *channel_, |
54 should_close_source); | 54 should_close_source); |
55 } | 55 } |
56 | 56 |
57 bool ProxyChannel::Send(IPC::Message* msg) { | 57 bool ProxyChannel::Send(IPC::Message* msg) { |
58 if (test_sink_) | 58 if (test_sink_) |
59 return test_sink_->Send(msg); | 59 return test_sink_->Send(msg); |
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 ppapi | 69 } // namespace ppapi |
OLD | NEW |