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

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

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: Review comments. 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/ppapi_globals.cc ('k') | ppapi/shared_impl/proxy_lock.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) 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 #ifndef PPAPI_SHARED_IMPL_PROXY_LOCK_H_ 5 #ifndef PPAPI_SHARED_IMPL_PROXY_LOCK_H_
6 #define PPAPI_SHARED_IMPL_PROXY_LOCK_H_ 6 #define PPAPI_SHARED_IMPL_PROXY_LOCK_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 9
10 #include "ppapi/shared_impl/ppapi_shared_export.h" 10 #include "ppapi/shared_impl/ppapi_shared_export.h"
(...skipping 16 matching lines...) Expand all
27 public: 27 public:
28 // Acquire the proxy lock. If it is currently held by another thread, block 28 // Acquire the proxy lock. If it is currently held by another thread, block
29 // until it is available. If the lock has not been set using the 'Set' method, 29 // until it is available. If the lock has not been set using the 'Set' method,
30 // this operation does nothing. That is the normal case for the host side; 30 // this operation does nothing. That is the normal case for the host side;
31 // see PluginResourceTracker for where the lock gets set for the out-of- 31 // see PluginResourceTracker for where the lock gets set for the out-of-
32 // process plugin case. 32 // process plugin case.
33 static void Acquire(); 33 static void Acquire();
34 // Relinquish the proxy lock. If the lock has not been set, this does nothing. 34 // Relinquish the proxy lock. If the lock has not been set, this does nothing.
35 static void Release(); 35 static void Release();
36 36
37 // Set the lock that ProxyLock will use. The caller is responsible for
38 // ensuring that the lock stays valid so long as the ProxyLock may be in use.
39 static void Set(base::Lock* lock);
40 // Set the lock to NULL.
41 static void Reset();
42 private:
43 static base::Lock* lock_;
44
45 DISALLOW_IMPLICIT_CONSTRUCTORS(ProxyLock); 37 DISALLOW_IMPLICIT_CONSTRUCTORS(ProxyLock);
46 }; 38 };
47 39
48 // A simple RAII class for locking the PPAPI proxy lock on entry and releasing 40 // A simple RAII class for locking the PPAPI proxy lock on entry and releasing
49 // on exit. This is for simple interfaces that don't use the 'thunk' system, 41 // on exit. This is for simple interfaces that don't use the 'thunk' system,
50 // such as PPB_Var and PPB_Core. 42 // such as PPB_Var and PPB_Core.
51 class ProxyAutoLock { 43 class ProxyAutoLock {
52 public: 44 public:
53 ProxyAutoLock() { 45 ProxyAutoLock() {
54 ProxyLock::Acquire(); 46 ProxyLock::Acquire();
(...skipping 18 matching lines...) Expand all
73 ProxyLock::Acquire(); 65 ProxyLock::Acquire();
74 } 66 }
75 private: 67 private:
76 DISALLOW_COPY_AND_ASSIGN(ProxyAutoUnlock); 68 DISALLOW_COPY_AND_ASSIGN(ProxyAutoUnlock);
77 }; 69 };
78 70
79 71
80 } // namespace ppapi 72 } // namespace ppapi
81 73
82 #endif // PPAPI_SHARED_IMPL_PROXY_LOCK_H_ 74 #endif // PPAPI_SHARED_IMPL_PROXY_LOCK_H_
OLDNEW
« no previous file with comments | « ppapi/shared_impl/ppapi_globals.cc ('k') | ppapi/shared_impl/proxy_lock.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698