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

Side by Side Diff: ppapi/shared_impl/proxy_lock.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/shared_impl/proxy_lock.h ('k') | ppapi/shared_impl/tracked_callback.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/shared_impl/proxy_lock.h" 5 #include "ppapi/shared_impl/proxy_lock.h"
6 6
7 #include "base/synchronization/lock.h" 7 #include "base/synchronization/lock.h"
8 #include "ppapi/shared_impl/ppapi_globals.h" 8 #include "ppapi/shared_impl/ppapi_globals.h"
9 9
10 namespace ppapi { 10 namespace ppapi {
11 11
12 // static 12 // static
13 void ProxyLock::Acquire() { 13 void ProxyLock::Acquire() {
14 base::Lock* lock(PpapiGlobals::Get()->GetProxyLock()); 14 base::Lock* lock(PpapiGlobals::Get()->GetProxyLock());
15 if (lock) 15 if (lock)
16 lock->Acquire(); 16 lock->Acquire();
17 } 17 }
18 18
19 // static 19 // static
20 void ProxyLock::Release() { 20 void ProxyLock::Release() {
21 base::Lock* lock(PpapiGlobals::Get()->GetProxyLock()); 21 base::Lock* lock(PpapiGlobals::Get()->GetProxyLock());
22 if (lock) 22 if (lock)
23 lock->Release(); 23 lock->Release();
24 } 24 }
25 25
26 void CallWhileLocked(const base::Closure& closure) {
27 ProxyAutoLock lock;
28 closure.Run();
29 }
30
26 } // namespace ppapi 31 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/proxy_lock.h ('k') | ppapi/shared_impl/tracked_callback.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698