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

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

Issue 10909244: PPAPI: Get TrackedCallback ready for running on non-main threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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_flash_device_id_proxy.h" 5 #include "ppapi/proxy/ppb_flash_device_id_proxy.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 pp_resource())); 77 pp_resource()));
78 return PP_OK_COMPLETIONPENDING; 78 return PP_OK_COMPLETIONPENDING;
79 } 79 }
80 80
81 void DeviceID::OnReply(int32_t result, const std::string& id) { 81 void DeviceID::OnReply(int32_t result, const std::string& id) {
82 if (result == PP_OK) 82 if (result == PP_OK)
83 *dest_ = StringVar::StringToPPVar(id); 83 *dest_ = StringVar::StringToPPVar(id);
84 else 84 else
85 *dest_ = PP_MakeUndefined(); 85 *dest_ = PP_MakeUndefined();
86 dest_ = NULL; 86 dest_ = NULL;
87 TrackedCallback::ClearAndRun(&callback_, result); 87 callback_->Run(result);
88 } 88 }
89 89
90 } // namespace 90 } // namespace
91 91
92 PPB_Flash_DeviceID_Proxy::PPB_Flash_DeviceID_Proxy(Dispatcher* dispatcher) 92 PPB_Flash_DeviceID_Proxy::PPB_Flash_DeviceID_Proxy(Dispatcher* dispatcher)
93 : InterfaceProxy(dispatcher) { 93 : InterfaceProxy(dispatcher) {
94 } 94 }
95 95
96 PPB_Flash_DeviceID_Proxy::~PPB_Flash_DeviceID_Proxy() { 96 PPB_Flash_DeviceID_Proxy::~PPB_Flash_DeviceID_Proxy() {
97 } 97 }
(...skipping 19 matching lines...) Expand all
117 int32 result, 117 int32 result,
118 const std::string& id) { 118 const std::string& id) {
119 thunk::EnterResourceNoLock<PPB_Flash_DeviceID_API> enter(resource, false); 119 thunk::EnterResourceNoLock<PPB_Flash_DeviceID_API> enter(resource, false);
120 if (enter.failed()) 120 if (enter.failed())
121 return; // Resource destroyed. 121 return; // Resource destroyed.
122 static_cast<DeviceID*>(enter.object())->OnReply(result, id); 122 static_cast<DeviceID*>(enter.object())->OnReply(result, id);
123 } 123 }
124 124
125 } // namespace proxy 125 } // namespace proxy
126 } // namespace ppapi 126 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698