Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 333 } | 333 } |
| 334 } | 334 } |
| 335 | 335 |
| 336 // BeginFrame is the mechanism that tells us that now is a good time to start | 336 // BeginFrame is the mechanism that tells us that now is a good time to start |
| 337 // making a frame. Usually this means that user input for the frame is complete. | 337 // making a frame. Usually this means that user input for the frame is complete. |
| 338 // If the scheduler is busy, we queue the BeginFrame to be handled later as | 338 // If the scheduler is busy, we queue the BeginFrame to be handled later as |
| 339 // a BeginRetroFrame. | 339 // a BeginRetroFrame. |
| 340 bool Scheduler::OnBeginFrameMixInDelegate(const BeginFrameArgs& args) { | 340 bool Scheduler::OnBeginFrameMixInDelegate(const BeginFrameArgs& args) { |
| 341 TRACE_EVENT1("cc,benchmark", "Scheduler::BeginFrame", "args", args.AsValue()); | 341 TRACE_EVENT1("cc,benchmark", "Scheduler::BeginFrame", "args", args.AsValue()); |
| 342 | 342 |
| 343 // Deliver BeginFrames to children. | |
| 344 if (state_machine_.children_need_begin_frames()) { | |
| 345 BeginFrameArgs adjusted_args_for_children(args); | |
| 346 // Adjust a deadline for child schedulers. | |
| 347 // TODO(simonhong): Once we have commitless update, we can get rid of | |
| 348 // BeginMainFrameToCommitDurationEstimate() + | |
| 349 // CommitToActivateDurationEstimate(). | |
| 350 adjusted_args_for_children.deadline -= | |
| 351 (client_->BeginMainFrameToCommitDurationEstimate() + | |
| 352 client_->CommitToActivateDurationEstimate() + | |
| 353 client_->DrawDurationEstimate() + EstimatedParentDrawTime()); | |
| 354 client_->SendBeginFramesToChildren(adjusted_args_for_children); | |
| 355 } | |
| 356 | |
| 357 BeginFrameArgs adjusted_args(args); | 343 BeginFrameArgs adjusted_args(args); |
| 358 adjusted_args.deadline -= EstimatedParentDrawTime(); | 344 adjusted_args.deadline -= EstimatedParentDrawTime(); |
| 359 | 345 |
| 346 // Deliver BeginFrames to children. | |
| 347 if (state_machine_.children_need_begin_frames()) | |
| 348 client_->SendBeginFramesToChildren(adjusted_args); | |
|
sunnyps
2015/05/05 01:00:41
Can you add a TODO get rid of this deadline adjust
brianderson
2015/05/05 01:53:29
Done.
| |
| 349 | |
| 360 if (settings_.using_synchronous_renderer_compositor) { | 350 if (settings_.using_synchronous_renderer_compositor) { |
| 361 BeginImplFrameSynchronous(adjusted_args); | 351 BeginImplFrameSynchronous(adjusted_args); |
| 362 return true; | 352 return true; |
| 363 } | 353 } |
| 364 | 354 |
| 365 // We have just called SetNeedsBeginFrame(true) and the BeginFrameSource has | 355 // We have just called SetNeedsBeginFrame(true) and the BeginFrameSource has |
| 366 // sent us the last BeginFrame we have missed. As we might not be able to | 356 // sent us the last BeginFrame we have missed. As we might not be able to |
| 367 // actually make rendering for this call, handle it like a "retro frame". | 357 // actually make rendering for this call, handle it like a "retro frame". |
| 368 // TODO(brainderson): Add a test for this functionality ASAP! | 358 // TODO(brainderson): Add a test for this functionality ASAP! |
| 369 if (adjusted_args.type == BeginFrameArgs::MISSED) { | 359 if (adjusted_args.type == BeginFrameArgs::MISSED) { |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 831 } | 821 } |
| 832 | 822 |
| 833 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 823 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
| 834 return (state_machine_.commit_state() == | 824 return (state_machine_.commit_state() == |
| 835 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 825 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || |
| 836 state_machine_.commit_state() == | 826 state_machine_.commit_state() == |
| 837 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); | 827 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); |
| 838 } | 828 } |
| 839 | 829 |
| 840 } // namespace cc | 830 } // namespace cc |
| OLD | NEW |