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

Side by Side Diff: ppapi/shared_impl/proxy_lock.cc

Issue 9187055: Reland 9034035: Make it possible to have 1 PpapiGlobals per thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 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/test_globals.h » ('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) 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/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 9
9 namespace ppapi { 10 namespace ppapi {
10 11
11 base::Lock* ProxyLock::lock_ = NULL;
12
13 // static 12 // static
14 void ProxyLock::Acquire() { 13 void ProxyLock::Acquire() {
15 if (lock_) 14 base::Lock* lock(PpapiGlobals::Get()->GetProxyLock());
16 lock_->Acquire(); 15 if (lock)
16 lock->Acquire();
17 } 17 }
18 18
19 // static 19 // static
20 void ProxyLock::Release() { 20 void ProxyLock::Release() {
21 if (lock_) 21 base::Lock* lock(PpapiGlobals::Get()->GetProxyLock());
22 lock_->Release(); 22 if (lock)
23 } 23 lock->Release();
24
25 // static
26 void ProxyLock::Set(base::Lock* lock) {
27 lock_ = lock;
28 }
29
30 // static
31 void ProxyLock::Reset() {
32 Set(NULL);
33 } 24 }
34 25
35 } // namespace ppapi 26 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/proxy_lock.h ('k') | ppapi/shared_impl/test_globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698