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

Unified Diff: components/scheduler/child/lazy_now.h

Issue 1370343002: Revert of scheduler: Add a base directory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/scheduler/child/idle_helper_unittest.cc ('k') | components/scheduler/child/lazy_now.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/scheduler/child/lazy_now.h
diff --git a/components/scheduler/child/lazy_now.h b/components/scheduler/child/lazy_now.h
new file mode 100644
index 0000000000000000000000000000000000000000..d8194d44ef37b4828b13868b7f1b01470b497b10
--- /dev/null
+++ b/components/scheduler/child/lazy_now.h
@@ -0,0 +1,37 @@
+// 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.
+
+#ifndef COMPONENTS_SCHEDULER_CHILD_LAZY_NOW_H_
+#define COMPONENTS_SCHEDULER_CHILD_LAZY_NOW_H_
+
+#include "base/time/time.h"
+
+namespace scheduler {
+class TaskQueueManager;
+
+namespace internal {
+
+// Now() is somewhat expensive so it makes sense not to call Now() unless we
+// really need to.
+class LazyNow {
+ public:
+ explicit LazyNow(base::TimeTicks now)
+ : task_queue_manager_(nullptr), now_(now) {
+ DCHECK(!now.is_null());
+ }
+
+ explicit LazyNow(TaskQueueManager* task_queue_manager)
+ : task_queue_manager_(task_queue_manager) {}
+
+ base::TimeTicks Now();
+
+ private:
+ TaskQueueManager* task_queue_manager_; // NOT OWNED
+ base::TimeTicks now_;
+};
+
+} // namespace internal
+} // namespace scheduler
+
+#endif // COMPONENTS_SCHEDULER_CHILD_LAZY_NOW_H_
« no previous file with comments | « components/scheduler/child/idle_helper_unittest.cc ('k') | components/scheduler/child/lazy_now.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698