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

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

Issue 9361065: reland 121901, PPAPI: Add unlocking for PPP calls and callbacks... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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 | « ppapi/proxy/ppb_flash_proxy.cc ('k') | ppapi/proxy/ppb_testing_proxy.cc » ('j') | 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) 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_message_loop_proxy.h" 5 #include "ppapi/proxy/ppb_message_loop_proxy.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 tracked_objects::Location from_here; 48 tracked_objects::Location from_here;
49 base::Closure closure; 49 base::Closure closure;
50 int64 delay_ms; 50 int64 delay_ms;
51 }; 51 };
52 52
53 // Returns true if the object is associated with the current thread. 53 // Returns true if the object is associated with the current thread.
54 bool IsCurrent() const; 54 bool IsCurrent() const;
55 55
56 // Handles posting to the message loop if there is one, or the pending queue 56 // Handles posting to the message loop if there is one, or the pending queue
57 // if there isn't. 57 // if there isn't.
58 // NOTE: The given closure will be run *WITHOUT* acquiring the Proxy lock.
59 // This only makes sense for user code and completely thread-safe
60 // proxy operations (e.g., MessageLoop::QuitClosure).
58 void PostClosure(const tracked_objects::Location& from_here, 61 void PostClosure(const tracked_objects::Location& from_here,
59 const base::Closure& closure, 62 const base::Closure& closure,
60 int64 delay_ms); 63 int64 delay_ms);
61 64
62 // TLS destructor function. 65 // TLS destructor function.
63 static void ReleaseMessageLoop(void* value); 66 static void ReleaseMessageLoop(void* value);
64 67
65 // Created when we attach to the current thread, since MessageLoop assumes 68 // Created when we attach to the current thread, since MessageLoop assumes
66 // that it's created on the thread it will run on. 69 // that it's created on the thread it will run on.
67 scoped_ptr<MessageLoop> loop_; 70 scoped_ptr<MessageLoop> loop_;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 return false; // Can't be current if there's nothing in the slot. 193 return false; // Can't be current if there's nothing in the slot.
191 return static_cast<const void*>(globals->msg_loop_slot()->Get()) == 194 return static_cast<const void*>(globals->msg_loop_slot()->Get()) ==
192 static_cast<const void*>(this); 195 static_cast<const void*>(this);
193 } 196 }
194 197
195 void MessageLoopResource::PostClosure( 198 void MessageLoopResource::PostClosure(
196 const tracked_objects::Location& from_here, 199 const tracked_objects::Location& from_here,
197 const base::Closure& closure, 200 const base::Closure& closure,
198 int64 delay_ms) { 201 int64 delay_ms) {
199 if (loop_.get()) { 202 if (loop_.get()) {
200 loop_->PostDelayedTask( 203 loop_->PostDelayedTask(from_here,
201 from_here, closure, base::TimeDelta::FromMilliseconds(delay_ms)); 204 closure,
205 base::TimeDelta::FromMilliseconds(delay_ms));
202 } else { 206 } else {
203 TaskInfo info; 207 TaskInfo info;
204 info.from_here = FROM_HERE; 208 info.from_here = FROM_HERE;
205 info.closure = closure; 209 info.closure = closure;
206 info.delay_ms = delay_ms; 210 info.delay_ms = delay_ms;
207 pending_tasks_.push_back(info); 211 pending_tasks_.push_back(info);
208 } 212 }
209 } 213 }
210 214
211 // static 215 // static
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 PPB_MessageLoop_Proxy::~PPB_MessageLoop_Proxy() { 290 PPB_MessageLoop_Proxy::~PPB_MessageLoop_Proxy() {
287 } 291 }
288 292
289 // static 293 // static
290 const PPB_MessageLoop_Dev_0_1* PPB_MessageLoop_Proxy::GetInterface() { 294 const PPB_MessageLoop_Dev_0_1* PPB_MessageLoop_Proxy::GetInterface() {
291 return &ppb_message_loop_interface; 295 return &ppb_message_loop_interface;
292 } 296 }
293 297
294 } // namespace proxy 298 } // namespace proxy
295 } // namespace ppapi 299 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_flash_proxy.cc ('k') | ppapi/proxy/ppb_testing_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698