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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 } | 197 } |
198 | 198 |
199 void PPB_Broker_Proxy::OnMsgCreate(PP_Instance instance, | 199 void PPB_Broker_Proxy::OnMsgCreate(PP_Instance instance, |
200 HostResource* result_resource) { | 200 HostResource* result_resource) { |
201 result_resource->SetHostResource( | 201 result_resource->SetHostResource( |
202 instance, | 202 instance, |
203 ppb_broker_target()->CreateTrusted(instance)); | 203 ppb_broker_target()->CreateTrusted(instance)); |
204 } | 204 } |
205 | 205 |
206 void PPB_Broker_Proxy::OnMsgConnect(const HostResource& broker) { | 206 void PPB_Broker_Proxy::OnMsgConnect(const HostResource& broker) { |
207 CompletionCallback callback = callback_factory_.NewCallback( | 207 CompletionCallback callback = callback_factory_.NewOptionalCallback( |
208 &PPB_Broker_Proxy::ConnectCompleteInHost, broker); | 208 &PPB_Broker_Proxy::ConnectCompleteInHost, broker); |
209 | 209 |
210 int32_t result = ppb_broker_target()->Connect( | 210 int32_t result = ppb_broker_target()->Connect( |
211 broker.host_resource(), | 211 broker.host_resource(), |
212 callback.pp_completion_callback()); | 212 callback.pp_completion_callback()); |
213 if (result != PP_OK_COMPLETIONPENDING) | 213 if (result != PP_OK_COMPLETIONPENDING) |
214 callback.Run(result); | 214 callback.Run(result); |
215 } | 215 } |
216 | 216 |
217 // Called in the plugin to handle the connect callback. | 217 // Called in the plugin to handle the connect callback. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 // The easiest way to clean it up is to just put it in an object | 272 // The easiest way to clean it up is to just put it in an object |
273 // and then close it. This failure case is not performance critical. | 273 // and then close it. This failure case is not performance critical. |
274 // The handle could still leak if Send succeeded but the IPC later failed. | 274 // The handle could still leak if Send succeeded but the IPC later failed. |
275 base::SyncSocket temp_socket( | 275 base::SyncSocket temp_socket( |
276 IPC::PlatformFileForTransitToPlatformFile(foreign_socket_handle)); | 276 IPC::PlatformFileForTransitToPlatformFile(foreign_socket_handle)); |
277 } | 277 } |
278 } | 278 } |
279 | 279 |
280 } // namespace proxy | 280 } // namespace proxy |
281 } // namespace pp | 281 } // namespace pp |
OLD | NEW |