| 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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 state_machine_.OnBeginImplFrameIdle(); | 436 state_machine_.OnBeginImplFrameIdle(); |
| 437 ProcessScheduledActions(); | 437 ProcessScheduledActions(); |
| 438 | 438 |
| 439 client_->DidFinishImplFrame(); | 439 client_->DidFinishImplFrame(); |
| 440 SendBeginFrameAck(begin_main_frame_args_, kBeginFrameFinished); | 440 SendBeginFrameAck(begin_main_frame_args_, kBeginFrameFinished); |
| 441 begin_impl_frame_tracker_.Finish(); | 441 begin_impl_frame_tracker_.Finish(); |
| 442 } | 442 } |
| 443 | 443 |
| 444 void Scheduler::SendBeginFrameAck(const BeginFrameArgs& args, | 444 void Scheduler::SendBeginFrameAck(const BeginFrameArgs& args, |
| 445 BeginFrameResult result) { | 445 BeginFrameResult result) { |
| 446 if (!begin_frame_source_) | 446 bool did_submit = false; |
| 447 return; | 447 if (result == kBeginFrameFinished) |
| 448 did_submit = state_machine_.did_submit_in_last_frame(); |
| 448 | 449 |
| 449 uint64_t latest_confirmed_sequence_number = | 450 if (!did_submit) { |
| 450 BeginFrameArgs::kInvalidFrameNumber; | 451 uint64_t latest_confirmed_sequence_number = |
| 451 if (args.source_id == state_machine_.begin_frame_source_id()) { | 452 BeginFrameArgs::kInvalidFrameNumber; |
| 452 latest_confirmed_sequence_number = | 453 if (args.source_id == state_machine_.begin_frame_source_id()) { |
| 453 state_machine_ | 454 latest_confirmed_sequence_number = |
| 454 .last_begin_frame_sequence_number_compositor_frame_was_fresh(); | 455 state_machine_ |
| 456 .last_begin_frame_sequence_number_compositor_frame_was_fresh(); |
| 457 } |
| 458 |
| 459 client_->DidNotProduceFrame( |
| 460 BeginFrameAck(args.source_id, args.sequence_number, |
| 461 latest_confirmed_sequence_number, did_submit)); |
| 455 } | 462 } |
| 456 | 463 |
| 457 bool did_submit = false; | 464 if (begin_frame_source_) |
| 458 if (result == kBeginFrameFinished) { | 465 begin_frame_source_->DidFinishFrame(this); |
| 459 did_submit = state_machine_.did_submit_in_last_frame(); | |
| 460 } | |
| 461 | |
| 462 BeginFrameAck ack(args.source_id, args.sequence_number, | |
| 463 latest_confirmed_sequence_number, did_submit); | |
| 464 begin_frame_source_->DidFinishFrame(this, ack); | |
| 465 if (!did_submit) | |
| 466 client_->DidNotProduceFrame(ack); | |
| 467 } | 466 } |
| 468 | 467 |
| 469 // BeginImplFrame starts a compositor frame that will wait up until a deadline | 468 // BeginImplFrame starts a compositor frame that will wait up until a deadline |
| 470 // for a BeginMainFrame+activation to complete before it times out and draws | 469 // for a BeginMainFrame+activation to complete before it times out and draws |
| 471 // any asynchronous animation and scroll/pinch updates. | 470 // any asynchronous animation and scroll/pinch updates. |
| 472 void Scheduler::BeginImplFrame(const BeginFrameArgs& args, | 471 void Scheduler::BeginImplFrame(const BeginFrameArgs& args, |
| 473 base::TimeTicks now) { | 472 base::TimeTicks now) { |
| 474 DCHECK_EQ(state_machine_.begin_impl_frame_state(), | 473 DCHECK_EQ(state_machine_.begin_impl_frame_state(), |
| 475 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); | 474 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); |
| 476 DCHECK(begin_impl_frame_deadline_task_.IsCancelled()); | 475 DCHECK(begin_impl_frame_deadline_task_.IsCancelled()); |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 } | 835 } |
| 837 | 836 |
| 838 BeginFrameAck Scheduler::CurrentBeginFrameAckForActiveTree() const { | 837 BeginFrameAck Scheduler::CurrentBeginFrameAckForActiveTree() const { |
| 839 return BeginFrameAck( | 838 return BeginFrameAck( |
| 840 begin_main_frame_args_.source_id, begin_main_frame_args_.sequence_number, | 839 begin_main_frame_args_.source_id, begin_main_frame_args_.sequence_number, |
| 841 state_machine_.last_begin_frame_sequence_number_active_tree_was_fresh(), | 840 state_machine_.last_begin_frame_sequence_number_active_tree_was_fresh(), |
| 842 true); | 841 true); |
| 843 } | 842 } |
| 844 | 843 |
| 845 } // namespace cc | 844 } // namespace cc |
| OLD | NEW |