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

Side by Side Diff: base/threading/thread_restrictions.cc

Issue 659233002: STASH: Epic Experimental patch for toolkit-views App List on Mac Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Fix a few things. Works@master Created 6 years, 2 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 | « base/mac/sdk_forward_declarations.mm ('k') | build/common.gypi » ('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 "base/threading/thread_restrictions.h" 5 #include "base/threading/thread_restrictions.h"
6 6
7 #if ENABLE_THREAD_RESTRICTIONS 7 #if ENABLE_THREAD_RESTRICTIONS
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 17 matching lines...) Expand all
28 // static 28 // static
29 bool ThreadRestrictions::SetIOAllowed(bool allowed) { 29 bool ThreadRestrictions::SetIOAllowed(bool allowed) {
30 bool previous_disallowed = g_io_disallowed.Get().Get(); 30 bool previous_disallowed = g_io_disallowed.Get().Get();
31 g_io_disallowed.Get().Set(!allowed); 31 g_io_disallowed.Get().Set(!allowed);
32 return !previous_disallowed; 32 return !previous_disallowed;
33 } 33 }
34 34
35 // static 35 // static
36 void ThreadRestrictions::AssertIOAllowed() { 36 void ThreadRestrictions::AssertIOAllowed() {
37 if (g_io_disallowed.Get().Get()) { 37 if (g_io_disallowed.Get().Get()) {
38 LOG(FATAL) << 38 LOG(ERROR) <<
39 "Function marked as IO-only was called from a thread that " 39 "Function marked as IO-only was called from a thread that "
40 "disallows IO! If this thread really should be allowed to " 40 "disallows IO! If this thread really should be allowed to "
41 "make IO calls, adjust the call to " 41 "make IO calls, adjust the call to "
42 "base::ThreadRestrictions::SetIOAllowed() in this thread's " 42 "base::ThreadRestrictions::SetIOAllowed() in this thread's "
43 "startup."; 43 "startup.";
44 } 44 }
45 } 45 }
46 46
47 // static 47 // static
48 bool ThreadRestrictions::SetSingletonAllowed(bool allowed) { 48 bool ThreadRestrictions::SetSingletonAllowed(bool allowed) {
(...skipping 27 matching lines...) Expand all
76 76
77 bool ThreadRestrictions::SetWaitAllowed(bool allowed) { 77 bool ThreadRestrictions::SetWaitAllowed(bool allowed) {
78 bool previous_disallowed = g_wait_disallowed.Get().Get(); 78 bool previous_disallowed = g_wait_disallowed.Get().Get();
79 g_wait_disallowed.Get().Set(!allowed); 79 g_wait_disallowed.Get().Set(!allowed);
80 return !previous_disallowed; 80 return !previous_disallowed;
81 } 81 }
82 82
83 } // namespace base 83 } // namespace base
84 84
85 #endif // ENABLE_THREAD_RESTRICTIONS 85 #endif // ENABLE_THREAD_RESTRICTIONS
OLDNEW
« no previous file with comments | « base/mac/sdk_forward_declarations.mm ('k') | build/common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698