| 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 "content/renderer/pepper/pepper_broker.h" | 5 #include "content/renderer/pepper/pepper_broker.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "content/renderer/pepper/pepper_proxy_channel_delegate_impl.h" | 8 #include "content/renderer/pepper/pepper_proxy_channel_delegate_impl.h" |
| 9 #include "content/renderer/pepper/plugin_module.h" | 9 #include "content/renderer/pepper/plugin_module.h" |
| 10 #include "content/renderer/pepper/ppb_broker_impl.h" | 10 #include "content/renderer/pepper/ppb_broker_impl.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 } // namespace | 48 } // namespace |
| 49 | 49 |
| 50 PepperBrokerDispatcherWrapper::PepperBrokerDispatcherWrapper() {} | 50 PepperBrokerDispatcherWrapper::PepperBrokerDispatcherWrapper() {} |
| 51 | 51 |
| 52 PepperBrokerDispatcherWrapper::~PepperBrokerDispatcherWrapper() {} | 52 PepperBrokerDispatcherWrapper::~PepperBrokerDispatcherWrapper() {} |
| 53 | 53 |
| 54 bool PepperBrokerDispatcherWrapper::Init( | 54 bool PepperBrokerDispatcherWrapper::Init( |
| 55 base::ProcessId broker_pid, | 55 base::ProcessId broker_pid, |
| 56 const IPC::ChannelHandle& channel_handle) { | 56 const IPC::ChannelHandle& channel_handle) { |
| 57 if (channel_handle.name.empty()) | 57 if (!channel_handle.mojo_handle.is_valid()) |
| 58 return false; | 58 return false; |
| 59 | 59 |
| 60 #if defined(OS_POSIX) | |
| 61 DCHECK_NE(-1, channel_handle.socket.fd); | |
| 62 if (channel_handle.socket.fd == -1) | |
| 63 return false; | |
| 64 #endif | |
| 65 | |
| 66 dispatcher_delegate_.reset(new PepperProxyChannelDelegateImpl); | 60 dispatcher_delegate_.reset(new PepperProxyChannelDelegateImpl); |
| 67 dispatcher_.reset(new ppapi::proxy::BrokerHostDispatcher()); | 61 dispatcher_.reset(new ppapi::proxy::BrokerHostDispatcher()); |
| 68 | 62 |
| 69 if (!dispatcher_->InitBrokerWithChannel(dispatcher_delegate_.get(), | 63 if (!dispatcher_->InitBrokerWithChannel(dispatcher_delegate_.get(), |
| 70 broker_pid, | 64 broker_pid, |
| 71 channel_handle, | 65 channel_handle, |
| 72 true)) { // Client. | 66 true)) { // Client. |
| 73 dispatcher_.reset(); | 67 dispatcher_.reset(); |
| 74 dispatcher_delegate_.reset(); | 68 dispatcher_delegate_.reset(); |
| 75 return false; | 69 return false; |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 | 244 |
| 251 // TOOD(ddorwin): Change the IPC to asynchronous: Queue an object containing | 245 // TOOD(ddorwin): Change the IPC to asynchronous: Queue an object containing |
| 252 // client and plugin_socket.release(), then return. | 246 // client and plugin_socket.release(), then return. |
| 253 // That message handler will then call client->BrokerConnected() with the | 247 // That message handler will then call client->BrokerConnected() with the |
| 254 // saved pipe handle. | 248 // saved pipe handle. |
| 255 // Temporarily, just call back. | 249 // Temporarily, just call back. |
| 256 client->BrokerConnected(ppapi::PlatformFileToInt(plugin_handle), result); | 250 client->BrokerConnected(ppapi::PlatformFileToInt(plugin_handle), result); |
| 257 } | 251 } |
| 258 | 252 |
| 259 } // namespace content | 253 } // namespace content |
| OLD | NEW |