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 DCHECK(channel_handle.mojo_handle.is_valid()); |
| 58 if (!channel_handle.mojo_handle.is_valid()) |
58 return false; | 59 return false; |
59 | 60 |
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); | 61 dispatcher_delegate_.reset(new PepperProxyChannelDelegateImpl); |
67 dispatcher_.reset(new ppapi::proxy::BrokerHostDispatcher()); | 62 dispatcher_.reset(new ppapi::proxy::BrokerHostDispatcher()); |
68 | 63 |
69 if (!dispatcher_->InitBrokerWithChannel(dispatcher_delegate_.get(), | 64 if (!dispatcher_->InitBrokerWithChannel(dispatcher_delegate_.get(), |
70 broker_pid, | 65 broker_pid, |
71 channel_handle, | 66 channel_handle, |
72 true)) { // Client. | 67 true)) { // Client. |
73 dispatcher_.reset(); | 68 dispatcher_.reset(); |
74 dispatcher_delegate_.reset(); | 69 dispatcher_delegate_.reset(); |
75 return false; | 70 return false; |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 | 245 |
251 // TOOD(ddorwin): Change the IPC to asynchronous: Queue an object containing | 246 // TOOD(ddorwin): Change the IPC to asynchronous: Queue an object containing |
252 // client and plugin_socket.release(), then return. | 247 // client and plugin_socket.release(), then return. |
253 // That message handler will then call client->BrokerConnected() with the | 248 // That message handler will then call client->BrokerConnected() with the |
254 // saved pipe handle. | 249 // saved pipe handle. |
255 // Temporarily, just call back. | 250 // Temporarily, just call back. |
256 client->BrokerConnected(ppapi::PlatformFileToInt(plugin_handle), result); | 251 client->BrokerConnected(ppapi::PlatformFileToInt(plugin_handle), result); |
257 } | 252 } |
258 | 253 |
259 } // namespace content | 254 } // namespace content |
OLD | NEW |