OLD | NEW |
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 // The lifetime could be radically different for different workers, | 114 // The lifetime could be radically different for different workers, |
115 // some workers could be short-lived (but last at least 1 sec in | 115 // some workers could be short-lived (but last at least 1 sec in |
116 // Service Workers case) or could be around as long as the tab is open. | 116 // Service Workers case) or could be around as long as the tab is open. |
117 UMA_HISTOGRAM_CUSTOM_TIMES( | 117 UMA_HISTOGRAM_CUSTOM_TIMES( |
118 "WorkerThread.Runtime", delta, base::TimeDelta::FromSeconds(1), | 118 "WorkerThread.Runtime", delta, base::TimeDelta::FromSeconds(1), |
119 base::TimeDelta::FromDays(1), 50 /* bucket count */); | 119 base::TimeDelta::FromDays(1), 50 /* bucket count */); |
120 helper_.Shutdown(); | 120 helper_.Shutdown(); |
121 } | 121 } |
122 | 122 |
| 123 scoped_refptr<TaskQueue> WorkerSchedulerImpl::NewUnthrottledTaskRunner( |
| 124 TaskQueue::QueueType queue_type) { |
| 125 helper_.CheckOnValidThread(); |
| 126 scoped_refptr<TaskQueue> unthrottled_task_queue( |
| 127 helper_.NewTaskQueue(TaskQueue::Spec(queue_type) |
| 128 .SetShouldMonitorQuiescence(true) |
| 129 .SetTimeDomain(nullptr))); |
| 130 return unthrottled_task_queue; |
| 131 } |
| 132 |
123 SchedulerHelper* WorkerSchedulerImpl::GetSchedulerHelperForTesting() { | 133 SchedulerHelper* WorkerSchedulerImpl::GetSchedulerHelperForTesting() { |
124 return &helper_; | 134 return &helper_; |
125 } | 135 } |
126 | 136 |
127 bool WorkerSchedulerImpl::CanEnterLongIdlePeriod(base::TimeTicks, | 137 bool WorkerSchedulerImpl::CanEnterLongIdlePeriod(base::TimeTicks, |
128 base::TimeDelta*) { | 138 base::TimeDelta*) { |
129 return true; | 139 return true; |
130 } | 140 } |
131 | 141 |
132 base::TimeTicks WorkerSchedulerImpl::CurrentIdleTaskDeadlineForTesting() const { | 142 base::TimeTicks WorkerSchedulerImpl::CurrentIdleTaskDeadlineForTesting() const { |
(...skipping 10 matching lines...) Expand all Loading... |
143 MonotonicTimeInSecondsToTimeTicks(start_time); | 153 MonotonicTimeInSecondsToTimeTicks(start_time); |
144 base::TimeTicks end_time_ticks = MonotonicTimeInSecondsToTimeTicks(end_time); | 154 base::TimeTicks end_time_ticks = MonotonicTimeInSecondsToTimeTicks(end_time); |
145 | 155 |
146 load_tracker_.RecordTaskTime(start_time_ticks, end_time_ticks); | 156 load_tracker_.RecordTaskTime(start_time_ticks, end_time_ticks); |
147 } | 157 } |
148 | 158 |
149 void WorkerSchedulerImpl::OnBeginNestedMessageLoop() {} | 159 void WorkerSchedulerImpl::OnBeginNestedMessageLoop() {} |
150 | 160 |
151 } // namespace scheduler | 161 } // namespace scheduler |
152 } // namespace blink | 162 } // namespace blink |
OLD | NEW |