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

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

Issue 27710005: cc: Use HighResNow as timebase if it is fast and reliable (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add missing include Created 7 years, 2 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.cc ('k') | cc/scheduler/scheduler.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 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/frame_rate_controller.h" 5 #include "cc/scheduler/frame_rate_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/single_thread_task_runner.h" 11 #include "base/single_thread_task_runner.h"
12 #include "cc/scheduler/delay_based_time_source.h" 12 #include "cc/scheduler/delay_based_time_source.h"
13 #include "cc/scheduler/time_source.h" 13 #include "cc/scheduler/time_source.h"
14 #include "ui/gfx/frame_time.h"
14 15
15 namespace cc { 16 namespace cc {
16 17
17 class FrameRateControllerTimeSourceAdapter : public TimeSourceClient { 18 class FrameRateControllerTimeSourceAdapter : public TimeSourceClient {
18 public: 19 public:
19 static scoped_ptr<FrameRateControllerTimeSourceAdapter> Create( 20 static scoped_ptr<FrameRateControllerTimeSourceAdapter> Create(
20 FrameRateController* frame_rate_controller) { 21 FrameRateController* frame_rate_controller) {
21 return make_scoped_ptr( 22 return make_scoped_ptr(
22 new FrameRateControllerTimeSourceAdapter(frame_rate_controller)); 23 new FrameRateControllerTimeSourceAdapter(frame_rate_controller));
23 } 24 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 return BeginFrameArgs(); 90 return BeginFrameArgs();
90 } 91 }
91 92
92 void FrameRateController::SetMaxSwapsPending(int max_swaps_pending) { 93 void FrameRateController::SetMaxSwapsPending(int max_swaps_pending) {
93 DCHECK_GE(max_swaps_pending, 0); 94 DCHECK_GE(max_swaps_pending, 0);
94 max_swaps_pending_ = max_swaps_pending; 95 max_swaps_pending_ = max_swaps_pending;
95 } 96 }
96 97
97 void FrameRateController::SetTimebaseAndInterval(base::TimeTicks timebase, 98 void FrameRateController::SetTimebaseAndInterval(base::TimeTicks timebase,
98 base::TimeDelta interval) { 99 base::TimeDelta interval) {
100 if (!gfx::FrameTime::TimestampsAreHighRes())
101 timebase = base::TimeTicks();
piman 2013/10/23 00:03:45 mmh, aren't we losing functionality here? Should w
brianderson 2013/10/23 13:04:43 The problem is that the DWM API's on Windows only
piman 2013/10/23 23:45:08 If 0 is ok, then can we make the producer of the t
brianderson 2013/10/24 11:26:52 Sounds good. I will change the patch.
102
99 interval_ = interval; 103 interval_ = interval;
100 if (is_time_source_throttling_) 104 if (is_time_source_throttling_)
101 time_source_->SetTimebaseAndInterval(timebase, interval); 105 time_source_->SetTimebaseAndInterval(timebase, interval);
102 } 106 }
103 107
104 void FrameRateController::SetDeadlineAdjustment(base::TimeDelta delta) { 108 void FrameRateController::SetDeadlineAdjustment(base::TimeDelta delta) {
105 deadline_adjustment_ = delta; 109 deadline_adjustment_ = delta;
106 } 110 }
107 111
108 void FrameRateController::OnTimerTick() { 112 void FrameRateController::OnTimerTick() {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 if (is_time_source_throttling_) 162 if (is_time_source_throttling_)
159 return time_source_->NextTickTime(); 163 return time_source_->NextTickTime();
160 164
161 return base::TimeTicks(); 165 return base::TimeTicks();
162 } 166 }
163 167
164 base::TimeTicks FrameRateController::LastTickTime() { 168 base::TimeTicks FrameRateController::LastTickTime() {
165 if (is_time_source_throttling_) 169 if (is_time_source_throttling_)
166 return time_source_->LastTickTime(); 170 return time_source_->LastTickTime();
167 171
168 return base::TimeTicks::Now(); 172 return gfx::FrameTime::Now();
169 } 173 }
170 174
171 } // namespace cc 175 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/delay_based_time_source.cc ('k') | cc/scheduler/scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698