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

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

Issue 9034035: Make it possible to have 1 PpapiGlobals per thread. Update unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test. Cleanup. Move proxy lock to globals. 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
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 base::Lock* ProxyLock::lock_ = NULL;
12 13
13 // static 14 // static
14 void ProxyLock::Acquire() { 15 void ProxyLock::Acquire() {
15 if (lock_) 16 base::Lock* lock(PpapiGlobals::Get()->GetProxyLock());
brettw 2012/01/05 23:41:20 Is this class useful anymore? I probably just woul
dmichael (off chromium) 2012/01/06 18:18:45 I agree, that would be nicer for right now, and I
16 lock_->Acquire(); 17 if (lock)
18 lock->Acquire();
17 } 19 }
18 20
19 // static 21 // static
20 void ProxyLock::Release() { 22 void ProxyLock::Release() {
21 if (lock_) 23 base::Lock* lock(PpapiGlobals::Get()->GetProxyLock());
22 lock_->Release(); 24 if (lock)
23 } 25 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 } 26 }
34 27
35 } // namespace ppapi 28 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698