Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1298)

Side by Side Diff: ppapi/proxy/ppb_broker_proxy.cc

Issue 7066040: Fix a bug in the Broker proxy thunk that prevents using the Broker out-of-process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/plugin_dispatcher.h" 10 #include "ppapi/proxy/plugin_dispatcher.h"
10 #include "ppapi/proxy/plugin_resource.h" 11 #include "ppapi/proxy/plugin_resource.h"
11 #include "ppapi/proxy/ppapi_messages.h" 12 #include "ppapi/proxy/ppapi_messages.h"
12 #include "ppapi/thunk/ppb_broker_api.h" 13 #include "ppapi/thunk/ppb_broker_api.h"
13 #include "ppapi/thunk/enter.h" 14 #include "ppapi/thunk/enter.h"
14 #include "ppapi/thunk/thunk.h" 15 #include "ppapi/thunk/thunk.h"
15 16
16 namespace pp { 17 namespace pp {
17 namespace proxy { 18 namespace proxy {
18 19
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 // The proxy owns the handle and transfers it to the Broker. At that point, 218 // The proxy owns the handle and transfers it to the Broker. At that point,
218 // the plugin owns the handle and is responsible for closing it. 219 // the plugin owns the handle and is responsible for closing it.
219 // The caller guarantees that socket_handle is not valid if result is not PP_OK. 220 // The caller guarantees that socket_handle is not valid if result is not PP_OK.
220 void PPB_Broker_Proxy::OnMsgConnectComplete( 221 void PPB_Broker_Proxy::OnMsgConnectComplete(
221 const HostResource& resource, 222 const HostResource& resource,
222 IPC::PlatformFileForTransit socket_handle, 223 IPC::PlatformFileForTransit socket_handle,
223 int32_t result) { 224 int32_t result) {
224 DCHECK(result == PP_OK || 225 DCHECK(result == PP_OK ||
225 socket_handle == IPC::InvalidPlatformFileForTransit()); 226 socket_handle == IPC::InvalidPlatformFileForTransit());
226 227
227 ppapi::thunk::EnterResourceNoLock<ppapi::thunk::PPB_Broker_API> enter( 228 EnterPluginFromHostResource<ppapi::thunk::PPB_Broker_API> enter(resource);
228 resource.host_resource(), true);
229 if (enter.failed()) { 229 if (enter.failed()) {
230 // As in Broker::ConnectComplete, we need to close the resource on error. 230 // As in Broker::ConnectComplete, we need to close the resource on error.
231 base::SyncSocket temp_socket( 231 base::SyncSocket temp_socket(
232 IPC::PlatformFileForTransitToPlatformFile(socket_handle)); 232 IPC::PlatformFileForTransitToPlatformFile(socket_handle));
233 } else { 233 } else {
234 static_cast<Broker*>(enter.object())->ConnectComplete(socket_handle, 234 static_cast<Broker*>(enter.object())->ConnectComplete(socket_handle,
235 result); 235 result);
236 } 236 }
237 } 237 }
238 238
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698