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

Side by Side Diff: base/threading/thread_checker.h

Issue 1324673002: Use #if DCHECK_IS_ON() in base/threading/thread_checker.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 | « no previous file | no next file » | 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 #ifndef BASE_THREADING_THREAD_CHECKER_H_ 5 #ifndef BASE_THREADING_THREAD_CHECKER_H_
6 #define BASE_THREADING_THREAD_CHECKER_H_ 6 #define BASE_THREADING_THREAD_CHECKER_H_
7 7
8 #include "base/logging.h"
9 #include "base/threading/thread_checker_impl.h"
10
8 // Apart from debug builds, we also enable the thread checker in 11 // Apart from debug builds, we also enable the thread checker in
9 // builds with DCHECK_ALWAYS_ON so that trybots and waterfall bots 12 // builds with DCHECK_ALWAYS_ON so that trybots and waterfall bots
10 // with this define will get the same level of thread checking as 13 // with this define will get the same level of thread checking as
11 // debug bots. 14 // debug bots.
12 // 15 #if DCHECK_IS_ON()
13 // Note that this does not perfectly match situations where DCHECK is
14 // enabled. For example a non-official release build may have
15 // DCHECK_ALWAYS_ON undefined (and therefore ThreadChecker would be
16 // disabled) but have DCHECKs enabled at runtime.
17 #if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON))
18 #define ENABLE_THREAD_CHECKER 1 16 #define ENABLE_THREAD_CHECKER 1
19 #else 17 #else
20 #define ENABLE_THREAD_CHECKER 0 18 #define ENABLE_THREAD_CHECKER 0
21 #endif 19 #endif
22 20
23 #include "base/threading/thread_checker_impl.h"
24
25 namespace base { 21 namespace base {
26 22
27 // Do nothing implementation, for use in release mode. 23 // Do nothing implementation, for use in release mode.
28 // 24 //
29 // Note: You should almost always use the ThreadChecker class to get the 25 // Note: You should almost always use the ThreadChecker class to get the
30 // right version for your build configuration. 26 // right version for your build configuration.
31 class ThreadCheckerDoNothing { 27 class ThreadCheckerDoNothing {
32 public: 28 public:
33 bool CalledOnValidThread() const WARN_UNUSED_RESULT { 29 bool CalledOnValidThread() const WARN_UNUSED_RESULT {
34 return true; 30 return true;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 #else 70 #else
75 class ThreadChecker : public ThreadCheckerDoNothing { 71 class ThreadChecker : public ThreadCheckerDoNothing {
76 }; 72 };
77 #endif // ENABLE_THREAD_CHECKER 73 #endif // ENABLE_THREAD_CHECKER
78 74
79 #undef ENABLE_THREAD_CHECKER 75 #undef ENABLE_THREAD_CHECKER
80 76
81 } // namespace base 77 } // namespace base
82 78
83 #endif // BASE_THREADING_THREAD_CHECKER_H_ 79 #endif // BASE_THREADING_THREAD_CHECKER_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698