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

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

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/shared_impl/proxy_lock.h ('k') | ppapi/shared_impl/tracked_callback_unittest.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/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/synchronization/lock.h" 8 #include "base/synchronization/lock.h"
9 #include "base/threading/thread_local.h" 9 #include "base/threading/thread_local.h"
10 #include "ppapi/shared_impl/ppapi_globals.h" 10 #include "ppapi/shared_impl/ppapi_globals.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 72 }
73 } 73 }
74 74
75 // static 75 // static
76 void ProxyLock::DisableLocking() { 76 void ProxyLock::DisableLocking() {
77 // Note, we don't DCHECK that this flag isn't already set, because multiple 77 // Note, we don't DCHECK that this flag isn't already set, because multiple
78 // unit tests may run in succession and all set it. 78 // unit tests may run in succession and all set it.
79 g_disable_locking = true; 79 g_disable_locking = true;
80 } 80 }
81 81
82 // static 82 ProxyLock::LockingDisablerForTest::LockingDisablerForTest() {
83 void ProxyLock::DisableLockingOnThreadForTest() {
84 // Note, we don't DCHECK that this flag isn't already set, because multiple 83 // Note, we don't DCHECK that this flag isn't already set, because multiple
85 // unit tests may run in succession and all set it. 84 // unit tests may run in succession and all set it.
86 g_disable_locking_for_thread.Get().Set(true); 85 g_disable_locking_for_thread.Get().Set(true);
87 } 86 }
88 87
89 // static 88 ProxyLock::LockingDisablerForTest::~LockingDisablerForTest() {
90 void ProxyLock::EnableLockingOnThreadForTest() {
91 g_disable_locking_for_thread.Get().Set(false); 89 g_disable_locking_for_thread.Get().Set(false);
92 } 90 }
93 91
94 void CallWhileUnlocked(const base::Closure& closure) { 92 void CallWhileUnlocked(const base::Closure& closure) {
95 ProxyAutoUnlock lock; 93 ProxyAutoUnlock lock;
96 closure.Run(); 94 closure.Run();
97 } 95 }
98 96
99 } // namespace ppapi 97 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/proxy_lock.h ('k') | ppapi/shared_impl/tracked_callback_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698