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

Side by Side Diff: third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc

Issue 2258133002: [scheduler] Implement time-based cpu throttling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renamed Enable/Disable to Enable/DisableThrottling. Created 4 years, 3 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/base/task_queue_manager.h" 5 #include "platform/scheduler/base/task_queue_manager.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 case ProcessTaskResult::EXECUTED: 219 case ProcessTaskResult::EXECUTED:
220 break; 220 break;
221 case ProcessTaskResult::TASK_QUEUE_MANAGER_DELETED: 221 case ProcessTaskResult::TASK_QUEUE_MANAGER_DELETED:
222 return; // The TaskQueueManager got deleted, we must bail out. 222 return; // The TaskQueueManager got deleted, we must bail out.
223 } 223 }
224 224
225 lazy_now = real_time_domain()->CreateLazyNow(); 225 lazy_now = real_time_domain()->CreateLazyNow();
226 if (!delegate_->IsNested() && task_start_time != base::TimeTicks()) { 226 if (!delegate_->IsNested() && task_start_time != base::TimeTicks()) {
227 // Only report top level task durations. 227 // Only report top level task durations.
228 base::TimeTicks task_end_time = lazy_now.Now(); 228 base::TimeTicks task_end_time = lazy_now.Now();
229
alex clarke (OOO till 29th) 2016/09/15 12:19:35 nit: remove blank line here and after the FOR_EACH
altimin 2016/09/15 15:52:10 Done.
229 FOR_EACH_OBSERVER(TaskTimeObserver, task_time_observers_, 230 FOR_EACH_OBSERVER(TaskTimeObserver, task_time_observers_,
230 ReportTaskTime(MonotonicTimeInSeconds(task_start_time), 231 ReportTaskTime(work_queue->task_queue(),
232 MonotonicTimeInSeconds(task_start_time),
231 MonotonicTimeInSeconds(task_end_time))); 233 MonotonicTimeInSeconds(task_end_time)));
234
232 task_start_time = task_end_time; 235 task_start_time = task_end_time;
233 } 236 }
234 237
235 work_queue = nullptr; // The queue may have been unregistered. 238 work_queue = nullptr; // The queue may have been unregistered.
236 239
237 UpdateWorkQueues(lazy_now); 240 UpdateWorkQueues(lazy_now);
238 241
239 // Only run a single task per batch in nested run loops so that we can 242 // Only run a single task per batch in nested run loops so that we can
240 // properly exit the nested loop when someone calls RunLoop::Quit(). 243 // properly exit the nested loop when someone calls RunLoop::Quit().
241 if (delegate_->IsNested()) 244 if (delegate_->IsNested())
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 DCHECK(main_thread_checker_.CalledOnValidThread()); 435 DCHECK(main_thread_checker_.CalledOnValidThread());
433 DCHECK(!work_queue->Empty()); 436 DCHECK(!work_queue->Empty());
434 if (observer_) { 437 if (observer_) {
435 observer_->OnTriedToExecuteBlockedTask(*work_queue->task_queue(), 438 observer_->OnTriedToExecuteBlockedTask(*work_queue->task_queue(),
436 *work_queue->GetFrontTask()); 439 *work_queue->GetFrontTask());
437 } 440 }
438 } 441 }
439 442
440 } // namespace scheduler 443 } // namespace scheduler
441 } // namespace blink 444 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698