[go: nahoru, domu]

blob: 7dfd0fab708a492a75e91fb6709ad53fc3d6aeeb [file] [log] [blame]
Avi Drissmane4622aa2022-09-08 20:36:061// Copyright 2021 The Chromium Authors
Lei Zhangb9e7c4b2021-12-21 17:56:052// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "base/sequence_checker.h"
6
7#if DCHECK_IS_ON()
8#include <memory>
9#include <ostream>
10
11#include "base/check.h"
12#include "base/debug/stack_trace.h"
13#endif
14
15namespace base {
16
17#if DCHECK_IS_ON()
18ScopedValidateSequenceChecker::ScopedValidateSequenceChecker(
19 const SequenceChecker& checker) {
20 std::unique_ptr<debug::StackTrace> bound_at;
21 DCHECK(checker.CalledOnValidSequence(&bound_at))
22 << (bound_at ? "\nWas attached to sequence at:\n" + bound_at->ToString()
23 : "");
24}
25
26ScopedValidateSequenceChecker::~ScopedValidateSequenceChecker() = default;
27#endif // DCHECK_IS_ON()
28
29} // namespace base