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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 // TODO(simonhong): Once we have commitless update, we can get rid of | 383 // TODO(simonhong): Once we have commitless update, we can get rid of |
384 // BeginMainFrameToCommitDurationEstimate() + | 384 // BeginMainFrameToCommitDurationEstimate() + |
385 // CommitToActivateDurationEstimate(). | 385 // CommitToActivateDurationEstimate(). |
386 adjusted_args_for_children.deadline -= | 386 adjusted_args_for_children.deadline -= |
387 (client_->BeginMainFrameToCommitDurationEstimate() + | 387 (client_->BeginMainFrameToCommitDurationEstimate() + |
388 client_->CommitToActivateDurationEstimate() + | 388 client_->CommitToActivateDurationEstimate() + |
389 client_->DrawDurationEstimate() + EstimatedParentDrawTime()); | 389 client_->DrawDurationEstimate() + EstimatedParentDrawTime()); |
390 client_->SendBeginFramesToChildren(adjusted_args_for_children); | 390 client_->SendBeginFramesToChildren(adjusted_args_for_children); |
391 } | 391 } |
392 | 392 |
| 393 BeginFrameArgs adjusted_args(args); |
| 394 adjusted_args.deadline -= EstimatedParentDrawTime(); |
| 395 |
393 // We have just called SetNeedsBeginFrame(true) and the BeginFrameSource has | 396 // We have just called SetNeedsBeginFrame(true) and the BeginFrameSource has |
394 // sent us the last BeginFrame we have missed. As we might not be able to | 397 // sent us the last BeginFrame we have missed. As we might not be able to |
395 // actually make rendering for this call, handle it like a "retro frame". | 398 // actually make rendering for this call, handle it like a "retro frame". |
396 // TODO(brainderson): Add a test for this functionality ASAP! | 399 // TODO(brainderson): Add a test for this functionality ASAP! |
397 if (args.type == BeginFrameArgs::MISSED) { | 400 if (adjusted_args.type == BeginFrameArgs::MISSED) { |
398 begin_retro_frame_args_.push_back(args); | 401 begin_retro_frame_args_.push_back(adjusted_args); |
399 PostBeginRetroFrameIfNeeded(); | 402 PostBeginRetroFrameIfNeeded(); |
400 return true; | 403 return true; |
401 } | 404 } |
402 | 405 |
403 BeginFrameArgs adjusted_args(args); | |
404 adjusted_args.deadline -= EstimatedParentDrawTime(); | |
405 | |
406 bool should_defer_begin_frame; | 406 bool should_defer_begin_frame; |
407 if (settings_.using_synchronous_renderer_compositor) { | 407 if (settings_.using_synchronous_renderer_compositor) { |
408 should_defer_begin_frame = false; | 408 should_defer_begin_frame = false; |
409 } else { | 409 } else { |
410 should_defer_begin_frame = | 410 should_defer_begin_frame = |
411 !begin_retro_frame_args_.empty() || | 411 !begin_retro_frame_args_.empty() || |
412 !begin_retro_frame_task_.IsCancelled() || | 412 !begin_retro_frame_task_.IsCancelled() || |
413 !frame_source_->NeedsBeginFrames() || | 413 !frame_source_->NeedsBeginFrames() || |
414 (state_machine_.begin_impl_frame_state() != | 414 (state_machine_.begin_impl_frame_state() != |
415 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); | 415 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 } | 888 } |
889 | 889 |
890 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 890 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
891 return (state_machine_.commit_state() == | 891 return (state_machine_.commit_state() == |
892 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 892 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || |
893 state_machine_.commit_state() == | 893 state_machine_.commit_state() == |
894 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); | 894 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); |
895 } | 895 } |
896 | 896 |
897 } // namespace cc | 897 } // namespace cc |
OLD | NEW |