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_state_machine.h" | 5 #include "cc/scheduler/scheduler_state_machine.h" |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 visible_(false), | 42 visible_(false), |
43 can_start_(false), | 43 can_start_(false), |
44 can_draw_(false), | 44 can_draw_(false), |
45 has_pending_tree_(false), | 45 has_pending_tree_(false), |
46 pending_tree_is_ready_for_activation_(false), | 46 pending_tree_is_ready_for_activation_(false), |
47 active_tree_needs_first_draw_(false), | 47 active_tree_needs_first_draw_(false), |
48 did_create_and_initialize_first_output_surface_(false), | 48 did_create_and_initialize_first_output_surface_(false), |
49 impl_latency_takes_priority_(false), | 49 impl_latency_takes_priority_(false), |
50 main_thread_missed_last_deadline_(false), | 50 main_thread_missed_last_deadline_(false), |
51 skip_next_begin_main_frame_to_reduce_latency_(false), | 51 skip_next_begin_main_frame_to_reduce_latency_(false), |
52 continuous_painting_(false), | |
53 children_need_begin_frames_(false), | 52 children_need_begin_frames_(false), |
54 defer_commits_(false), | 53 defer_commits_(false), |
55 video_needs_begin_frames_(false), | 54 video_needs_begin_frames_(false), |
56 last_commit_had_no_updates_(false), | 55 last_commit_had_no_updates_(false), |
57 wait_for_ready_to_draw_(false), | 56 wait_for_ready_to_draw_(false), |
58 did_request_swap_in_last_frame_(false), | 57 did_request_swap_in_last_frame_(false), |
59 did_perform_swap_in_last_draw_(false) {} | 58 did_perform_swap_in_last_draw_(false) {} |
60 | 59 |
61 const char* SchedulerStateMachine::OutputSurfaceStateToString( | 60 const char* SchedulerStateMachine::OutputSurfaceStateToString( |
62 OutputSurfaceState state) { | 61 OutputSurfaceState state) { |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 active_tree_needs_first_draw_); | 234 active_tree_needs_first_draw_); |
236 state->SetBoolean("wait_for_ready_to_draw", wait_for_ready_to_draw_); | 235 state->SetBoolean("wait_for_ready_to_draw", wait_for_ready_to_draw_); |
237 state->SetBoolean("did_create_and_initialize_first_output_surface", | 236 state->SetBoolean("did_create_and_initialize_first_output_surface", |
238 did_create_and_initialize_first_output_surface_); | 237 did_create_and_initialize_first_output_surface_); |
239 state->SetBoolean("impl_latency_takes_priority", | 238 state->SetBoolean("impl_latency_takes_priority", |
240 impl_latency_takes_priority_); | 239 impl_latency_takes_priority_); |
241 state->SetBoolean("main_thread_missed_last_deadline", | 240 state->SetBoolean("main_thread_missed_last_deadline", |
242 main_thread_missed_last_deadline_); | 241 main_thread_missed_last_deadline_); |
243 state->SetBoolean("skip_next_begin_main_frame_to_reduce_latency", | 242 state->SetBoolean("skip_next_begin_main_frame_to_reduce_latency", |
244 skip_next_begin_main_frame_to_reduce_latency_); | 243 skip_next_begin_main_frame_to_reduce_latency_); |
245 state->SetBoolean("continuous_painting", continuous_painting_); | |
246 state->SetBoolean("children_need_begin_frames", children_need_begin_frames_); | 244 state->SetBoolean("children_need_begin_frames", children_need_begin_frames_); |
247 state->SetBoolean("video_needs_begin_frames", video_needs_begin_frames_); | 245 state->SetBoolean("video_needs_begin_frames", video_needs_begin_frames_); |
248 state->SetBoolean("defer_commits", defer_commits_); | 246 state->SetBoolean("defer_commits", defer_commits_); |
249 state->SetBoolean("last_commit_had_no_updates", last_commit_had_no_updates_); | 247 state->SetBoolean("last_commit_had_no_updates", last_commit_had_no_updates_); |
250 state->SetBoolean("did_request_swap_in_last_frame", | 248 state->SetBoolean("did_request_swap_in_last_frame", |
251 did_request_swap_in_last_frame_); | 249 did_request_swap_in_last_frame_); |
252 state->SetBoolean("did_perform_swap_in_last_draw", | 250 state->SetBoolean("did_perform_swap_in_last_draw", |
253 did_perform_swap_in_last_draw_); | 251 did_perform_swap_in_last_draw_); |
254 state->EndDictionary(); | 252 state->EndDictionary(); |
255 } | 253 } |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 if (!has_pending_tree_ && | 619 if (!has_pending_tree_ && |
622 (!commit_has_no_updates || | 620 (!commit_has_no_updates || |
623 forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW)) { | 621 forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW)) { |
624 needs_redraw_ = true; | 622 needs_redraw_ = true; |
625 active_tree_needs_first_draw_ = true; | 623 active_tree_needs_first_draw_ = true; |
626 } | 624 } |
627 | 625 |
628 // This post-commit work is common to both completed and aborted commits. | 626 // This post-commit work is common to both completed and aborted commits. |
629 pending_tree_is_ready_for_activation_ = false; | 627 pending_tree_is_ready_for_activation_ = false; |
630 | 628 |
631 if (continuous_painting_) | |
632 needs_begin_main_frame_ = true; | |
633 last_commit_had_no_updates_ = commit_has_no_updates; | 629 last_commit_had_no_updates_ = commit_has_no_updates; |
634 } | 630 } |
635 | 631 |
636 void SchedulerStateMachine::WillActivate() { | 632 void SchedulerStateMachine::WillActivate() { |
637 if (begin_main_frame_state_ == | 633 if (begin_main_frame_state_ == |
638 BEGIN_MAIN_FRAME_STATE_WAITING_FOR_ACTIVATION) { | 634 BEGIN_MAIN_FRAME_STATE_WAITING_FOR_ACTIVATION) { |
639 begin_main_frame_state_ = settings_.commit_to_active_tree | 635 begin_main_frame_state_ = settings_.commit_to_active_tree |
640 ? BEGIN_MAIN_FRAME_STATE_WAITING_FOR_DRAW | 636 ? BEGIN_MAIN_FRAME_STATE_WAITING_FOR_DRAW |
641 : BEGIN_MAIN_FRAME_STATE_IDLE; | 637 : BEGIN_MAIN_FRAME_STATE_IDLE; |
642 } | 638 } |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 case OUTPUT_SURFACE_ACTIVE: | 1105 case OUTPUT_SURFACE_ACTIVE: |
1110 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: | 1106 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: |
1111 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: | 1107 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: |
1112 return true; | 1108 return true; |
1113 } | 1109 } |
1114 NOTREACHED(); | 1110 NOTREACHED(); |
1115 return false; | 1111 return false; |
1116 } | 1112 } |
1117 | 1113 |
1118 } // namespace cc | 1114 } // namespace cc |
OLD | NEW |