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

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

Issue 1432263002: (reland) Adds TimeDomains to the TaskQueueManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix thread_hop_task DCHECK 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') | components/scheduler/child/idle_helper.cc » ('j') | 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
new file mode 100644
index 0000000000000000000000000000000000000000..fdd997cfd8be19eccf4a0d9f53779be519a0e0c0
--- /dev/null
+++ b/components/scheduler/base/virtual_time_domain.cc
@@ -0,0 +1,46 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/scheduler/base/virtual_time_domain.h"
+
+#include "base/bind.h"
+#include "components/scheduler/base/task_queue_impl.h"
+#include "components/scheduler/base/task_queue_manager_delegate.h"
+
+namespace scheduler {
+
+VirtualTimeDomain::VirtualTimeDomain(base::TimeTicks initial_time)
+ : now_(initial_time) {}
+
+VirtualTimeDomain::~VirtualTimeDomain() {}
+
+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.
+}
+
+bool VirtualTimeDomain::MaybeAdvanceTime() {
+ return false;
+}
+
+void VirtualTimeDomain::AsValueIntoInternal(
+ base::trace_event::TracedValue* state) const {}
+
+void VirtualTimeDomain::AdvanceTo(base::TimeTicks now) {
+ base::AutoLock lock(lock_);
+ DCHECK_GE(now, now_);
+ now_ = now;
+ LazyNow lazy_now(now_);
+ WakeupReadyDelayedQueues(&lazy_now);
+}
+
+const char* VirtualTimeDomain::GetName() const {
+ return "VirtualTimeDomain";
+}
+
+} // namespace scheduler
« no previous file with comments | « components/scheduler/base/virtual_time_domain.h ('k') | components/scheduler/child/idle_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698