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

Side by Side Diff: base/sequence_checker.h

Issue 2905213002: WARN_UNUSED_RESULT on all Thread/SequenceChecker impls (Closed)
Patch Set: Created 3 years, 7 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 | base/threading/thread_checker.h » ('j') | 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_SEQUENCE_CHECKER_H_ 5 #ifndef BASE_SEQUENCE_CHECKER_H_
6 #define BASE_SEQUENCE_CHECKER_H_ 6 #define BASE_SEQUENCE_CHECKER_H_
7 7
8 #include "base/compiler_specific.h"
8 #include "base/logging.h" 9 #include "base/logging.h"
9 #include "base/sequence_checker_impl.h" 10 #include "base/sequence_checker_impl.h"
10 11
11 // SequenceChecker is a helper class used to help verify that some methods of a 12 // SequenceChecker is a helper class used to help verify that some methods of a
12 // class are called sequentially (for thread-safety). 13 // class are called sequentially (for thread-safety).
13 // 14 //
14 // Use the macros below instead of the SequenceChecker directly so that the 15 // Use the macros below instead of the SequenceChecker directly so that the
15 // unused member doesn't result in an extra byte (four when padded) per 16 // unused member doesn't result in an extra byte (four when padded) per
16 // instance in production. 17 // instance in production.
17 // 18 //
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 #endif // DCHECK_IS_ON() 60 #endif // DCHECK_IS_ON()
60 61
61 namespace base { 62 namespace base {
62 63
63 // Do nothing implementation, for use in release mode. 64 // Do nothing implementation, for use in release mode.
64 // 65 //
65 // Note: You should almost always use the SequenceChecker class (through the 66 // Note: You should almost always use the SequenceChecker class (through the
66 // above macros) to get the right version for your build configuration. 67 // above macros) to get the right version for your build configuration.
67 class SequenceCheckerDoNothing { 68 class SequenceCheckerDoNothing {
68 public: 69 public:
69 bool CalledOnValidSequence() const { return true; } 70 bool CalledOnValidSequence() const WARN_UNUSED_RESULT { return true; }
70 71
71 void DetachFromSequence() {} 72 void DetachFromSequence() {}
72 }; 73 };
73 74
74 #if DCHECK_IS_ON() 75 #if DCHECK_IS_ON()
75 class SequenceChecker : public SequenceCheckerImpl { 76 class SequenceChecker : public SequenceCheckerImpl {
76 }; 77 };
77 #else 78 #else
78 class SequenceChecker : public SequenceCheckerDoNothing { 79 class SequenceChecker : public SequenceCheckerDoNothing {
79 }; 80 };
80 #endif // DCHECK_IS_ON() 81 #endif // DCHECK_IS_ON()
81 82
82 } // namespace base 83 } // namespace base
83 84
84 #endif // BASE_SEQUENCE_CHECKER_H_ 85 #endif // BASE_SEQUENCE_CHECKER_H_
OLDNEW
« no previous file with comments | « no previous file | base/threading/thread_checker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698