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

Side by Side Diff: third_party/WebKit/Source/platform/scheduler/child/worker_scheduler_impl.cc

Issue 2806623004: Worker: Introduce per-global-scope task scheduler (Closed)
Patch Set: wip Created 3 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "platform/scheduler/child/worker_scheduler_impl.h" 5 #include "platform/scheduler/child/worker_scheduler_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "base/trace_event/trace_event_argument.h" 10 #include "base/trace_event/trace_event_argument.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 // The lifetime could be radically different for different workers, 86 // The lifetime could be radically different for different workers,
87 // some workers could be short-lived (but last at least 1 sec in 87 // some workers could be short-lived (but last at least 1 sec in
88 // Service Workers case) or could be around as long as the tab is open. 88 // Service Workers case) or could be around as long as the tab is open.
89 UMA_HISTOGRAM_CUSTOM_TIMES( 89 UMA_HISTOGRAM_CUSTOM_TIMES(
90 "WorkerThread.Runtime", delta, base::TimeDelta::FromSeconds(1), 90 "WorkerThread.Runtime", delta, base::TimeDelta::FromSeconds(1),
91 base::TimeDelta::FromDays(1), 50 /* bucket count */); 91 base::TimeDelta::FromDays(1), 50 /* bucket count */);
92 helper_.Shutdown(); 92 helper_.Shutdown();
93 } 93 }
94 94
95 scoped_refptr<TaskQueue> WorkerSchedulerImpl::NewUnthrottledTaskRunner(
96 TaskQueue::QueueType queue_type) {
97 helper_.CheckOnValidThread();
98 // TODO: TimeDomain??
Sami 2017/04/10 16:58:10 A real time time domain (i.e., nullptr) is fine fo
nhiroki 2017/04/11 10:47:54 Thank you for the information. Removed this commen
99 scoped_refptr<TaskQueue> unthrottled_task_queue(
100 helper_.NewTaskQueue(TaskQueue::Spec(queue_type)
101 .SetShouldMonitorQuiescence(true)
102 .SetTimeDomain(nullptr)));
103 return unthrottled_task_queue;
104 }
105
95 SchedulerHelper* WorkerSchedulerImpl::GetSchedulerHelperForTesting() { 106 SchedulerHelper* WorkerSchedulerImpl::GetSchedulerHelperForTesting() {
96 return &helper_; 107 return &helper_;
97 } 108 }
98 109
99 bool WorkerSchedulerImpl::CanEnterLongIdlePeriod(base::TimeTicks, 110 bool WorkerSchedulerImpl::CanEnterLongIdlePeriod(base::TimeTicks,
100 base::TimeDelta*) { 111 base::TimeDelta*) {
101 return true; 112 return true;
102 } 113 }
103 114
104 base::TimeTicks WorkerSchedulerImpl::CurrentIdleTaskDeadlineForTesting() const { 115 base::TimeTicks WorkerSchedulerImpl::CurrentIdleTaskDeadlineForTesting() const {
105 return idle_helper_.CurrentIdleTaskDeadline(); 116 return idle_helper_.CurrentIdleTaskDeadline();
106 } 117 }
107 118
108 } // namespace scheduler 119 } // namespace scheduler
109 } // namespace blink 120 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698