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

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

Issue 11649032: Flush SequenceWorkerPool tasks after each unit test. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
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_SEQUENCED_WORKER_POOL_H_ 5 #ifndef BASE_THREADING_SEQUENCED_WORKER_POOL_H_
6 #define BASE_THREADING_SEQUENCED_WORKER_POOL_H_ 6 #define BASE_THREADING_SEQUENCED_WORKER_POOL_H_
7 7
8 #include <cstddef> 8 #include <cstddef>
9 #include <string> 9 #include <string>
10 10
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 const Closure& task, 281 const Closure& task,
282 TimeDelta delay) OVERRIDE; 282 TimeDelta delay) OVERRIDE;
283 virtual bool RunsTasksOnCurrentThread() const OVERRIDE; 283 virtual bool RunsTasksOnCurrentThread() const OVERRIDE;
284 284
285 // Returns true if the current thread is processing a task with the given 285 // Returns true if the current thread is processing a task with the given
286 // sequence_token. 286 // sequence_token.
287 bool IsRunningSequenceOnCurrentThread(SequenceToken sequence_token) const; 287 bool IsRunningSequenceOnCurrentThread(SequenceToken sequence_token) const;
288 288
289 // Blocks until all pending tasks are complete. This should only be called in 289 // Blocks until all pending tasks are complete. This should only be called in
290 // unit tests when you want to validate something that should have happened. 290 // unit tests when you want to validate something that should have happened.
291 // This will not flush delayed tasks, delayed tasks get deleted.
akalin 2013/02/26 00:12:23 semi-colon instead of comma
michaeln 2013/02/27 00:57:12 Done.
291 // 292 //
292 // Note that calling this will not prevent other threads from posting work to 293 // Note that calling this will not prevent other threads from posting work to
293 // the queue while the calling thread is waiting on Flush(). In this case, 294 // the queue while the calling thread is waiting on Flush(). In this case,
294 // Flush will return only when there's no more work in the queue. Normally, 295 // Flush will return only when there's no more work in the queue. Normally,
295 // this doesn't come up since in a test, all the work is being posted from 296 // this doesn't come up since in a test, all the work is being posted from
296 // the main thread. 297 // the main thread.
297 void FlushForTesting(); 298 void FlushForTesting();
298 299
299 // Spuriously signal that there is work to be done. 300 // Spuriously signal that there is work to be done.
300 void SignalHasWorkForTesting(); 301 void SignalHasWorkForTesting();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 // Avoid pulling in too many headers by putting (almost) everything 333 // Avoid pulling in too many headers by putting (almost) everything
333 // into |inner_|. 334 // into |inner_|.
334 const scoped_ptr<Inner> inner_; 335 const scoped_ptr<Inner> inner_;
335 336
336 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPool); 337 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPool);
337 }; 338 };
338 339
339 } // namespace base 340 } // namespace base
340 341
341 #endif // BASE_THREADING_SEQUENCED_WORKER_POOL_H_ 342 #endif // BASE_THREADING_SEQUENCED_WORKER_POOL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698