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

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

Issue 328603002: Moving deadline adjustment from SyntheticBeginFrameSource into BeginFrameArgs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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/scheduler.h" 5 #include "cc/scheduler/scheduler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include "base/auto_reset.h" 8 #include "base/auto_reset.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 void Scheduler::SyntheticBeginFrameSource::OnTimerTick() { 58 void Scheduler::SyntheticBeginFrameSource::OnTimerTick() {
59 BeginFrameArgs begin_frame_args( 59 BeginFrameArgs begin_frame_args(
60 CreateSyntheticBeginFrameArgs(time_source_->LastTickTime())); 60 CreateSyntheticBeginFrameArgs(time_source_->LastTickTime()));
61 scheduler_->BeginFrame(begin_frame_args); 61 scheduler_->BeginFrame(begin_frame_args);
62 } 62 }
63 63
64 BeginFrameArgs 64 BeginFrameArgs
65 Scheduler::SyntheticBeginFrameSource::CreateSyntheticBeginFrameArgs( 65 Scheduler::SyntheticBeginFrameSource::CreateSyntheticBeginFrameArgs(
66 base::TimeTicks frame_time) { 66 base::TimeTicks frame_time) {
67 base::TimeTicks deadline = 67 base::TimeTicks deadline = time_source_->NextTickTime();
68 time_source_->NextTickTime() - scheduler_->EstimatedParentDrawTime();
69 return BeginFrameArgs::Create( 68 return BeginFrameArgs::Create(
70 frame_time, deadline, scheduler_->VSyncInterval()); 69 frame_time, deadline, scheduler_->VSyncInterval());
71 } 70 }
72 71
73 Scheduler::Scheduler( 72 Scheduler::Scheduler(
74 SchedulerClient* client, 73 SchedulerClient* client,
75 const SchedulerSettings& scheduler_settings, 74 const SchedulerSettings& scheduler_settings,
76 int layer_tree_host_id, 75 int layer_tree_host_id,
77 const scoped_refptr<base::SingleThreadTaskRunner>& impl_task_runner) 76 const scoped_refptr<base::SingleThreadTaskRunner>& impl_task_runner)
78 : settings_(scheduler_settings), 77 : settings_(scheduler_settings),
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 } 390 }
392 391
393 // BeginFrame is the mechanism that tells us that now is a good time to start 392 // BeginFrame is the mechanism that tells us that now is a good time to start
394 // making a frame. Usually this means that user input for the frame is complete. 393 // making a frame. Usually this means that user input for the frame is complete.
395 // If the scheduler is busy, we queue the BeginFrame to be handled later as 394 // If the scheduler is busy, we queue the BeginFrame to be handled later as
396 // a BeginRetroFrame. 395 // a BeginRetroFrame.
397 void Scheduler::BeginFrame(const BeginFrameArgs& args) { 396 void Scheduler::BeginFrame(const BeginFrameArgs& args) {
398 TRACE_EVENT1("cc", "Scheduler::BeginFrame", "args", ToTrace(args)); 397 TRACE_EVENT1("cc", "Scheduler::BeginFrame", "args", ToTrace(args));
399 DCHECK(settings_.throttle_frame_production); 398 DCHECK(settings_.throttle_frame_production);
400 399
400 BeginFrameArgs adjusted_args(args);
401 adjusted_args.deadline -= EstimatedParentDrawTime();
brianderson 2014/06/10 18:24:23 I had some reservations about putting the adjustme
402
401 bool should_defer_begin_frame; 403 bool should_defer_begin_frame;
402 if (settings_.using_synchronous_renderer_compositor) { 404 if (settings_.using_synchronous_renderer_compositor) {
403 should_defer_begin_frame = false; 405 should_defer_begin_frame = false;
404 } else { 406 } else {
405 should_defer_begin_frame = 407 should_defer_begin_frame =
406 !begin_retro_frame_args_.empty() || begin_retro_frame_posted_ || 408 !begin_retro_frame_args_.empty() || begin_retro_frame_posted_ ||
407 !last_set_needs_begin_frame_ || 409 !last_set_needs_begin_frame_ ||
408 (state_machine_.begin_impl_frame_state() != 410 (state_machine_.begin_impl_frame_state() !=
409 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); 411 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE);
410 } 412 }
411 413
412 if (should_defer_begin_frame) { 414 if (should_defer_begin_frame) {
413 begin_retro_frame_args_.push_back(args); 415 begin_retro_frame_args_.push_back(adjusted_args);
414 TRACE_EVENT_INSTANT0( 416 TRACE_EVENT_INSTANT0(
415 "cc", "Scheduler::BeginFrame deferred", TRACE_EVENT_SCOPE_THREAD); 417 "cc", "Scheduler::BeginFrame deferred", TRACE_EVENT_SCOPE_THREAD);
416 return; 418 return;
417 } 419 }
418 420
419 BeginImplFrame(args); 421 BeginImplFrame(adjusted_args);
420 } 422 }
421 423
422 // BeginRetroFrame is called for BeginFrames that we've deferred because 424 // BeginRetroFrame is called for BeginFrames that we've deferred because
423 // the scheduler was in the middle of processing a previous BeginFrame. 425 // the scheduler was in the middle of processing a previous BeginFrame.
424 void Scheduler::BeginRetroFrame() { 426 void Scheduler::BeginRetroFrame() {
425 TRACE_EVENT0("cc", "Scheduler::BeginRetroFrame"); 427 TRACE_EVENT0("cc", "Scheduler::BeginRetroFrame");
426 DCHECK(!settings_.using_synchronous_renderer_compositor); 428 DCHECK(!settings_.using_synchronous_renderer_compositor);
427 DCHECK(begin_retro_frame_posted_); 429 DCHECK(begin_retro_frame_posted_);
428 begin_retro_frame_posted_ = false; 430 begin_retro_frame_posted_ = false;
429 431
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 } 739 }
738 740
739 bool Scheduler::IsBeginMainFrameSentOrStarted() const { 741 bool Scheduler::IsBeginMainFrameSentOrStarted() const {
740 return (state_machine_.commit_state() == 742 return (state_machine_.commit_state() ==
741 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || 743 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT ||
742 state_machine_.commit_state() == 744 state_machine_.commit_state() ==
743 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); 745 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED);
744 } 746 }
745 747
746 } // namespace cc 748 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698