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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
373 } | 373 } |
374 | 374 |
375 // BeginFrame is the mechanism that tells us that now is a good time to start | 375 // BeginFrame is the mechanism that tells us that now is a good time to start |
376 // making a frame. Usually this means that user input for the frame is complete. | 376 // making a frame. Usually this means that user input for the frame is complete. |
377 // If the scheduler is busy, we queue the BeginFrame to be handled later as | 377 // If the scheduler is busy, we queue the BeginFrame to be handled later as |
378 // a BeginRetroFrame. | 378 // a BeginRetroFrame. |
379 bool Scheduler::OnBeginFrameMixInDelegate(const BeginFrameArgs& args) { | 379 bool Scheduler::OnBeginFrameMixInDelegate(const BeginFrameArgs& args) { |
380 TRACE_EVENT1("cc,benchmark", "Scheduler::BeginFrame", "args", args.AsValue()); | 380 TRACE_EVENT1("cc,benchmark", "Scheduler::BeginFrame", "args", args.AsValue()); |
381 | 381 |
382 // Deliver BeginFrames to children. | 382 // Deliver BeginFrames to children. |
383 if (settings_.forward_begin_frames_to_children && | 383 if (state_machine_.children_need_begin_frames()) { |
danakj
2015/03/13 17:57:11
If this patch isn't enabling stuff, but it's alrea
simonhong
2015/03/17 16:11:34
Yep, this is removed in a separate cl.
| |
384 state_machine_.children_need_begin_frames()) { | |
385 BeginFrameArgs adjusted_args_for_children(args); | 384 BeginFrameArgs adjusted_args_for_children(args); |
386 // Adjust a deadline for child schedulers. | 385 // Adjust a deadline for child schedulers. |
387 // TODO(simonhong): Once we have commitless update, we can get rid of | 386 // TODO(simonhong): Once we have commitless update, we can get rid of |
388 // BeginMainFrameToCommitDurationEstimate() + | 387 // BeginMainFrameToCommitDurationEstimate() + |
389 // CommitToActivateDurationEstimate(). | 388 // CommitToActivateDurationEstimate(). |
390 adjusted_args_for_children.deadline -= | 389 adjusted_args_for_children.deadline -= |
391 (client_->BeginMainFrameToCommitDurationEstimate() + | 390 (client_->BeginMainFrameToCommitDurationEstimate() + |
392 client_->CommitToActivateDurationEstimate() + | 391 client_->CommitToActivateDurationEstimate() + |
393 client_->DrawDurationEstimate() + EstimatedParentDrawTime()); | 392 client_->DrawDurationEstimate() + EstimatedParentDrawTime()); |
394 client_->SendBeginFramesToChildren(adjusted_args_for_children); | 393 client_->SendBeginFramesToChildren(adjusted_args_for_children); |
(...skipping 29 matching lines...) Expand all Loading... | |
424 TRACE_EVENT_INSTANT0( | 423 TRACE_EVENT_INSTANT0( |
425 "cc", "Scheduler::BeginFrame deferred", TRACE_EVENT_SCOPE_THREAD); | 424 "cc", "Scheduler::BeginFrame deferred", TRACE_EVENT_SCOPE_THREAD); |
426 // Queuing the frame counts as "using it", so we need to return true. | 425 // Queuing the frame counts as "using it", so we need to return true. |
427 } else { | 426 } else { |
428 BeginImplFrame(adjusted_args); | 427 BeginImplFrame(adjusted_args); |
429 } | 428 } |
430 return true; | 429 return true; |
431 } | 430 } |
432 | 431 |
433 void Scheduler::SetChildrenNeedBeginFrames(bool children_need_begin_frames) { | 432 void Scheduler::SetChildrenNeedBeginFrames(bool children_need_begin_frames) { |
434 DCHECK(settings_.forward_begin_frames_to_children); | |
435 state_machine_.SetChildrenNeedBeginFrames(children_need_begin_frames); | 433 state_machine_.SetChildrenNeedBeginFrames(children_need_begin_frames); |
436 ProcessScheduledActions(); | 434 ProcessScheduledActions(); |
437 } | 435 } |
438 | 436 |
439 // BeginRetroFrame is called for BeginFrames that we've deferred because | 437 // BeginRetroFrame is called for BeginFrames that we've deferred because |
440 // the scheduler was in the middle of processing a previous BeginFrame. | 438 // the scheduler was in the middle of processing a previous BeginFrame. |
441 void Scheduler::BeginRetroFrame() { | 439 void Scheduler::BeginRetroFrame() { |
442 TRACE_EVENT0("cc,benchmark", "Scheduler::BeginRetroFrame"); | 440 TRACE_EVENT0("cc,benchmark", "Scheduler::BeginRetroFrame"); |
443 DCHECK(!settings_.using_synchronous_renderer_compositor); | 441 DCHECK(!settings_.using_synchronous_renderer_compositor); |
444 DCHECK(!begin_retro_frame_args_.empty()); | 442 DCHECK(!begin_retro_frame_args_.empty()); |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
870 } | 868 } |
871 | 869 |
872 bool Scheduler::IsBeginMainFrameSentOrStarted() const { | 870 bool Scheduler::IsBeginMainFrameSentOrStarted() const { |
873 return (state_machine_.commit_state() == | 871 return (state_machine_.commit_state() == |
874 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || | 872 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_SENT || |
875 state_machine_.commit_state() == | 873 state_machine_.commit_state() == |
876 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); | 874 SchedulerStateMachine::COMMIT_STATE_BEGIN_MAIN_FRAME_STARTED); |
877 } | 875 } |
878 | 876 |
879 } // namespace cc | 877 } // namespace cc |
OLD | NEW |