| Index: base/threading/thread_checker.h
|
| diff --git a/base/threading/thread_checker.h b/base/threading/thread_checker.h
|
| index 33b6764e966b269bfceadeba4ad94b8ce4d0bc32..0b09c6841a3c4a71538254007196a2cf7d4e4a34 100644
|
| --- a/base/threading/thread_checker.h
|
| +++ b/base/threading/thread_checker.h
|
| @@ -6,7 +6,18 @@
|
| #define BASE_THREADING_THREAD_CHECKER_H_
|
| #pragma once
|
|
|
| -#ifndef NDEBUG
|
| +// Apart from debug builds, we also enable the thread checker in
|
| +// builds with DCHECK_ALWAYS_ON so that trybots and waterfall bots
|
| +// with this define will get the same level of thread checking as
|
| +// debug bots.
|
| +//
|
| +// Note that this does not perfectly match situations where DCHECK is
|
| +// enabled. For example a non-official release build may have
|
| +// DCHECK_ALWAYS_ON undefined (and therefore ThreadChecker would be
|
| +// disabled) but have DCHECKs enabled at runtime.
|
| +#define ENABLE_THREAD_CHECKER (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON))
|
| +
|
| +#if ENABLE_THREAD_CHECKER
|
| #include "base/threading/thread_checker_impl.h"
|
| #endif
|
|
|
| @@ -23,6 +34,10 @@ class ThreadCheckerDoNothing {
|
| }
|
|
|
| void DetachFromThread() {}
|
| +
|
| + static bool IsEnabled() {
|
| + return false;
|
| + }
|
| };
|
|
|
| // Before using this class, please consider using NonThreadSafe as it
|
| @@ -46,13 +61,15 @@ class ThreadCheckerDoNothing {
|
| // }
|
| //
|
| // In Release mode, CalledOnValidThread will always return true.
|
| -#ifndef NDEBUG
|
| +#if ENABLE_THREAD_CHECKER
|
| class ThreadChecker : public ThreadCheckerImpl {
|
| };
|
| #else
|
| class ThreadChecker : public ThreadCheckerDoNothing {
|
| };
|
| -#endif // NDEBUG
|
| +#endif // ENABLE_THREAD_CHECKER
|
| +
|
| +#undef ENABLE_THREAD_CHECKER
|
|
|
| } // namespace base
|
|
|
|
|