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