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

Side by Side Diff: cc/scheduler/delay_based_time_source.cc

Issue 1146283005: Remove DelayBasedTimeSourceHighRes Class altogether (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « cc/scheduler/delay_based_time_source.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 #include "cc/scheduler/delay_based_time_source.h" 5 #include "cc/scheduler/delay_based_time_source.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 10
(...skipping 19 matching lines...) Expand all
30 // within the thresholds, the change will take place on the next tick. If 30 // within the thresholds, the change will take place on the next tick. If
31 // either change is outside the thresholds, the next tick will be canceled and 31 // either change is outside the thresholds, the next tick will be canceled and
32 // reissued immediately. 32 // reissued immediately.
33 static const double kIntervalChangeThreshold = 0.25; 33 static const double kIntervalChangeThreshold = 0.25;
34 static const double kPhaseChangeThreshold = 0.25; 34 static const double kPhaseChangeThreshold = 0.25;
35 35
36 } // namespace 36 } // namespace
37 37
38 // The following methods correspond to the DelayBasedTimeSource that uses 38 // The following methods correspond to the DelayBasedTimeSource that uses
39 // the base::TimeTicks::Now as the timebase. 39 // the base::TimeTicks::Now as the timebase.
40 scoped_refptr<DelayBasedTimeSourceHighRes> DelayBasedTimeSourceHighRes::Create(
41 base::TimeDelta interval,
42 base::SingleThreadTaskRunner* task_runner) {
43 return make_scoped_refptr(
44 new DelayBasedTimeSourceHighRes(interval, task_runner));
45 }
46
47 DelayBasedTimeSourceHighRes::DelayBasedTimeSourceHighRes(
48 base::TimeDelta interval,
49 base::SingleThreadTaskRunner* task_runner)
50 : DelayBasedTimeSource(interval, task_runner) {
51 }
52
53 DelayBasedTimeSourceHighRes::~DelayBasedTimeSourceHighRes() {}
54
55 base::TimeTicks DelayBasedTimeSourceHighRes::Now() const {
56 return base::TimeTicks::Now();
57 }
58
59 // The following methods correspond to the DelayBasedTimeSource that uses
60 // the base::TimeTicks::Now as the timebase.
61 scoped_refptr<DelayBasedTimeSource> DelayBasedTimeSource::Create( 40 scoped_refptr<DelayBasedTimeSource> DelayBasedTimeSource::Create(
62 base::TimeDelta interval, 41 base::TimeDelta interval,
63 base::SingleThreadTaskRunner* task_runner) { 42 base::SingleThreadTaskRunner* task_runner) {
64 return make_scoped_refptr(new DelayBasedTimeSource(interval, task_runner)); 43 return make_scoped_refptr(new DelayBasedTimeSource(interval, task_runner));
65 } 44 }
66 45
67 DelayBasedTimeSource::DelayBasedTimeSource( 46 DelayBasedTimeSource::DelayBasedTimeSource(
68 base::TimeDelta interval, 47 base::TimeDelta interval,
69 base::SingleThreadTaskRunner* task_runner) 48 base::SingleThreadTaskRunner* task_runner)
70 : client_(NULL), 49 : client_(NULL),
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 delay); 244 delay);
266 245
267 next_parameters_.tick_target = new_tick_target; 246 next_parameters_.tick_target = new_tick_target;
268 current_parameters_ = next_parameters_; 247 current_parameters_ = next_parameters_;
269 } 248 }
270 249
271 std::string DelayBasedTimeSource::TypeString() const { 250 std::string DelayBasedTimeSource::TypeString() const {
272 return "DelayBasedTimeSource"; 251 return "DelayBasedTimeSource";
273 } 252 }
274 253
275 std::string DelayBasedTimeSourceHighRes::TypeString() const {
276 return "DelayBasedTimeSourceHighRes";
277 }
278
279 void DelayBasedTimeSource::AsValueInto( 254 void DelayBasedTimeSource::AsValueInto(
280 base::trace_event::TracedValue* state) const { 255 base::trace_event::TracedValue* state) const {
281 state->SetString("type", TypeString()); 256 state->SetString("type", TypeString());
282 state->SetDouble("last_tick_time_us", LastTickTime().ToInternalValue()); 257 state->SetDouble("last_tick_time_us", LastTickTime().ToInternalValue());
283 state->SetDouble("next_tick_time_us", NextTickTime().ToInternalValue()); 258 state->SetDouble("next_tick_time_us", NextTickTime().ToInternalValue());
284 259
285 state->BeginDictionary("current_parameters"); 260 state->BeginDictionary("current_parameters");
286 state->SetDouble("interval_us", 261 state->SetDouble("interval_us",
287 current_parameters_.interval.InMicroseconds()); 262 current_parameters_.interval.InMicroseconds());
288 state->SetDouble("tick_target_us", 263 state->SetDouble("tick_target_us",
289 current_parameters_.tick_target.ToInternalValue()); 264 current_parameters_.tick_target.ToInternalValue());
290 state->EndDictionary(); 265 state->EndDictionary();
291 266
292 state->BeginDictionary("next_parameters"); 267 state->BeginDictionary("next_parameters");
293 state->SetDouble("interval_us", next_parameters_.interval.InMicroseconds()); 268 state->SetDouble("interval_us", next_parameters_.interval.InMicroseconds());
294 state->SetDouble("tick_target_us", 269 state->SetDouble("tick_target_us",
295 next_parameters_.tick_target.ToInternalValue()); 270 next_parameters_.tick_target.ToInternalValue());
296 state->EndDictionary(); 271 state->EndDictionary();
297 272
298 state->SetBoolean("active", active_); 273 state->SetBoolean("active", active_);
299 } 274 }
300 275
301 } // namespace cc 276 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/delay_based_time_source.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698