OLD | NEW |
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 BASE_THREADING_THREAD_RESTRICTIONS_H_ | 5 #ifndef BASE_THREADING_THREAD_RESTRICTIONS_H_ |
6 #define BASE_THREADING_THREAD_RESTRICTIONS_H_ | 6 #define BASE_THREADING_THREAD_RESTRICTIONS_H_ |
7 | 7 |
8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 namespace android { | 85 namespace android { |
86 class JavaHandlerThread; | 86 class JavaHandlerThread; |
87 } | 87 } |
88 | 88 |
89 namespace internal { | 89 namespace internal { |
90 class TaskTracker; | 90 class TaskTracker; |
91 } | 91 } |
92 | 92 |
93 class SequencedWorkerPool; | 93 class SequencedWorkerPool; |
94 class SimpleThread; | 94 class SimpleThread; |
| 95 class StackSamplingProfiler; |
95 class Thread; | 96 class Thread; |
96 class ThreadTestHelper; | 97 class ThreadTestHelper; |
97 | 98 |
98 // Certain behavior is disallowed on certain threads. ThreadRestrictions helps | 99 // Certain behavior is disallowed on certain threads. ThreadRestrictions helps |
99 // enforce these rules. Examples of such rules: | 100 // enforce these rules. Examples of such rules: |
100 // | 101 // |
101 // * Do not do blocking IO (makes the thread janky) | 102 // * Do not do blocking IO (makes the thread janky) |
102 // * Do not access Singleton/LazyInstance (may lead to shutdown crashes) | 103 // * Do not access Singleton/LazyInstance (may lead to shutdown crashes) |
103 // | 104 // |
104 // Here's more about how the protection works: | 105 // Here's more about how the protection works: |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 static void AssertIOAllowed() {} | 168 static void AssertIOAllowed() {} |
168 static bool SetSingletonAllowed(bool allowed) { return true; } | 169 static bool SetSingletonAllowed(bool allowed) { return true; } |
169 static void AssertSingletonAllowed() {} | 170 static void AssertSingletonAllowed() {} |
170 static void DisallowWaiting() {} | 171 static void DisallowWaiting() {} |
171 static void AssertWaitAllowed() {} | 172 static void AssertWaitAllowed() {} |
172 #endif | 173 #endif |
173 | 174 |
174 private: | 175 private: |
175 // DO NOT ADD ANY OTHER FRIEND STATEMENTS, talk to jam or brettw first. | 176 // DO NOT ADD ANY OTHER FRIEND STATEMENTS, talk to jam or brettw first. |
176 // BEGIN ALLOWED USAGE. | 177 // BEGIN ALLOWED USAGE. |
| 178 friend class base::StackSamplingProfiler; |
177 friend class content::BrowserShutdownProfileDumper; | 179 friend class content::BrowserShutdownProfileDumper; |
178 friend class content::BrowserSurfaceViewManager; | 180 friend class content::BrowserSurfaceViewManager; |
179 friend class content::BrowserTestBase; | 181 friend class content::BrowserTestBase; |
180 friend class content::NestedMessagePumpAndroid; | 182 friend class content::NestedMessagePumpAndroid; |
181 friend class content::ScopedAllowWaitForAndroidLayoutTests; | 183 friend class content::ScopedAllowWaitForAndroidLayoutTests; |
182 friend class content::ScopedAllowWaitForDebugURL; | 184 friend class content::ScopedAllowWaitForDebugURL; |
183 friend class ::HistogramSynchronizer; | 185 friend class ::HistogramSynchronizer; |
184 friend class internal::TaskTracker; | 186 friend class internal::TaskTracker; |
185 friend class ::ScopedAllowWaitForLegacyWebViewApi; | 187 friend class ::ScopedAllowWaitForLegacyWebViewApi; |
186 friend class cc::CompletionEvent; | 188 friend class cc::CompletionEvent; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 | 248 |
247 DISALLOW_COPY_AND_ASSIGN(ScopedAllowWait); | 249 DISALLOW_COPY_AND_ASSIGN(ScopedAllowWait); |
248 }; | 250 }; |
249 | 251 |
250 DISALLOW_IMPLICIT_CONSTRUCTORS(ThreadRestrictions); | 252 DISALLOW_IMPLICIT_CONSTRUCTORS(ThreadRestrictions); |
251 }; | 253 }; |
252 | 254 |
253 } // namespace base | 255 } // namespace base |
254 | 256 |
255 #endif // BASE_THREADING_THREAD_RESTRICTIONS_H_ | 257 #endif // BASE_THREADING_THREAD_RESTRICTIONS_H_ |
OLD | NEW |