OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ppb_broker_proxy.h" | 5 #include "ppapi/proxy/ppb_broker_proxy.h" |
6 | 6 |
7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
8 #include "ppapi/c/trusted/ppb_broker_trusted.h" | 8 #include "ppapi/c/trusted/ppb_broker_trusted.h" |
9 #include "ppapi/proxy/enter_proxy.h" | 9 #include "ppapi/proxy/enter_proxy.h" |
10 #include "ppapi/proxy/plugin_dispatcher.h" | 10 #include "ppapi/proxy/plugin_dispatcher.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 174 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
175 if (!dispatcher) | 175 if (!dispatcher) |
176 return 0; | 176 return 0; |
177 | 177 |
178 HostResource result; | 178 HostResource result; |
179 dispatcher->Send(new PpapiHostMsg_PPBBroker_Create( | 179 dispatcher->Send(new PpapiHostMsg_PPBBroker_Create( |
180 INTERFACE_ID_PPB_BROKER, instance, &result)); | 180 INTERFACE_ID_PPB_BROKER, instance, &result)); |
181 if (result.is_null()) | 181 if (result.is_null()) |
182 return 0; | 182 return 0; |
183 | 183 |
184 linked_ptr<Broker> object(new Broker(result)); | 184 return PluginResourceTracker::GetInstance()->AddResource(new Broker(result)); |
185 return PluginResourceTracker::GetInstance()->AddResource(object); | |
186 } | 185 } |
187 | 186 |
188 bool PPB_Broker_Proxy::OnMessageReceived(const IPC::Message& msg) { | 187 bool PPB_Broker_Proxy::OnMessageReceived(const IPC::Message& msg) { |
189 bool handled = true; | 188 bool handled = true; |
190 IPC_BEGIN_MESSAGE_MAP(PPB_Broker_Proxy, msg) | 189 IPC_BEGIN_MESSAGE_MAP(PPB_Broker_Proxy, msg) |
191 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBBroker_Create, OnMsgCreate) | 190 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBBroker_Create, OnMsgCreate) |
192 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBBroker_Connect, OnMsgConnect) | 191 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBBroker_Connect, OnMsgConnect) |
193 IPC_MESSAGE_HANDLER(PpapiMsg_PPBBroker_ConnectComplete, | 192 IPC_MESSAGE_HANDLER(PpapiMsg_PPBBroker_ConnectComplete, |
194 OnMsgConnectComplete) | 193 OnMsgConnectComplete) |
195 IPC_MESSAGE_UNHANDLED(handled = false) | 194 IPC_MESSAGE_UNHANDLED(handled = false) |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 // The easiest way to clean it up is to just put it in an object | 269 // The easiest way to clean it up is to just put it in an object |
271 // and then close it. This failure case is not performance critical. | 270 // and then close it. This failure case is not performance critical. |
272 // The handle could still leak if Send succeeded but the IPC later failed. | 271 // The handle could still leak if Send succeeded but the IPC later failed. |
273 base::SyncSocket temp_socket( | 272 base::SyncSocket temp_socket( |
274 IPC::PlatformFileForTransitToPlatformFile(foreign_socket_handle)); | 273 IPC::PlatformFileForTransitToPlatformFile(foreign_socket_handle)); |
275 } | 274 } |
276 } | 275 } |
277 | 276 |
278 } // namespace proxy | 277 } // namespace proxy |
279 } // namespace pp | 278 } // namespace pp |
OLD | NEW |