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
3 // found in the LICENSE file.
5 #ifndef BASE_SEQUENCE_CHECKER_H_
6 #define BASE_SEQUENCE_CHECKER_H_
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
12 #define ENABLE_SEQUENCE_CHECKER 0
15 #include "base/sequence_checker_impl.h"
19 // Do nothing implementation, for use in release mode.
21 // Note: You should almost always use the SequenceChecker class to get
22 // the right version for your build configuration.
23 class SequenceCheckerDoNothing
{
25 bool CalledOnValidSequencedThread() const {
29 void DetachFromSequence() {}
32 // SequenceChecker is a helper class used to help verify that some
33 // methods of a class are called in sequence -- that is, called from
34 // the same SequencedTaskRunner. It is a generalization of
35 // ThreadChecker; see comments in sequence_checker_impl.h for details.
41 // DCHECK(sequence_checker_.CalledOnValidSequencedThread());
46 // SequenceChecker sequence_checker_;
49 // In Release mode, CalledOnValidSequencedThread() will always return true.
50 #if ENABLE_SEQUENCE_CHECKER
51 class SequenceChecker
: public SequenceCheckerImpl
{
54 class SequenceChecker
: public SequenceCheckerDoNothing
{
56 #endif // ENABLE_SEQUENCE_CHECKER
58 #undef ENABLE_SEQUENCE_CHECKER
62 #endif // BASE_SEQUENCE_CHECKER_H_