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

Side by Side Diff: base/threading/thread_checker_impl.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: CR gab #6 (fix comment) 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_THREADING_THREAD_CHECKER_IMPL_H_ 5 #ifndef BASE_THREADING_THREAD_CHECKER_IMPL_H_
6 #define BASE_THREADING_THREAD_CHECKER_IMPL_H_ 6 #define BASE_THREADING_THREAD_CHECKER_IMPL_H_
7 7
8 #include "base/base_export.h" 8 #include "base/base_export.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/sequence_token.h" 10 #include "base/sequence_token.h"
(...skipping 24 matching lines...) Expand all
35 void EnsureAssigned() const; 35 void EnsureAssigned() const;
36 36
37 // Members are mutable so that CalledOnValidThread() can set them. 37 // Members are mutable so that CalledOnValidThread() can set them.
38 38
39 // Synchronizes access to all members. 39 // Synchronizes access to all members.
40 mutable base::Lock lock_; 40 mutable base::Lock lock_;
41 41
42 // Thread on which CalledOnValidThread() may return true. 42 // Thread on which CalledOnValidThread() may return true.
43 mutable PlatformThreadRef thread_id_; 43 mutable PlatformThreadRef thread_id_;
44 44
45 // TaskToken for which CalledOnValidThread() always returns true. This allows
46 // CalledOnValidThread() to return true when called multiple times from the
47 // same task, even if it's not running in a single-threaded context itself
48 // (allowing usage of ThreadChecker/NonThreadSafe objects on the stack in the
49 // scope of one-off tasks). Note: CalledOnValidThread() may return true even
50 // if the current TaskToken is not equal to this.
51 mutable TaskToken task_token_;
52
45 // SequenceToken for which CalledOnValidThread() may return true. Used to 53 // SequenceToken for which CalledOnValidThread() may return true. Used to
46 // ensure that CalledOnValidThread() doesn't return true for TaskScheduler 54 // ensure that CalledOnValidThread() doesn't return true for TaskScheduler
47 // tasks that happen to run on the same thread but weren't posted to the same 55 // tasks that happen to run on the same thread but weren't posted to the same
48 // SingleThreadTaskRunner. 56 // SingleThreadTaskRunner.
49 mutable SequenceToken sequence_token_; 57 mutable SequenceToken sequence_token_;
50 }; 58 };
51 59
52 } // namespace base 60 } // namespace base
53 61
54 #endif // BASE_THREADING_THREAD_CHECKER_IMPL_H_ 62 #endif // BASE_THREADING_THREAD_CHECKER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698