// Copyright 2016 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef BASE_SEQUENCE_TOKEN_H_ #define BASE_SEQUENCE_TOKEN_H_ // TODO: Remove this unused include once no other file indirectly depends on it. #include "base/auto_reset.h" #include "base/base_export.h" namespace base { namespace internal { // A token that identifies a series of sequenced work items (i.e. tasks, native // message handlers, code blocks running outside or a `RunLoop`, etc. that are // mutually exclusive). class BASE_EXPORT SequenceToken { … }; // A token that identifies a task. // // This is used by ThreadCheckerImpl to determine whether calls to // CalledOnValidThread() come from the same task and hence are deterministically // single-threaded (vs. calls coming from different sequenced or parallel tasks, // which may or may not run on the same thread). class BASE_EXPORT TaskToken { … }; // Returns true if a thread checker bound in a different task than the current // one but on the same sequence and thread may return true from // `CalledOnValidSequence()`. bool BASE_EXPORT CurrentTaskIsThreadBound(); // Identifies a scope in which a task runs. class BASE_EXPORT [[maybe_unused, nodiscard]] TaskScope { … }; } // namespace internal // Returns true if the current task is run synchronously by `RunOrPostTask()`. bool BASE_EXPORT CurrentTaskIsRunningSynchronously(); } // namespace base #endif // BASE_SEQUENCE_TOKEN_H_