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

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: One more fix 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 break; 243 break;
244 case ProcessTaskResult::TASK_QUEUE_MANAGER_DELETED: 244 case ProcessTaskResult::TASK_QUEUE_MANAGER_DELETED:
245 return; // The TaskQueueManager got deleted, we must bail out. 245 return; // The TaskQueueManager got deleted, we must bail out.
246 } 246 }
247 247
248 lazy_now = real_time_domain()->CreateLazyNow(); 248 lazy_now = real_time_domain()->CreateLazyNow();
249 if (!delegate_->IsNested() && task_start_time != base::TimeTicks()) { 249 if (!delegate_->IsNested() && task_start_time != base::TimeTicks()) {
250 // Only report top level task durations. 250 // Only report top level task durations.
251 base::TimeTicks task_end_time = lazy_now.Now(); 251 base::TimeTicks task_end_time = lazy_now.Now();
252 FOR_EACH_OBSERVER(TaskTimeObserver, task_time_observers_, 252 FOR_EACH_OBSERVER(TaskTimeObserver, task_time_observers_,
253 ReportTaskTime(MonotonicTimeInSeconds(task_start_time), 253 ReportTaskTime(work_queue->task_queue(),
254 MonotonicTimeInSeconds(task_start_time),
254 MonotonicTimeInSeconds(task_end_time))); 255 MonotonicTimeInSeconds(task_end_time)));
255 task_start_time = task_end_time; 256 task_start_time = task_end_time;
256 } 257 }
257 258
258 work_queue = nullptr; // The queue may have been unregistered. 259 work_queue = nullptr; // The queue may have been unregistered.
259 260
260 UpdateWorkQueues(lazy_now); 261 UpdateWorkQueues(lazy_now);
261 262
262 // Only run a single task per batch in nested run loops so that we can 263 // Only run a single task per batch in nested run loops so that we can
263 // properly exit the nested loop when someone calls RunLoop::Quit(). 264 // properly exit the nested loop when someone calls RunLoop::Quit().
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 DCHECK(main_thread_checker_.CalledOnValidThread()); 463 DCHECK(main_thread_checker_.CalledOnValidThread());
463 DCHECK(!work_queue->Empty()); 464 DCHECK(!work_queue->Empty());
464 if (observer_) { 465 if (observer_) {
465 observer_->OnTriedToExecuteBlockedTask(*work_queue->task_queue(), 466 observer_->OnTriedToExecuteBlockedTask(*work_queue->task_queue(),
466 *work_queue->GetFrontTask()); 467 *work_queue->GetFrontTask());
467 } 468 }
468 } 469 }
469 470
470 } // namespace scheduler 471 } // namespace scheduler
471 } // namespace blink 472 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698