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

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

Issue 2956683002: chrome://profiler infrastructure uses base time types. (Closed)
Patch Set: Address nit. Created 3 years, 5 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
« no previous file with comments | « base/tracking_info.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 11 matching lines...) Expand all
22 namespace scheduler { 22 namespace scheduler {
23 23
24 namespace { 24 namespace {
25 const size_t kRecordRecordTaskDelayHistogramsEveryNTasks = 10; 25 const size_t kRecordRecordTaskDelayHistogramsEveryNTasks = 10;
26 26
27 void RecordDelayedTaskLateness(base::TimeDelta lateness) { 27 void RecordDelayedTaskLateness(base::TimeDelta lateness) {
28 UMA_HISTOGRAM_TIMES("RendererScheduler.TaskQueueManager.DelayedTaskLateness", 28 UMA_HISTOGRAM_TIMES("RendererScheduler.TaskQueueManager.DelayedTaskLateness",
29 lateness); 29 lateness);
30 } 30 }
31 31
32 void RecordImmediateTaskQueueingDuration(tracked_objects::Duration duration) { 32 void RecordImmediateTaskQueueingDuration(base::TimeDelta duration) {
33 UMA_HISTOGRAM_TIMES( 33 UMA_HISTOGRAM_TIMES(
34 "RendererScheduler.TaskQueueManager.ImmediateTaskQueueingDuration", 34 "RendererScheduler.TaskQueueManager.ImmediateTaskQueueingDuration",
35 base::TimeDelta::FromMilliseconds(duration.InMilliseconds())); 35 duration);
36 } 36 }
37 37
38 double MonotonicTimeInSeconds(base::TimeTicks time_ticks) { 38 double MonotonicTimeInSeconds(base::TimeTicks time_ticks) {
39 return (time_ticks - base::TimeTicks()).InSecondsF(); 39 return (time_ticks - base::TimeTicks()).InSecondsF();
40 } 40 }
41 41
42 // Converts a OnceClosure to a RepeatingClosure. It hits CHECK failure to run 42 // Converts a OnceClosure to a RepeatingClosure. It hits CHECK failure to run
43 // the resulting RepeatingClosure more than once. 43 // the resulting RepeatingClosure more than once.
44 // TODO(tzik): This will be unneeded after the Closure-to-OnceClosure migration 44 // TODO(tzik): This will be unneeded after the Closure-to-OnceClosure migration
45 // on TaskRunner finished. Remove it once it gets unneeded. 45 // on TaskRunner finished. Remove it once it gets unneeded.
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 const internal::TaskQueueImpl::Task& pending_task, 557 const internal::TaskQueueImpl::Task& pending_task,
558 const internal::TaskQueueImpl* queue) { 558 const internal::TaskQueueImpl* queue) {
559 if ((task_count_++ % kRecordRecordTaskDelayHistogramsEveryNTasks) != 0) 559 if ((task_count_++ % kRecordRecordTaskDelayHistogramsEveryNTasks) != 0)
560 return; 560 return;
561 561
562 // Record delayed task lateness and immediate task queuing durations. 562 // Record delayed task lateness and immediate task queuing durations.
563 if (!pending_task.delayed_run_time.is_null()) { 563 if (!pending_task.delayed_run_time.is_null()) {
564 RecordDelayedTaskLateness(delegate_->NowTicks() - 564 RecordDelayedTaskLateness(delegate_->NowTicks() -
565 pending_task.delayed_run_time); 565 pending_task.delayed_run_time);
566 } else if (!pending_task.time_posted.is_null()) { 566 } else if (!pending_task.time_posted.is_null()) {
567 RecordImmediateTaskQueueingDuration(tracked_objects::TrackedTime::Now() - 567 RecordImmediateTaskQueueingDuration(base::TimeTicks::Now() -
568 pending_task.time_posted); 568 pending_task.time_posted);
569 } 569 }
570 } 570 }
571 571
572 bool TaskQueueManager::RunsTasksInCurrentSequence() const { 572 bool TaskQueueManager::RunsTasksInCurrentSequence() const {
573 return delegate_->RunsTasksInCurrentSequence(); 573 return delegate_->RunsTasksInCurrentSequence();
574 } 574 }
575 575
576 void TaskQueueManager::SetWorkBatchSize(int work_batch_size) { 576 void TaskQueueManager::SetWorkBatchSize(int work_batch_size) {
577 DCHECK(main_thread_checker_.CalledOnValidThread()); 577 DCHECK(main_thread_checker_.CalledOnValidThread());
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 for (const scoped_refptr<internal::TaskQueueImpl>& queue : queues_) { 704 for (const scoped_refptr<internal::TaskQueueImpl>& queue : queues_) {
705 TimeDomain* time_domain = queue->GetTimeDomain(); 705 TimeDomain* time_domain = queue->GetTimeDomain();
706 if (time_domain_now.find(time_domain) == time_domain_now.end()) 706 if (time_domain_now.find(time_domain) == time_domain_now.end())
707 time_domain_now.insert(std::make_pair(time_domain, time_domain->Now())); 707 time_domain_now.insert(std::make_pair(time_domain, time_domain->Now()));
708 queue->SweepCanceledDelayedTasks(time_domain_now[time_domain]); 708 queue->SweepCanceledDelayedTasks(time_domain_now[time_domain]);
709 } 709 }
710 } 710 }
711 711
712 } // namespace scheduler 712 } // namespace scheduler
713 } // namespace blink 713 } // namespace blink
OLDNEW
« no previous file with comments | « base/tracking_info.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698