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/basictypes.h" | 9 #include "base/basictypes.h" |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... | |
35 } | 35 } |
36 namespace content { | 36 namespace content { |
37 class BrowserGpuChannelHostFactory; | 37 class BrowserGpuChannelHostFactory; |
38 class BrowserGpuMemoryBufferManager; | 38 class BrowserGpuMemoryBufferManager; |
39 class BrowserShutdownProfileDumper; | 39 class BrowserShutdownProfileDumper; |
40 class BrowserTestBase; | 40 class BrowserTestBase; |
41 class GpuChannelHost; | 41 class GpuChannelHost; |
42 class NestedMessagePumpAndroid; | 42 class NestedMessagePumpAndroid; |
43 class ScopedAllowWaitForAndroidLayoutTests; | 43 class ScopedAllowWaitForAndroidLayoutTests; |
44 class ScopedAllowWaitForDebugURL; | 44 class ScopedAllowWaitForDebugURL; |
45 class SoftwareOutputDeviceMus; | |
45 class TextInputClientMac; | 46 class TextInputClientMac; |
46 } // namespace content | 47 } // namespace content |
47 namespace dbus { | 48 namespace dbus { |
48 class Bus; | 49 class Bus; |
49 } | 50 } |
50 namespace disk_cache { | 51 namespace disk_cache { |
51 class BackendImpl; | 52 class BackendImpl; |
52 class InFlightIO; | 53 class InFlightIO; |
53 } | 54 } |
54 namespace gles2 { | 55 namespace gles2 { |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
210 content::BrowserGpuMemoryBufferManager; // http://crbug.com/420368 | 211 content::BrowserGpuMemoryBufferManager; // http://crbug.com/420368 |
211 friend class content::GpuChannelHost; // http://crbug.com/125264 | 212 friend class content::GpuChannelHost; // http://crbug.com/125264 |
212 friend class content::TextInputClientMac; // http://crbug.com/121917 | 213 friend class content::TextInputClientMac; // http://crbug.com/121917 |
213 friend class dbus::Bus; // http://crbug.com/125222 | 214 friend class dbus::Bus; // http://crbug.com/125222 |
214 friend class disk_cache::BackendImpl; // http://crbug.com/74623 | 215 friend class disk_cache::BackendImpl; // http://crbug.com/74623 |
215 friend class disk_cache::InFlightIO; // http://crbug.com/74623 | 216 friend class disk_cache::InFlightIO; // http://crbug.com/74623 |
216 friend class net::internal::AddressTrackerLinux; // http://crbug.com/125097 | 217 friend class net::internal::AddressTrackerLinux; // http://crbug.com/125097 |
217 friend class net::NetworkChangeNotifierMac; // http://crbug.com/125097 | 218 friend class net::NetworkChangeNotifierMac; // http://crbug.com/125097 |
218 friend class ::BrowserProcessImpl; // http://crbug.com/125207 | 219 friend class ::BrowserProcessImpl; // http://crbug.com/125207 |
219 friend class ::NativeBackendKWallet; // http://crbug.com/125331 | 220 friend class ::NativeBackendKWallet; // http://crbug.com/125331 |
220 // END USAGE THAT NEEDS TO BE FIXED. | 221 #if !defined(OFFICIAL_BUILD) |
222 friend class content::SoftwareOutputDeviceMus; // http://crbug.com/548451 | |
jam
2015/11/13 17:17:55
nit: add a comment saying that this is not product
rjkroege
2015/11/13 23:00:11
Done.
| |
223 #endif | |
224 // END USAGE THAT NEEDS TO BE FIXED. | |
221 | 225 |
222 #if ENABLE_THREAD_RESTRICTIONS | 226 #if ENABLE_THREAD_RESTRICTIONS |
223 static bool SetWaitAllowed(bool allowed); | 227 static bool SetWaitAllowed(bool allowed); |
224 #else | 228 #else |
225 static bool SetWaitAllowed(bool allowed) { return true; } | 229 static bool SetWaitAllowed(bool allowed) { return true; } |
226 #endif | 230 #endif |
227 | 231 |
228 // Constructing a ScopedAllowWait temporarily allows waiting on the current | 232 // Constructing a ScopedAllowWait temporarily allows waiting on the current |
229 // thread. Doing this is almost always incorrect, which is why we limit who | 233 // thread. Doing this is almost always incorrect, which is why we limit who |
230 // can use this through friend. If you find yourself needing to use this, find | 234 // can use this through friend. If you find yourself needing to use this, find |
231 // another way. Talk to jam or brettw. | 235 // another way. Talk to jam or brettw. |
232 class BASE_EXPORT ScopedAllowWait { | 236 class BASE_EXPORT ScopedAllowWait { |
233 public: | 237 public: |
234 ScopedAllowWait() { previous_value_ = SetWaitAllowed(true); } | 238 ScopedAllowWait() { previous_value_ = SetWaitAllowed(true); } |
235 ~ScopedAllowWait() { SetWaitAllowed(previous_value_); } | 239 ~ScopedAllowWait() { SetWaitAllowed(previous_value_); } |
236 private: | 240 private: |
237 // Whether singleton use is allowed when the ScopedAllowWait was | 241 // Whether singleton use is allowed when the ScopedAllowWait was |
238 // constructed. | 242 // constructed. |
239 bool previous_value_; | 243 bool previous_value_; |
240 | 244 |
241 DISALLOW_COPY_AND_ASSIGN(ScopedAllowWait); | 245 DISALLOW_COPY_AND_ASSIGN(ScopedAllowWait); |
242 }; | 246 }; |
243 | 247 |
244 DISALLOW_IMPLICIT_CONSTRUCTORS(ThreadRestrictions); | 248 DISALLOW_IMPLICIT_CONSTRUCTORS(ThreadRestrictions); |
245 }; | 249 }; |
246 | 250 |
247 } // namespace base | 251 } // namespace base |
248 | 252 |
249 #endif // BASE_THREADING_THREAD_RESTRICTIONS_H_ | 253 #endif // BASE_THREADING_THREAD_RESTRICTIONS_H_ |
OLD | NEW |