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

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

Issue 908363002: PPAPI: Make tests that disable the proxy lock re-enable it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add export Created 5 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
« no previous file with comments | « ppapi/proxy/raw_var_data_unittest.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) 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 #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 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 static void AssertAcquired(); 52 static void AssertAcquired();
53 static void AssertAcquiredDebugOnly() { 53 static void AssertAcquiredDebugOnly() {
54 #ifndef NDEBUG 54 #ifndef NDEBUG
55 AssertAcquired(); 55 AssertAcquired();
56 #endif 56 #endif
57 } 57 }
58 58
59 // We have some unit tests where one thread pretends to be the host and one 59 // We have some unit tests where one thread pretends to be the host and one
60 // pretends to be the plugin. This allows the lock to do nothing on only one 60 // pretends to be the plugin. This allows the lock to do nothing on only one
61 // thread to support these tests. See TwoWayTest for more information. 61 // thread to support these tests. See TwoWayTest for more information.
62 static void DisableLockingOnThreadForTest(); 62 class PPAPI_SHARED_EXPORT LockingDisablerForTest {
63 63 public:
64 // Enables locking on the current thread. Although locking is enabled by 64 LockingDisablerForTest();
65 // default, unit tests that rely on the lock being enabled should *still* 65 ~LockingDisablerForTest();
66 // call this, since a previous test may have disabled locking. 66 };
67 static void EnableLockingOnThreadForTest();
68 67
69 private: 68 private:
70 friend class content::HostGlobals; 69 friend class content::HostGlobals;
71 // On the host side, we do not lock. This must be called at most once at 70 // On the host side, we do not lock. This must be called at most once at
72 // startup, before other threads that may access the ProxyLock have had a 71 // startup, before other threads that may access the ProxyLock have had a
73 // chance to run. 72 // chance to run.
74 static void DisableLocking(); 73 static void DisableLocking();
75 74
76 DISALLOW_IMPLICIT_CONSTRUCTORS(ProxyLock); 75 DISALLOW_IMPLICIT_CONSTRUCTORS(ProxyLock);
77 }; 76 };
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 internal::RunWhileLockedHelper<FunctionType>* helper = 358 internal::RunWhileLockedHelper<FunctionType>* helper =
360 new internal::RunWhileLockedHelper<FunctionType>(callback); 359 new internal::RunWhileLockedHelper<FunctionType>(callback);
361 return base::Bind( 360 return base::Bind(
362 &internal::RunWhileLockedHelper<FunctionType>::CallWhileLocked, 361 &internal::RunWhileLockedHelper<FunctionType>::CallWhileLocked,
363 base::Owned(helper)); 362 base::Owned(helper));
364 } 363 }
365 364
366 } // namespace ppapi 365 } // namespace ppapi
367 366
368 #endif // PPAPI_SHARED_IMPL_PROXY_LOCK_H_ 367 #endif // PPAPI_SHARED_IMPL_PROXY_LOCK_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/raw_var_data_unittest.cc ('k') | ppapi/shared_impl/proxy_lock.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698