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

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

Issue 2420973002: Plumb Task Scheduler Histograms to the Task Scheduler Internals Page (Closed)
Patch Set: The Return of std::move 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
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"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/metrics/histogram_base.h"
12 #include "base/task_scheduler/scheduler_worker_pool_params.h" 13 #include "base/task_scheduler/scheduler_worker_pool_params.h"
13 #include "base/task_scheduler/sequence_sort_key.h" 14 #include "base/task_scheduler/sequence_sort_key.h"
14 #include "base/task_scheduler/task.h" 15 #include "base/task_scheduler/task.h"
15 #include "base/time/time.h" 16 #include "base/time/time.h"
16 17
17 namespace base { 18 namespace base {
18 namespace internal { 19 namespace internal {
19 20
20 // static 21 // static
21 std::unique_ptr<TaskSchedulerImpl> TaskSchedulerImpl::Create( 22 std::unique_ptr<TaskSchedulerImpl> TaskSchedulerImpl::Create(
(...skipping 22 matching lines...) Expand all
44 make_scoped_refptr(new Sequence), nullptr); 45 make_scoped_refptr(new Sequence), nullptr);
45 } 46 }
46 47
47 scoped_refptr<TaskRunner> TaskSchedulerImpl::CreateTaskRunnerWithTraits( 48 scoped_refptr<TaskRunner> TaskSchedulerImpl::CreateTaskRunnerWithTraits(
48 const TaskTraits& traits, 49 const TaskTraits& traits,
49 ExecutionMode execution_mode) { 50 ExecutionMode execution_mode) {
50 return GetWorkerPoolForTraits(traits)->CreateTaskRunnerWithTraits( 51 return GetWorkerPoolForTraits(traits)->CreateTaskRunnerWithTraits(
51 traits, execution_mode); 52 traits, execution_mode);
52 } 53 }
53 54
55 std::vector<const HistogramBase*> TaskSchedulerImpl::GetHistograms() const {
56 std::vector<const HistogramBase*> histograms;
57 for (const auto& worker_pool : worker_pools_)
58 worker_pool->GetHistograms(&histograms);
59
60 return histograms;
61 }
62
54 void TaskSchedulerImpl::Shutdown() { 63 void TaskSchedulerImpl::Shutdown() {
55 // TODO(fdoray): Increase the priority of BACKGROUND tasks blocking shutdown. 64 // TODO(fdoray): Increase the priority of BACKGROUND tasks blocking shutdown.
56 task_tracker_.Shutdown(); 65 task_tracker_.Shutdown();
57 } 66 }
58 67
59 void TaskSchedulerImpl::FlushForTesting() { 68 void TaskSchedulerImpl::FlushForTesting() {
60 task_tracker_.Flush(); 69 task_tracker_.Flush();
61 } 70 }
62 71
63 void TaskSchedulerImpl::JoinForTesting() { 72 void TaskSchedulerImpl::JoinForTesting() {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // in |sequence|. 144 // in |sequence|.
136 const TaskTraits traits = 145 const TaskTraits traits =
137 sequence->PeekTaskTraits().WithPriority(sort_key.priority()); 146 sequence->PeekTaskTraits().WithPriority(sort_key.priority());
138 147
139 GetWorkerPoolForTraits(traits)->ReEnqueueSequence(std::move(sequence), 148 GetWorkerPoolForTraits(traits)->ReEnqueueSequence(std::move(sequence),
140 sort_key); 149 sort_key);
141 } 150 }
142 151
143 } // namespace internal 152 } // namespace internal
144 } // namespace base 153 } // namespace base
OLDNEW
« no previous file with comments | « base/task_scheduler/task_scheduler_impl.h ('k') | chrome/browser/resources/task_scheduler_internals/index.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698