| 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 "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "ipc/ipc_platform_file.h" | 9 #include "ipc/ipc_platform_file.h" |
| 10 #include "ipc/ipc_test_sink.h" | 10 #include "ipc/ipc_test_sink.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 test_sink_ = test_sink; | 46 test_sink_ = test_sink; |
| 47 #if !defined(OS_NACL) | 47 #if !defined(OS_NACL) |
| 48 peer_pid_ = base::GetCurrentProcId(); | 48 peer_pid_ = base::GetCurrentProcId(); |
| 49 #endif | 49 #endif |
| 50 } | 50 } |
| 51 | 51 |
| 52 void ProxyChannel::OnChannelError() { | 52 void ProxyChannel::OnChannelError() { |
| 53 channel_.reset(); | 53 channel_.reset(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 #if defined(OS_POSIX) && !defined(OS_NACL) | |
| 57 base::ScopedFD ProxyChannel::TakeRendererFD() { | |
| 58 DCHECK(channel()); | |
| 59 return channel()->TakeClientFileDescriptor(); | |
| 60 } | |
| 61 #endif | |
| 62 | |
| 63 IPC::PlatformFileForTransit ProxyChannel::ShareHandleWithRemote( | 56 IPC::PlatformFileForTransit ProxyChannel::ShareHandleWithRemote( |
| 64 base::PlatformFile handle, | 57 base::PlatformFile handle, |
| 65 bool should_close_source) { | 58 bool should_close_source) { |
| 66 // Channel could be closed if the plugin crashes. | 59 // Channel could be closed if the plugin crashes. |
| 67 if (!channel_.get()) { | 60 if (!channel_.get()) { |
| 68 if (should_close_source) { | 61 if (should_close_source) { |
| 69 base::File file_closer(handle); | 62 base::File file_closer(handle); |
| 70 } | 63 } |
| 71 return IPC::InvalidPlatformFileForTransit(); | 64 return IPC::InvalidPlatformFileForTransit(); |
| 72 } | 65 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 90 if (channel_.get()) | 83 if (channel_.get()) |
| 91 return channel_->Send(msg); | 84 return channel_->Send(msg); |
| 92 | 85 |
| 93 // Remote side crashed, drop this message. | 86 // Remote side crashed, drop this message. |
| 94 delete msg; | 87 delete msg; |
| 95 return false; | 88 return false; |
| 96 } | 89 } |
| 97 | 90 |
| 98 } // namespace proxy | 91 } // namespace proxy |
| 99 } // namespace ppapi | 92 } // namespace ppapi |
| OLD | NEW |