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

Side by Side Diff: components/scheduler/base/lazy_now.h

Issue 2118903002: scheduler: Move the Blink scheduler into Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Really fixed the test failure this time Created 4 years, 4 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
(Empty)
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.
4
5 #ifndef COMPONENTS_SCHEDULER_BASE_LAZY_NOW_H_
6 #define COMPONENTS_SCHEDULER_BASE_LAZY_NOW_H_
7
8 #include "base/time/time.h"
9 #include "components/scheduler/scheduler_export.h"
10
11 namespace base {
12 class TickClock;
13 }
14
15 namespace scheduler {
16
17 // Now() is somewhat expensive so it makes sense not to call Now() unless we
18 // really need to.
19 class SCHEDULER_EXPORT LazyNow {
20 public:
21 explicit LazyNow(base::TimeTicks now) : tick_clock_(nullptr), now_(now) {
22 DCHECK(!now.is_null());
23 }
24
25 explicit LazyNow(base::TickClock* tick_clock) : tick_clock_(tick_clock) {}
26
27 base::TimeTicks Now();
28
29 private:
30 base::TickClock* tick_clock_; // NOT OWNED
31 base::TimeTicks now_;
32 };
33
34 } // namespace scheduler
35
36 #endif // COMPONENTS_SCHEDULER_BASE_LAZY_NOW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698