| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/begin_frame_source.h" | 5 #include "cc/scheduler/begin_frame_source.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 BeginFrameSourceMixIn::AsValueInto(dict); | 203 BeginFrameSourceMixIn::AsValueInto(dict); |
| 204 dict->SetBoolean("send_begin_frame_posted_", send_begin_frame_posted_); | 204 dict->SetBoolean("send_begin_frame_posted_", send_begin_frame_posted_); |
| 205 } | 205 } |
| 206 | 206 |
| 207 // SyntheticBeginFrameSource --------------------------------------------- | 207 // SyntheticBeginFrameSource --------------------------------------------- |
| 208 scoped_ptr<SyntheticBeginFrameSource> SyntheticBeginFrameSource::Create( | 208 scoped_ptr<SyntheticBeginFrameSource> SyntheticBeginFrameSource::Create( |
| 209 base::SingleThreadTaskRunner* task_runner, | 209 base::SingleThreadTaskRunner* task_runner, |
| 210 base::TimeTicks initial_vsync_timebase, | 210 base::TimeTicks initial_vsync_timebase, |
| 211 base::TimeDelta initial_vsync_interval) { | 211 base::TimeDelta initial_vsync_interval) { |
| 212 scoped_refptr<DelayBasedTimeSource> time_source; | 212 scoped_refptr<DelayBasedTimeSource> time_source; |
| 213 if (base::TimeTicks::IsHighResolution()) { | 213 time_source = |
| 214 time_source = DelayBasedTimeSourceHighRes::Create(initial_vsync_interval, | 214 DelayBasedTimeSource::Create(initial_vsync_interval, task_runner); |
| 215 task_runner); | |
| 216 } else { | |
| 217 time_source = | |
| 218 DelayBasedTimeSource::Create(initial_vsync_interval, task_runner); | |
| 219 } | |
| 220 | |
| 221 return make_scoped_ptr(new SyntheticBeginFrameSource(time_source)); | 215 return make_scoped_ptr(new SyntheticBeginFrameSource(time_source)); |
| 222 } | 216 } |
| 223 | 217 |
| 224 SyntheticBeginFrameSource::SyntheticBeginFrameSource( | 218 SyntheticBeginFrameSource::SyntheticBeginFrameSource( |
| 225 scoped_refptr<DelayBasedTimeSource> time_source) | 219 scoped_refptr<DelayBasedTimeSource> time_source) |
| 226 : BeginFrameSourceMixIn(), time_source_(time_source) { | 220 : BeginFrameSourceMixIn(), time_source_(time_source) { |
| 227 time_source_->SetActive(false); | 221 time_source_->SetActive(false); |
| 228 time_source_->SetClient(this); | 222 time_source_->SetClient(this); |
| 229 } | 223 } |
| 230 | 224 |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 if (!observer_->LastUsedBeginFrameArgs().IsValid()) | 462 if (!observer_->LastUsedBeginFrameArgs().IsValid()) |
| 469 return true; | 463 return true; |
| 470 | 464 |
| 471 // Only allow new args have a *strictly bigger* frame_time value and statisfy | 465 // Only allow new args have a *strictly bigger* frame_time value and statisfy |
| 472 // minimum interval requirement. | 466 // minimum interval requirement. |
| 473 return (args.frame_time >= | 467 return (args.frame_time >= |
| 474 observer_->LastUsedBeginFrameArgs().frame_time + minimum_interval_); | 468 observer_->LastUsedBeginFrameArgs().frame_time + minimum_interval_); |
| 475 } | 469 } |
| 476 | 470 |
| 477 } // namespace cc | 471 } // namespace cc |
| OLD | NEW |