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

Side by Side Diff: base/task_scheduler/task_scheduler_impl.cc

Issue 2362253002: TaskScheduler: Add FlushForTesting(). (Closed)
Patch Set: fix build error Created 4 years, 2 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 | « base/task_scheduler/task_scheduler_impl.h ('k') | base/task_scheduler/task_tracker.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "base/task_scheduler/task_scheduler_impl.h" 5 #include "base/task_scheduler/task_scheduler_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 ExecutionMode execution_mode) { 50 ExecutionMode execution_mode) {
51 return GetWorkerPoolForTraits(traits)->CreateTaskRunnerWithTraits( 51 return GetWorkerPoolForTraits(traits)->CreateTaskRunnerWithTraits(
52 traits, execution_mode); 52 traits, execution_mode);
53 } 53 }
54 54
55 void TaskSchedulerImpl::Shutdown() { 55 void TaskSchedulerImpl::Shutdown() {
56 // TODO(fdoray): Increase the priority of BACKGROUND tasks blocking shutdown. 56 // TODO(fdoray): Increase the priority of BACKGROUND tasks blocking shutdown.
57 task_tracker_.Shutdown(); 57 task_tracker_.Shutdown();
58 } 58 }
59 59
60 void TaskSchedulerImpl::FlushForTesting() {
61 task_tracker_.Flush();
62 }
63
60 void TaskSchedulerImpl::JoinForTesting() { 64 void TaskSchedulerImpl::JoinForTesting() {
61 #if DCHECK_IS_ON() 65 #if DCHECK_IS_ON()
62 DCHECK(!join_for_testing_returned_.IsSet()); 66 DCHECK(!join_for_testing_returned_.IsSet());
63 #endif 67 #endif
64 for (const auto& worker_pool : worker_pools_) 68 for (const auto& worker_pool : worker_pools_)
65 worker_pool->JoinForTesting(); 69 worker_pool->JoinForTesting();
66 service_thread_->JoinForTesting(); 70 service_thread_->JoinForTesting();
67 #if DCHECK_IS_ON() 71 #if DCHECK_IS_ON()
68 join_for_testing_returned_.Set(); 72 join_for_testing_returned_.Set();
69 #endif 73 #endif
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 GetWorkerPoolForTraits(traits)->ReEnqueueSequence(std::move(sequence), 128 GetWorkerPoolForTraits(traits)->ReEnqueueSequence(std::move(sequence),
125 sort_key); 129 sort_key);
126 } 130 }
127 131
128 void TaskSchedulerImpl::OnDelayedRunTimeUpdated() { 132 void TaskSchedulerImpl::OnDelayedRunTimeUpdated() {
129 service_thread_->WakeUp(); 133 service_thread_->WakeUp();
130 } 134 }
131 135
132 } // namespace internal 136 } // namespace internal
133 } // namespace base 137 } // namespace base
OLDNEW
« no previous file with comments | « base/task_scheduler/task_scheduler_impl.h ('k') | base/task_scheduler/task_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698