Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: cc/scheduler/scheduler.cc

Issue 2659123004: cc: Add scheduler support for invalidating content on impl thread. (Closed)
Patch Set: only inside deadline Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 59 }
60 60
61 Scheduler::~Scheduler() { 61 Scheduler::~Scheduler() {
62 SetBeginFrameSource(nullptr); 62 SetBeginFrameSource(nullptr);
63 } 63 }
64 64
65 void Scheduler::Stop() { 65 void Scheduler::Stop() {
66 stopped_ = true; 66 stopped_ = true;
67 } 67 }
68 68
69 void Scheduler::SetNeedsImplSideInvalidation() {
70 state_machine_.SetNeedsImplSideInvalidation();
71 ProcessScheduledActions();
72 }
73
69 base::TimeTicks Scheduler::Now() const { 74 base::TimeTicks Scheduler::Now() const {
70 base::TimeTicks now = base::TimeTicks::Now(); 75 base::TimeTicks now = base::TimeTicks::Now();
71 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler.now"), 76 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler.now"),
72 "Scheduler::Now", "now", now); 77 "Scheduler::Now", "now", now);
73 return now; 78 return now;
74 } 79 }
75 80
76 void Scheduler::SetVisible(bool visible) { 81 void Scheduler::SetVisible(bool visible) {
77 state_machine_.SetVisible(visible); 82 state_machine_.SetVisible(visible);
78 UpdateCompositorTimingHistoryRecordingEnabled(); 83 UpdateCompositorTimingHistoryRecordingEnabled();
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 // order to allow the state machine to "settle" first. 543 // order to allow the state machine to "settle" first.
539 compositor_timing_history_->WillFinishImplFrame( 544 compositor_timing_history_->WillFinishImplFrame(
540 state_machine_.needs_redraw()); 545 state_machine_.needs_redraw());
541 state_machine_.OnBeginImplFrameDeadline(); 546 state_machine_.OnBeginImplFrameDeadline();
542 ProcessScheduledActions(); 547 ProcessScheduledActions();
543 FinishImplFrame(); 548 FinishImplFrame();
544 } 549 }
545 550
546 void Scheduler::DrawIfPossible() { 551 void Scheduler::DrawIfPossible() {
547 bool drawing_with_new_active_tree = 552 bool drawing_with_new_active_tree =
548 state_machine_.active_tree_needs_first_draw(); 553 state_machine_.active_tree_needs_first_draw() &&
554 !state_machine_.previous_pending_tree_was_impl_side();
brianderson 2017/02/22 19:31:20 Is there any way to avoid setting active_tree_need
Khushal 2017/02/22 20:19:29 I think we would want to set |active_tree_needs_fi
brianderson 2017/02/22 22:58:08 I think overwriting the active tree in this case m
Khushal 2017/02/22 23:20:24 "When a commit comes in while there's still a pend
brianderson 2017/02/22 23:42:33 I see. I completely misunderstood the merge mechan
549 bool main_thread_missed_last_deadline = 555 bool main_thread_missed_last_deadline =
550 state_machine_.main_thread_missed_last_deadline(); 556 state_machine_.main_thread_missed_last_deadline();
551 compositor_timing_history_->WillDraw(); 557 compositor_timing_history_->WillDraw();
552 state_machine_.WillDraw(); 558 state_machine_.WillDraw();
553 DrawResult result = client_->ScheduledActionDrawIfPossible(); 559 DrawResult result = client_->ScheduledActionDrawIfPossible();
554 state_machine_.DidDraw(result); 560 state_machine_.DidDraw(result);
555 compositor_timing_history_->DidDraw( 561 compositor_timing_history_->DidDraw(
556 drawing_with_new_active_tree, main_thread_missed_last_deadline, 562 drawing_with_new_active_tree, main_thread_missed_last_deadline,
557 begin_impl_frame_tracker_.DangerousMethodCurrentOrLast().frame_time); 563 begin_impl_frame_tracker_.DangerousMethodCurrentOrLast().frame_time);
558 } 564 }
559 565
560 void Scheduler::DrawForced() { 566 void Scheduler::DrawForced() {
561 bool drawing_with_new_active_tree = 567 bool drawing_with_new_active_tree =
562 state_machine_.active_tree_needs_first_draw(); 568 state_machine_.active_tree_needs_first_draw() &&
569 !state_machine_.previous_pending_tree_was_impl_side();
563 bool main_thread_missed_last_deadline = 570 bool main_thread_missed_last_deadline =
564 state_machine_.main_thread_missed_last_deadline(); 571 state_machine_.main_thread_missed_last_deadline();
565 compositor_timing_history_->WillDraw(); 572 compositor_timing_history_->WillDraw();
566 state_machine_.WillDraw(); 573 state_machine_.WillDraw();
567 DrawResult result = client_->ScheduledActionDrawForced(); 574 DrawResult result = client_->ScheduledActionDrawForced();
568 state_machine_.DidDraw(result); 575 state_machine_.DidDraw(result);
569 compositor_timing_history_->DidDraw( 576 compositor_timing_history_->DidDraw(
570 drawing_with_new_active_tree, main_thread_missed_last_deadline, 577 drawing_with_new_active_tree, main_thread_missed_last_deadline,
571 begin_impl_frame_tracker_.DangerousMethodCurrentOrLast().frame_time); 578 begin_impl_frame_tracker_.DangerousMethodCurrentOrLast().frame_time);
572 } 579 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 state_machine_.WillCommit(commit_has_no_updates); 620 state_machine_.WillCommit(commit_has_no_updates);
614 client_->ScheduledActionCommit(); 621 client_->ScheduledActionCommit();
615 break; 622 break;
616 } 623 }
617 case SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE: 624 case SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE:
618 compositor_timing_history_->WillActivate(); 625 compositor_timing_history_->WillActivate();
619 state_machine_.WillActivate(); 626 state_machine_.WillActivate();
620 client_->ScheduledActionActivateSyncTree(); 627 client_->ScheduledActionActivateSyncTree();
621 compositor_timing_history_->DidActivate(); 628 compositor_timing_history_->DidActivate();
622 break; 629 break;
630 case SchedulerStateMachine::ACTION_PERFORM_IMPL_SIDE_INVALIDATION:
631 state_machine_.WillPerformImplSideInvalidation();
632 client_->ScheduledActionPerformImplSideInvalidation();
633 break;
623 case SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE: 634 case SchedulerStateMachine::ACTION_DRAW_IF_POSSIBLE:
624 DrawIfPossible(); 635 DrawIfPossible();
625 break; 636 break;
626 case SchedulerStateMachine::ACTION_DRAW_FORCED: 637 case SchedulerStateMachine::ACTION_DRAW_FORCED:
627 DrawForced(); 638 DrawForced();
628 break; 639 break;
629 case SchedulerStateMachine::ACTION_DRAW_ABORT: { 640 case SchedulerStateMachine::ACTION_DRAW_ABORT: {
630 // No action is actually performed, but this allows the state machine to 641 // No action is actually performed, but this allows the state machine to
631 // drain the pipeline without actually drawing. 642 // drain the pipeline without actually drawing.
632 state_machine_.AbortDraw(); 643 state_machine_.AbortDraw();
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 } 778 }
768 779
769 bool Scheduler::IsBeginMainFrameSentOrStarted() const { 780 bool Scheduler::IsBeginMainFrameSentOrStarted() const {
770 return (state_machine_.begin_main_frame_state() == 781 return (state_machine_.begin_main_frame_state() ==
771 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT || 782 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT ||
772 state_machine_.begin_main_frame_state() == 783 state_machine_.begin_main_frame_state() ==
773 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED); 784 SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_STARTED);
774 } 785 }
775 786
776 } // namespace cc 787 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698