Chromium Code Reviews| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ipc/ipc_platform_file.h" | 8 #include "ipc/ipc_platform_file.h" |
| 9 #include "ipc/ipc_test_sink.h" | 9 #include "ipc/ipc_test_sink.h" |
| 10 | 10 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 if (should_close_source) { | 67 if (should_close_source) { |
| 68 base::File file_closer(handle); | 68 base::File file_closer(handle); |
| 69 } | 69 } |
| 70 return IPC::InvalidPlatformFileForTransit(); | 70 return IPC::InvalidPlatformFileForTransit(); |
| 71 } | 71 } |
| 72 DCHECK(peer_pid_ != base::kNullProcessId); | 72 DCHECK(peer_pid_ != base::kNullProcessId); |
| 73 return delegate_->ShareHandleWithRemote(handle, peer_pid_, | 73 return delegate_->ShareHandleWithRemote(handle, peer_pid_, |
| 74 should_close_source); | 74 should_close_source); |
| 75 } | 75 } |
| 76 | 76 |
| 77 base::SharedMemoryHandle ProxyChannel::ShareSharedMemoryHandleWithRemote( | |
| 78 const base::SharedMemoryHandle& handle) { | |
| 79 #if defined(OS_POSIX) | |
| 80 return ShareHandleWithRemote(handle.fd, false); | |
| 81 #elif defined(OS_WIN) | |
| 82 return ShareHandleWithRemote( | |
| 83 reinterpret_cast<HANDLE>(static_cast<intptr_t>(handle)), false); | |
|
piman
2015/06/01 22:16:08
ditto wrt casts
erikchen
2015/06/01 23:48:53
Done.
| |
| 84 #else | |
| 85 #error Not implemented. | |
| 86 #endif | |
| 87 } | |
| 88 | |
| 77 bool ProxyChannel::Send(IPC::Message* msg) { | 89 bool ProxyChannel::Send(IPC::Message* msg) { |
| 78 if (test_sink_) | 90 if (test_sink_) |
| 79 return test_sink_->Send(msg); | 91 return test_sink_->Send(msg); |
| 80 if (channel_.get()) | 92 if (channel_.get()) |
| 81 return channel_->Send(msg); | 93 return channel_->Send(msg); |
| 82 | 94 |
| 83 // Remote side crashed, drop this message. | 95 // Remote side crashed, drop this message. |
| 84 delete msg; | 96 delete msg; |
| 85 return false; | 97 return false; |
| 86 } | 98 } |
| 87 | 99 |
| 88 } // namespace proxy | 100 } // namespace proxy |
| 89 } // namespace ppapi | 101 } // namespace ppapi |
| OLD | NEW |