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. | 343 // TODO(brianderson): Adjust deadline in the DisplayScheduler. |
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); | 344 BeginFrameArgs adjusted_args(args); |
358 adjusted_args.deadline -= EstimatedParentDrawTime(); | 345 adjusted_args.deadline -= EstimatedParentDrawTime(); |
359 | 346 |
| 347 // Deliver BeginFrames to children. |
| 348 // TODO(brianderson): Move this responsibility to the DisplayScheduler. |
| 349 if (state_machine_.children_need_begin_frames()) |
| 350 client_->SendBeginFramesToChildren(adjusted_args); |
| 351 |
360 if (settings_.using_synchronous_renderer_compositor) { | 352 if (settings_.using_synchronous_renderer_compositor) { |
361 BeginImplFrameSynchronous(adjusted_args); | 353 BeginImplFrameSynchronous(adjusted_args); |
362 return true; | 354 return true; |
363 } | 355 } |
364 | 356 |
365 // We have just called SetNeedsBeginFrame(true) and the BeginFrameSource has | 357 // 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 | 358 // 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". | 359 // actually make rendering for this call, handle it like a "retro frame". |
368 // TODO(brainderson): Add a test for this functionality ASAP! | 360 // TODO(brainderson): Add a test for this functionality ASAP! |
369 if (adjusted_args.type == BeginFrameArgs::MISSED) { | 361 if (adjusted_args.type == BeginFrameArgs::MISSED) { |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 } | 823 } |
832 | 824 |
833 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 825 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
834 return (state_machine_.commit_state() == | 826 return (state_machine_.commit_state() == |
835 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 827 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || |
836 state_machine_.commit_state() == | 828 state_machine_.commit_state() == |
837 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); | 829 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); |
838 } | 830 } |
839 | 831 |
840 } // namespace cc | 832 } // namespace cc |
OLD | NEW |