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

Side by Side Diff: base/threading/thread.h

Issue 2337253003: Add FlushForTesting to base::Thread. (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « no previous file | base/threading/thread.cc » ('j') | base/threading/thread.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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_H_ 5 #ifndef BASE_THREADING_THREAD_H_
6 #define BASE_THREADING_THREAD_H_ 6 #define BASE_THREADING_THREAD_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 // WaitUntilThreadStarted(). 133 // WaitUntilThreadStarted().
134 // Note that using this (instead of Start() or StartWithOptions() causes 134 // Note that using this (instead of Start() or StartWithOptions() causes
135 // jank on the calling thread, should be used only in testing code. 135 // jank on the calling thread, should be used only in testing code.
136 bool StartAndWaitForTesting(); 136 bool StartAndWaitForTesting();
137 137
138 // Blocks until the thread starts running. Called within StartAndWait(). 138 // Blocks until the thread starts running. Called within StartAndWait().
139 // Note that calling this causes jank on the calling thread, must be used 139 // Note that calling this causes jank on the calling thread, must be used
140 // carefully for production code. 140 // carefully for production code.
141 bool WaitUntilThreadStarted() const; 141 bool WaitUntilThreadStarted() const;
142 142
143 // Blocks until all tasks previously posted to this thread have been executed.
144 void FlushForTesting();
145
143 // Signals the thread to exit and returns once the thread has exited. The 146 // Signals the thread to exit and returns once the thread has exited. The
144 // Thread object is completely reset and may be used as if it were newly 147 // Thread object is completely reset and may be used as if it were newly
145 // constructed (i.e., Start may be called again). Can only be called if 148 // constructed (i.e., Start may be called again). Can only be called if
146 // |joinable_|. 149 // |joinable_|.
147 // 150 //
148 // Stop may be called multiple times and is simply ignored if the thread is 151 // Stop may be called multiple times and is simply ignored if the thread is
149 // already stopped or currently stopping. 152 // already stopped or currently stopping.
150 // 153 //
151 // NOTE: If you are a consumer of Thread, it is not necessary to call this 154 // NOTE: If you are a consumer of Thread, it is not necessary to call this
152 // before deleting your Thread objects, as the destructor will do it. 155 // before deleting your Thread objects, as the destructor will do it.
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 // This class is not thread-safe, use this to verify access from the owning 309 // This class is not thread-safe, use this to verify access from the owning
307 // sequence of the Thread. 310 // sequence of the Thread.
308 SequenceChecker owning_sequence_checker_; 311 SequenceChecker owning_sequence_checker_;
309 312
310 DISALLOW_COPY_AND_ASSIGN(Thread); 313 DISALLOW_COPY_AND_ASSIGN(Thread);
311 }; 314 };
312 315
313 } // namespace base 316 } // namespace base
314 317
315 #endif // BASE_THREADING_THREAD_H_ 318 #endif // BASE_THREADING_THREAD_H_
OLDNEW
« no previous file with comments | « no previous file | base/threading/thread.cc » ('j') | base/threading/thread.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698