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

Side by Side Diff: base/sequence_checker.h

Issue 2163023002: Unify usage of logging/assert macros in base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: oops commit on wrong branch Created 4 years, 5 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
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_SEQUENCE_CHECKER_H_ 5 #ifndef BASE_SEQUENCE_CHECKER_H_
6 #define BASE_SEQUENCE_CHECKER_H_ 6 #define BASE_SEQUENCE_CHECKER_H_
7 7
8 // See comments for the similar block in thread_checker.h.
9 #if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON))
10 #define ENABLE_SEQUENCE_CHECKER 1
11 #else
12 #define ENABLE_SEQUENCE_CHECKER 0
13 #endif
14
15 #include "base/sequence_checker_impl.h" 8 #include "base/sequence_checker_impl.h"
16 9
17 namespace base { 10 namespace base {
18 11
19 // Do nothing implementation, for use in release mode. 12 // Do nothing implementation, for use in release mode.
20 // 13 //
21 // Note: You should almost always use the SequenceChecker class to get 14 // Note: You should almost always use the SequenceChecker class to get
22 // the right version for your build configuration. 15 // the right version for your build configuration.
23 class SequenceCheckerDoNothing { 16 class SequenceCheckerDoNothing {
24 public: 17 public:
(...skipping 15 matching lines...) Expand all
40 // void Foo() { 33 // void Foo() {
41 // DCHECK(sequence_checker_.CalledOnValidSequencedThread()); 34 // DCHECK(sequence_checker_.CalledOnValidSequencedThread());
42 // ... (do stuff) ... 35 // ... (do stuff) ...
43 // } 36 // }
44 // 37 //
45 // private: 38 // private:
46 // SequenceChecker sequence_checker_; 39 // SequenceChecker sequence_checker_;
47 // } 40 // }
48 // 41 //
49 // In Release mode, CalledOnValidSequencedThread() will always return true. 42 // In Release mode, CalledOnValidSequencedThread() will always return true.
50 #if ENABLE_SEQUENCE_CHECKER 43 #if DCHECK_IS_ON()
51 class SequenceChecker : public SequenceCheckerImpl { 44 class SequenceChecker : public SequenceCheckerImpl {
52 }; 45 };
53 #else 46 #else
54 class SequenceChecker : public SequenceCheckerDoNothing { 47 class SequenceChecker : public SequenceCheckerDoNothing {
55 }; 48 };
56 #endif // ENABLE_SEQUENCE_CHECKER 49 #endif // DCHECK_IS_ON()
57
58 #undef ENABLE_SEQUENCE_CHECKER
59 50
60 } // namespace base 51 } // namespace base
61 52
62 #endif // BASE_SEQUENCE_CHECKER_H_ 53 #endif // BASE_SEQUENCE_CHECKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698