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_IMPL_H_
6 #define BASE_SEQUENCE_CHECKER_IMPL_H_
10 #include "base/base_export.h"
11 #include "base/compiler_specific.h"
12 #include "base/macros.h"
13 #include "base/synchronization/lock.h"
17 // Real implementation of SequenceChecker for use in debug mode or for temporary
18 // use in release mode (e.g. to CHECK on a threading issue seen only in the
21 // Note: You should almost always use the SequenceChecker class to get the right
22 // version for your build configuration.
23 class BASE_EXPORT SequenceCheckerImpl {
25 SequenceCheckerImpl();
26 ~SequenceCheckerImpl();
28 // Returns true if called in sequence with previous calls to this method and
30 bool CalledOnValidSequence() const WARN_UNUSED_RESULT;
32 // Unbinds the checker from the currently associated sequence. The checker
33 // will be re-bound on the next call to CalledOnValidSequence().
34 void DetachFromSequence();
39 // Guards all variables below.
41 mutable std::unique_ptr<Core> core_;
43 DISALLOW_COPY_AND_ASSIGN(SequenceCheckerImpl);
48 #endif // BASE_SEQUENCE_CHECKER_IMPL_H_