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_impl.h" | 5 #include "content/renderer/pepper/pepper_broker_impl.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" | 8 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" |
9 #include "content/renderer/pepper/pepper_proxy_channel_delegate_impl.h" | 9 #include "content/renderer/pepper/pepper_proxy_channel_delegate_impl.h" |
| 10 #include "content/renderer/renderer_restrict_dispatch_group.h" |
10 #include "ipc/ipc_channel_handle.h" | 11 #include "ipc/ipc_channel_handle.h" |
11 #include "ppapi/proxy/broker_dispatcher.h" | 12 #include "ppapi/proxy/broker_dispatcher.h" |
12 #include "ppapi/proxy/ppapi_messages.h" | 13 #include "ppapi/proxy/ppapi_messages.h" |
13 #include "ppapi/shared_impl/platform_file.h" | 14 #include "ppapi/shared_impl/platform_file.h" |
14 #include "webkit/plugins/ppapi/plugin_module.h" | 15 #include "webkit/plugins/ppapi/plugin_module.h" |
15 #include "webkit/plugins/ppapi/ppb_broker_impl.h" | 16 #include "webkit/plugins/ppapi/ppb_broker_impl.h" |
16 | 17 |
17 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
18 #include <windows.h> | 19 #include <windows.h> |
19 #endif | 20 #endif |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 dispatcher_.reset( | 68 dispatcher_.reset( |
68 new ppapi::proxy::BrokerHostDispatcher(broker_process_handle)); | 69 new ppapi::proxy::BrokerHostDispatcher(broker_process_handle)); |
69 | 70 |
70 if (!dispatcher_->InitBrokerWithChannel(dispatcher_delegate_.get(), | 71 if (!dispatcher_->InitBrokerWithChannel(dispatcher_delegate_.get(), |
71 channel_handle, | 72 channel_handle, |
72 true)) { // Client. | 73 true)) { // Client. |
73 dispatcher_.reset(); | 74 dispatcher_.reset(); |
74 dispatcher_delegate_.reset(); | 75 dispatcher_delegate_.reset(); |
75 return false; | 76 return false; |
76 } | 77 } |
77 dispatcher_->channel()->SetRestrictDispatchToSameChannel(true); | 78 dispatcher_->channel()->SetRestrictDispatchChannelGroup( |
| 79 content::kRendererRestrictDispatchGroup_Pepper); |
78 return true; | 80 return true; |
79 } | 81 } |
80 | 82 |
81 // Does not take ownership of the local pipe. | 83 // Does not take ownership of the local pipe. |
82 int32_t PepperBrokerDispatcherWrapper::SendHandleToBroker( | 84 int32_t PepperBrokerDispatcherWrapper::SendHandleToBroker( |
83 PP_Instance instance, | 85 PP_Instance instance, |
84 base::SyncSocket::Handle handle) { | 86 base::SyncSocket::Handle handle) { |
85 IPC::PlatformFileForTransit foreign_socket_handle = | 87 IPC::PlatformFileForTransit foreign_socket_handle = |
86 dispatcher_->ShareHandleWithRemote(handle, false); | 88 dispatcher_->ShareHandleWithRemote(handle, false); |
87 if (foreign_socket_handle == IPC::InvalidPlatformFileForTransit()) | 89 if (foreign_socket_handle == IPC::InvalidPlatformFileForTransit()) |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 } | 240 } |
239 | 241 |
240 // TOOD(ddorwin): Change the IPC to asynchronous: Queue an object containing | 242 // TOOD(ddorwin): Change the IPC to asynchronous: Queue an object containing |
241 // client and plugin_socket.release(), then return. | 243 // client and plugin_socket.release(), then return. |
242 // That message handler will then call client->BrokerConnected() with the | 244 // That message handler will then call client->BrokerConnected() with the |
243 // saved pipe handle. | 245 // saved pipe handle. |
244 // Temporarily, just call back. | 246 // Temporarily, just call back. |
245 client->BrokerConnected(ppapi::PlatformFileToInt(plugin_handle), result); | 247 client->BrokerConnected(ppapi::PlatformFileToInt(plugin_handle), result); |
246 } | 248 } |
247 | 249 |
OLD | NEW |