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

Unified Diff: base/sequence_token.h

Issue 2213263002: Make ThreadChecker::CalledOnValidThread() return true when called from the same task. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: similarity Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: base/sequence_token.h
diff --git a/base/sequence_token.h b/base/sequence_token.h
deleted file mode 100644
index 8d1398ea3c592f082cddcc607733795382b4f028..0000000000000000000000000000000000000000
--- a/base/sequence_token.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// 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_
-
-#include "base/base_export.h"
-#include "base/macros.h"
-
-namespace base {
-
-// A token that identifies a series of sequenced tasks (i.e. tasks that run one
-// at a time in posting order).
-class BASE_EXPORT SequenceToken {
- public:
- // Instantiates an invalid SequenceToken.
- SequenceToken() = default;
-
- // Explicitly allow copy.
- SequenceToken(const SequenceToken& other) = default;
- SequenceToken& operator=(const SequenceToken& other) = default;
-
- // An invalid SequenceToken is not equal to any other SequenceToken, including
- // other invalid SequenceTokens.
- bool operator==(const SequenceToken& other) const;
- bool operator!=(const SequenceToken& other) const;
-
- // Returns true if this is a valid SequenceToken.
- bool IsValid() const;
-
- // Returns a valid SequenceToken which isn't equal to any previously returned
- // SequenceToken.
- static SequenceToken Create();
-
- // Returns the SequenceToken associated with the task running on the current
- // thread, as determined by the active ScopedSetSequenceTokenForCurrentThread
- // if any.
- static SequenceToken GetForCurrentThread();
-
- private:
- SequenceToken(int token) : token_(token) {}
-
- static constexpr int kInvalidSequenceToken = -1;
- int token_ = kInvalidSequenceToken;
-};
-
-// Throughout its lifetime, determines the value returned by
-// SequenceToken::GetForCurrentThread().
-class BASE_EXPORT ScopedSetSequenceTokenForCurrentThread {
- public:
- ScopedSetSequenceTokenForCurrentThread(const SequenceToken& token);
- ~ScopedSetSequenceTokenForCurrentThread();
-
- private:
- friend class SequenceToken;
-
- const SequenceToken token_;
-
- DISALLOW_COPY_AND_ASSIGN(ScopedSetSequenceTokenForCurrentThread);
-};
-
-} // namespace base
-
-#endif // BASE_SEQUENCE_TOKEN_H_

Powered by Google App Engine
This is Rietveld 408576698