Roll src/third_party/WebKit 605a979:06cb9e9 (svn 202556:202558)
[chromium-blink-merge.git] / components / scheduler / child / lazy_now.h
blobd8194d44ef37b4828b13868b7f1b01470b497b10
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_SCHEDULER_CHILD_LAZY_NOW_H_
6 #define COMPONENTS_SCHEDULER_CHILD_LAZY_NOW_H_
8 #include "base/time/time.h"
10 namespace scheduler {
11 class TaskQueueManager;
13 namespace internal {
15 // Now() is somewhat expensive so it makes sense not to call Now() unless we
16 // really need to.
17 class LazyNow {
18 public:
19 explicit LazyNow(base::TimeTicks now)
20 : task_queue_manager_(nullptr), now_(now) {
21 DCHECK(!now.is_null());
24 explicit LazyNow(TaskQueueManager* task_queue_manager)
25 : task_queue_manager_(task_queue_manager) {}
27 base::TimeTicks Now();
29 private:
30 TaskQueueManager* task_queue_manager_; // NOT OWNED
31 base::TimeTicks now_;
34 } // namespace internal
35 } // namespace scheduler
37 #endif // COMPONENTS_SCHEDULER_CHILD_LAZY_NOW_H_