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

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

Issue 10081020: PPAPI: Make blocking completion callbacks work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: export AssertLockHeld Created 8 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
OLDNEW
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 "ppapi/proxy/ppb_talk_private_proxy.h" 5 #include "ppapi/proxy/ppb_talk_private_proxy.h"
6 6
7 #include "ipc/ipc_message_macros.h" 7 #include "ipc/ipc_message_macros.h"
8 #include "ppapi/c/pp_errors.h" 8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/proxy/plugin_dispatcher.h" 9 #include "ppapi/proxy/plugin_dispatcher.h"
10 #include "ppapi/proxy/plugin_globals.h" 10 #include "ppapi/proxy/plugin_globals.h"
(...skipping 11 matching lines...) Expand all
22 22
23 class Talk : public Resource, public thunk::PPB_Talk_Private_API { 23 class Talk : public Resource, public thunk::PPB_Talk_Private_API {
24 public: 24 public:
25 Talk(PP_Instance instance) : Resource(OBJECT_IS_PROXY, instance) { 25 Talk(PP_Instance instance) : Resource(OBJECT_IS_PROXY, instance) {
26 } 26 }
27 27
28 // Resource overrides. 28 // Resource overrides.
29 thunk::PPB_Talk_Private_API* AsPPB_Talk_Private_API() { return this; } 29 thunk::PPB_Talk_Private_API* AsPPB_Talk_Private_API() { return this; }
30 30
31 // PPB_Talk_API implementation. 31 // PPB_Talk_API implementation.
32 int32_t GetPermission(const PP_CompletionCallback& callback) { 32 int32_t GetPermission(scoped_refptr<TrackedCallback> callback) {
33 if (TrackedCallback::IsPending(callback_)) 33 if (TrackedCallback::IsPending(callback_))
34 return PP_ERROR_INPROGRESS; 34 return PP_ERROR_INPROGRESS;
35 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance( 35 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(
36 pp_instance()); 36 pp_instance());
37 if (!dispatcher) 37 if (!dispatcher)
38 return PP_ERROR_FAILED; 38 return PP_ERROR_FAILED;
39 39
40 callback_ = new TrackedCallback(this, callback); 40 callback_ = callback;
41 41
42 if (PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser( 42 if (PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser(
43 new PpapiHostMsg_PPBTalk_GetPermission( 43 new PpapiHostMsg_PPBTalk_GetPermission(
44 API_ID_PPB_TALK, 44 API_ID_PPB_TALK,
45 dispatcher->plugin_dispatcher_id(), 45 dispatcher->plugin_dispatcher_id(),
46 pp_resource()))) 46 pp_resource())))
47 return PP_OK_COMPLETIONPENDING; 47 return PP_OK_COMPLETIONPENDING;
48 return PP_ERROR_FAILED; 48 return PP_ERROR_FAILED;
49 } 49 }
50 50
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 PP_Resource resource, 83 PP_Resource resource,
84 int32_t result) { 84 int32_t result) {
85 thunk::EnterResourceNoLock<thunk::PPB_Talk_Private_API> enter( 85 thunk::EnterResourceNoLock<thunk::PPB_Talk_Private_API> enter(
86 resource, false); 86 resource, false);
87 if (enter.succeeded()) 87 if (enter.succeeded())
88 static_cast<Talk*>(enter.object())->GotCompletion(result); 88 static_cast<Talk*>(enter.object())->GotCompletion(result);
89 } 89 }
90 90
91 } // namespace proxy 91 } // namespace proxy
92 } // namespace ppapi 92 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_network_monitor_private_proxy.cc ('k') | ppapi/proxy/ppb_tcp_server_socket_private_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698