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

Unified Diff: components/scheduler/base/virtual_time_domain.cc

Issue 1468443002: Reduce the number of delayed tasks on chromium run loop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Weak pointer Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/scheduler/base/virtual_time_domain.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/scheduler/base/virtual_time_domain.cc
diff --git a/components/scheduler/base/virtual_time_domain.cc b/components/scheduler/base/virtual_time_domain.cc
index fdd997cfd8be19eccf4a0d9f53779be519a0e0c0..32510394fda1f744ccc79657b91210757fecb1e4 100644
--- a/components/scheduler/base/virtual_time_domain.cc
+++ b/components/scheduler/base/virtual_time_domain.cc
@@ -15,13 +15,22 @@ VirtualTimeDomain::VirtualTimeDomain(base::TimeTicks initial_time)
VirtualTimeDomain::~VirtualTimeDomain() {}
+void VirtualTimeDomain::OnRegisterWithTaskQueueManager(
+ TaskQueueManagerDelegate* task_queue_manager_delegate,
+ base::Closure do_work_closure) {
+ task_queue_manager_delegate_ = task_queue_manager_delegate;
+ do_work_closure_ = do_work_closure;
+ DCHECK(task_queue_manager_delegate_);
+}
+
LazyNow VirtualTimeDomain::CreateLazyNow() {
base::AutoLock lock(lock_);
return LazyNow(now_);
}
-void VirtualTimeDomain::RequestWakeup(base::TimeDelta delay) {
- // We don't need to do anything here because AdvanceTo triggers delayed tasks.
+void VirtualTimeDomain::RequestWakeup(LazyNow* lazy_now,
+ base::TimeDelta delay) {
+ // We don't need to do anything here because AdvanceTo posts a DoWork.
}
bool VirtualTimeDomain::MaybeAdvanceTime() {
@@ -35,8 +44,7 @@ void VirtualTimeDomain::AdvanceTo(base::TimeTicks now) {
base::AutoLock lock(lock_);
DCHECK_GE(now, now_);
now_ = now;
- LazyNow lazy_now(now_);
- WakeupReadyDelayedQueues(&lazy_now);
+ task_queue_manager_delegate_->PostTask(FROM_HERE, do_work_closure_);
}
const char* VirtualTimeDomain::GetName() const {
« no previous file with comments | « components/scheduler/base/virtual_time_domain.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698