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

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

Issue 2823103003: Introduce TaskRunner::RunsTasksInCurrentSequence() (Closed)
Patch Set: rebase & remove inline keyword Created 3 years, 7 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 : real_time_domain_(new RealTimeDomain()), 55 : real_time_domain_(new RealTimeDomain()),
56 delegate_(delegate), 56 delegate_(delegate),
57 task_was_run_on_quiescence_monitored_queue_(false), 57 task_was_run_on_quiescence_monitored_queue_(false),
58 record_task_delay_histograms_(true), 58 record_task_delay_histograms_(true),
59 work_batch_size_(1), 59 work_batch_size_(1),
60 task_count_(0), 60 task_count_(0),
61 currently_executing_task_queue_(nullptr), 61 currently_executing_task_queue_(nullptr),
62 observer_(nullptr), 62 observer_(nullptr),
63 deletion_sentinel_(new DeletionSentinel()), 63 deletion_sentinel_(new DeletionSentinel()),
64 weak_factory_(this) { 64 weak_factory_(this) {
65 DCHECK(delegate->RunsTasksOnCurrentThread()); 65 DCHECK(delegate->RunsTasksInCurrentSequence());
66 TRACE_EVENT_OBJECT_CREATED_WITH_ID( 66 TRACE_EVENT_OBJECT_CREATED_WITH_ID(
67 TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), "TaskQueueManager", 67 TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), "TaskQueueManager",
68 this); 68 this);
69 selector_.SetTaskQueueSelectorObserver(this); 69 selector_.SetTaskQueueSelectorObserver(this);
70 70
71 delayed_do_work_closure_ = 71 delayed_do_work_closure_ =
72 base::Bind(&TaskQueueManager::DoWork, weak_factory_.GetWeakPtr(), true); 72 base::Bind(&TaskQueueManager::DoWork, weak_factory_.GetWeakPtr(), true);
73 immediate_do_work_closure_ = 73 immediate_do_work_closure_ =
74 base::Bind(&TaskQueueManager::DoWork, weak_factory_.GetWeakPtr(), false); 74 base::Bind(&TaskQueueManager::DoWork, weak_factory_.GetWeakPtr(), false);
75 75
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(tracked_objects::TrackedTime::Now() -
568 pending_task.time_posted); 568 pending_task.time_posted);
569 } 569 }
570 } 570 }
571 571
572 bool TaskQueueManager::RunsTasksOnCurrentThread() const { 572 bool TaskQueueManager::RunsTasksInCurrentSequence() const {
573 return delegate_->RunsTasksOnCurrentThread(); 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());
578 DCHECK_GE(work_batch_size, 1); 578 DCHECK_GE(work_batch_size, 1);
579 work_batch_size_ = work_batch_size; 579 work_batch_size_ = work_batch_size;
580 } 580 }
581 581
582 void TaskQueueManager::AddTaskObserver( 582 void TaskQueueManager::AddTaskObserver(
583 base::MessageLoop::TaskObserver* task_observer) { 583 base::MessageLoop::TaskObserver* task_observer) {
(...skipping 120 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

Powered by Google App Engine
This is Rietveld 408576698