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

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

Issue 1718233002: Fix computation of runtime for throttled tasks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo Created 4 years, 10 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
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_TIME_DOMAIN_H_ 5 #ifndef COMPONENTS_SCHEDULER_BASE_TIME_DOMAIN_H_
6 #define COMPONENTS_SCHEDULER_BASE_TIME_DOMAIN_H_ 6 #define COMPONENTS_SCHEDULER_BASE_TIME_DOMAIN_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 virtual ~TimeDomain(); 42 virtual ~TimeDomain();
43 43
44 // Returns a LazyNow that evaluate this TimeDomain's Now. Can be called from 44 // Returns a LazyNow that evaluate this TimeDomain's Now. Can be called from
45 // any thread. 45 // any thread.
46 // TODO(alexclarke): Make this main thread only. 46 // TODO(alexclarke): Make this main thread only.
47 virtual LazyNow CreateLazyNow() const = 0; 47 virtual LazyNow CreateLazyNow() const = 0;
48 48
49 // Evaluate this TimeDomain's Now. Can be called from any thread. 49 // Evaluate this TimeDomain's Now. Can be called from any thread.
50 virtual base::TimeTicks Now() const = 0; 50 virtual base::TimeTicks Now() const = 0;
51 51
52 // Computes a runtime which is >= |time_domain_now| + |delay|. This is used to
53 // allow the TimeDomain to decide if the real or virtual time should be used
54 // when computing the task run time. This can be called from any thread.
55 virtual base::TimeTicks ComputeDelayedRunTime(
56 base::TimeTicks time_domain_now,
57 base::TimeDelta delay) const = 0;
58
52 // Some TimeDomains support virtual time, this method tells us to advance time 59 // Some TimeDomains support virtual time, this method tells us to advance time
53 // if possible and return true if time was advanced. 60 // if possible and return true if time was advanced.
54 virtual bool MaybeAdvanceTime() = 0; 61 virtual bool MaybeAdvanceTime() = 0;
55 62
56 // Returns the name of this time domain for tracing. 63 // Returns the name of this time domain for tracing.
57 virtual const char* GetName() const = 0; 64 virtual const char* GetName() const = 0;
58 65
59 // If there is a scheduled delayed task, |out_time| is set to the scheduled 66 // If there is a scheduled delayed task, |out_time| is set to the scheduled
60 // runtime for the next one and it returns true. Returns false otherwise. 67 // runtime for the next one and it returns true. Returns false otherwise.
61 bool NextScheduledRunTime(base::TimeTicks* out_time) const; 68 bool NextScheduledRunTime(base::TimeTicks* out_time) const;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 Observer* observer_; // NOT OWNED. 155 Observer* observer_; // NOT OWNED.
149 156
150 base::ThreadChecker main_thread_checker_; 157 base::ThreadChecker main_thread_checker_;
151 158
152 DISALLOW_COPY_AND_ASSIGN(TimeDomain); 159 DISALLOW_COPY_AND_ASSIGN(TimeDomain);
153 }; 160 };
154 161
155 } // namespace scheduler 162 } // namespace scheduler
156 163
157 #endif // COMPONENTS_SCHEDULER_BASE_TIME_DOMAIN_H_ 164 #endif // COMPONENTS_SCHEDULER_BASE_TIME_DOMAIN_H_
OLDNEW
« no previous file with comments | « components/scheduler/base/task_queue_impl.cc ('k') | components/scheduler/base/time_domain_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698