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

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

Issue 754433003: Update from https://crrev.com/305340 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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 | « cc/resources/video_resource_updater.cc ('k') | cc/scheduler/begin_frame_source_unittest.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 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/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/debug/trace_event_argument.h" 9 #include "base/debug/trace_event_argument.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 weak_factory_.GetWeakPtr())); 174 weak_factory_.GetWeakPtr()));
175 } 175 }
176 176
177 void BackToBackBeginFrameSource::BeginFrame() { 177 void BackToBackBeginFrameSource::BeginFrame() {
178 send_begin_frame_posted_ = false; 178 send_begin_frame_posted_ = false;
179 179
180 if (!needs_begin_frames_) 180 if (!needs_begin_frames_)
181 return; 181 return;
182 182
183 base::TimeTicks now = Now(); 183 base::TimeTicks now = Now();
184 BeginFrameArgs args = 184 BeginFrameArgs args = BeginFrameArgs::Create(
185 BeginFrameArgs::Create(now, 185 now, now + BeginFrameArgs::DefaultInterval(),
186 now + BeginFrameArgs::DefaultInterval(), 186 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL);
187 BeginFrameArgs::DefaultInterval());
188 CallOnBeginFrame(args); 187 CallOnBeginFrame(args);
189 } 188 }
190 189
191 // BeginFrameSource support 190 // BeginFrameSource support
192 191
193 void BackToBackBeginFrameSource::DidFinishFrame(size_t remaining_frames) { 192 void BackToBackBeginFrameSource::DidFinishFrame(size_t remaining_frames) {
194 if (remaining_frames == 0) { 193 if (remaining_frames == 0) {
195 OnNeedsBeginFramesChange(NeedsBeginFrames()); 194 OnNeedsBeginFramesChange(NeedsBeginFrames());
196 } 195 }
197 } 196 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 void SyntheticBeginFrameSource::OnUpdateVSyncParameters( 235 void SyntheticBeginFrameSource::OnUpdateVSyncParameters(
237 base::TimeTicks new_vsync_timebase, 236 base::TimeTicks new_vsync_timebase,
238 base::TimeDelta new_vsync_interval) { 237 base::TimeDelta new_vsync_interval) {
239 time_source_->SetTimebaseAndInterval(new_vsync_timebase, new_vsync_interval); 238 time_source_->SetTimebaseAndInterval(new_vsync_timebase, new_vsync_interval);
240 } 239 }
241 240
242 BeginFrameArgs SyntheticBeginFrameSource::CreateBeginFrameArgs( 241 BeginFrameArgs SyntheticBeginFrameSource::CreateBeginFrameArgs(
243 base::TimeTicks frame_time, 242 base::TimeTicks frame_time,
244 BeginFrameArgs::BeginFrameArgsType type) { 243 BeginFrameArgs::BeginFrameArgsType type) {
245 base::TimeTicks deadline = time_source_->NextTickTime(); 244 base::TimeTicks deadline = time_source_->NextTickTime();
246 return BeginFrameArgs::CreateTyped( 245 return BeginFrameArgs::Create(frame_time, deadline, time_source_->Interval(),
247 frame_time, deadline, time_source_->Interval(), type); 246 type);
248 } 247 }
249 248
250 // TimeSourceClient support 249 // TimeSourceClient support
251 void SyntheticBeginFrameSource::OnTimerTick() { 250 void SyntheticBeginFrameSource::OnTimerTick() {
252 CallOnBeginFrame(CreateBeginFrameArgs(time_source_->LastTickTime(), 251 CallOnBeginFrame(CreateBeginFrameArgs(time_source_->LastTickTime(),
253 BeginFrameArgs::NORMAL)); 252 BeginFrameArgs::NORMAL));
254 } 253 }
255 254
256 // BeginFrameSourceMixIn support 255 // BeginFrameSourceMixIn support
257 void SyntheticBeginFrameSource::OnNeedsBeginFramesChange( 256 void SyntheticBeginFrameSource::OnNeedsBeginFramesChange(
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 if (!observer_->LastUsedBeginFrameArgs().IsValid()) 482 if (!observer_->LastUsedBeginFrameArgs().IsValid())
484 return true; 483 return true;
485 484
486 // Only allow new args have a *strictly bigger* frame_time value and statisfy 485 // Only allow new args have a *strictly bigger* frame_time value and statisfy
487 // minimum interval requirement. 486 // minimum interval requirement.
488 return (args.frame_time >= 487 return (args.frame_time >=
489 observer_->LastUsedBeginFrameArgs().frame_time + minimum_interval_); 488 observer_->LastUsedBeginFrameArgs().frame_time + minimum_interval_);
490 } 489 }
491 490
492 } // namespace cc 491 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/video_resource_updater.cc ('k') | cc/scheduler/begin_frame_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698