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

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

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 unified diff | Download patch
« no previous file with comments | « components/scheduler/BUILD.gn ('k') | components/scheduler/base/lazy_now.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_SCHEDULER_BASE_LAZY_NOW_H_ 5 #ifndef COMPONENTS_SCHEDULER_BASE_LAZY_NOW_H_
6 #define COMPONENTS_SCHEDULER_BASE_LAZY_NOW_H_ 6 #define COMPONENTS_SCHEDULER_BASE_LAZY_NOW_H_
7 7
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 9
10 namespace base { 10 namespace base {
11 class TickClock; 11 class TickClock;
12 } 12 }
13 13
14 namespace scheduler { 14 namespace scheduler {
15 namespace internal {
16 15
17 // Now() is somewhat expensive so it makes sense not to call Now() unless we 16 // Now() is somewhat expensive so it makes sense not to call Now() unless we
18 // really need to. 17 // really need to.
19 class LazyNow { 18 class LazyNow {
20 public: 19 public:
21 explicit LazyNow(base::TimeTicks now) : tick_clock_(nullptr), now_(now) { 20 explicit LazyNow(base::TimeTicks now) : tick_clock_(nullptr), now_(now) {
22 DCHECK(!now.is_null()); 21 DCHECK(!now.is_null());
23 } 22 }
24 23
25 explicit LazyNow(base::TickClock* tick_clock) : tick_clock_(tick_clock) {} 24 explicit LazyNow(base::TickClock* tick_clock) : tick_clock_(tick_clock) {}
26 25
27 base::TimeTicks Now(); 26 base::TimeTicks Now();
28 27
29 private: 28 private:
30 base::TickClock* tick_clock_; // NOT OWNED 29 base::TickClock* tick_clock_; // NOT OWNED
31 base::TimeTicks now_; 30 base::TimeTicks now_;
32 }; 31 };
33 32
34 } // namespace internal
35 } // namespace scheduler 33 } // namespace scheduler
36 34
37 #endif // COMPONENTS_SCHEDULER_BASE_LAZY_NOW_H_ 35 #endif // COMPONENTS_SCHEDULER_BASE_LAZY_NOW_H_
OLDNEW
« no previous file with comments | « components/scheduler/BUILD.gn ('k') | components/scheduler/base/lazy_now.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698