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 | 10 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 &str, "needs_forced_commit_ = %d; ", needs_forced_commit_); | 77 &str, "needs_forced_commit_ = %d; ", needs_forced_commit_); |
78 base::StringAppendF(&str, | 78 base::StringAppendF(&str, |
79 "expect_immediate_begin_frame_for_main_thread_ = %d; ", | 79 "expect_immediate_begin_frame_for_main_thread_ = %d; ", |
80 expect_immediate_begin_frame_for_main_thread_); | 80 expect_immediate_begin_frame_for_main_thread_); |
81 base::StringAppendF(&str, | 81 base::StringAppendF(&str, |
82 "main_thread_needs_layer_textures_ = %d; ", | 82 "main_thread_needs_layer_textures_ = %d; ", |
83 main_thread_needs_layer_textures_); | 83 main_thread_needs_layer_textures_); |
84 base::StringAppendF(&str, "inside_begin_frame_ = %d; ", | 84 base::StringAppendF(&str, "inside_begin_frame_ = %d; ", |
85 inside_begin_frame_); | 85 inside_begin_frame_); |
86 base::StringAppendF(&str, "last_frame_time_ = %"PRId64"; ", | 86 base::StringAppendF(&str, "last_frame_time_ = %"PRId64"; ", |
87 (last_frame_time_ - base::TimeTicks()).InMilliseconds()); | 87 (last_begin_frame_args_.frame_time - base::TimeTicks()) |
| 88 .InMilliseconds()); |
| 89 base::StringAppendF(&str, "last_deadline_ = %"PRId64"; ", |
| 90 (last_begin_frame_args_.deadline - base::TimeTicks()).InMilliseconds()); |
| 91 base::StringAppendF(&str, "last_interval_ = %"PRId64"; ", |
| 92 last_begin_frame_args_.interval.InMilliseconds()); |
88 base::StringAppendF(&str, "visible_ = %d; ", visible_); | 93 base::StringAppendF(&str, "visible_ = %d; ", visible_); |
89 base::StringAppendF(&str, "can_start_ = %d; ", can_start_); | 94 base::StringAppendF(&str, "can_start_ = %d; ", can_start_); |
90 base::StringAppendF(&str, "can_draw_ = %d; ", can_draw_); | 95 base::StringAppendF(&str, "can_draw_ = %d; ", can_draw_); |
91 base::StringAppendF( | 96 base::StringAppendF( |
92 &str, "draw_if_possible_failed_ = %d; ", draw_if_possible_failed_); | 97 &str, "draw_if_possible_failed_ = %d; ", draw_if_possible_failed_); |
93 base::StringAppendF(&str, "has_pending_tree_ = %d; ", has_pending_tree_); | 98 base::StringAppendF(&str, "has_pending_tree_ = %d; ", has_pending_tree_); |
94 base::StringAppendF(&str, "texture_state_ = %d; ", texture_state_); | 99 base::StringAppendF(&str, "texture_state_ = %d; ", texture_state_); |
95 base::StringAppendF( | 100 base::StringAppendF( |
96 &str, "output_surface_state_ = %d; ", output_surface_state_); | 101 &str, "output_surface_state_ = %d; ", output_surface_state_); |
97 return str; | 102 return str; |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 | 365 |
361 bool SchedulerStateMachine::ProactiveBeginFrameWantedByImplThread() const { | 366 bool SchedulerStateMachine::ProactiveBeginFrameWantedByImplThread() const { |
362 // We should proactively request a BeginFrame if a commit is pending. | 367 // We should proactively request a BeginFrame if a commit is pending. |
363 if (needs_commit_ || needs_forced_commit_ || | 368 if (needs_commit_ || needs_forced_commit_ || |
364 commit_state_ != COMMIT_STATE_IDLE) | 369 commit_state_ != COMMIT_STATE_IDLE) |
365 return true; | 370 return true; |
366 | 371 |
367 return false; | 372 return false; |
368 } | 373 } |
369 | 374 |
370 void SchedulerStateMachine::DidEnterBeginFrame() { | 375 void SchedulerStateMachine::DidEnterBeginFrame(const BeginFrameArgs& args) { |
371 inside_begin_frame_ = true; | 376 inside_begin_frame_ = true; |
372 } | 377 last_begin_frame_args_ = args; |
373 | |
374 void SchedulerStateMachine::SetFrameTime(base::TimeTicks frame_time) { | |
375 last_frame_time_ = frame_time; | |
376 } | 378 } |
377 | 379 |
378 void SchedulerStateMachine::DidLeaveBeginFrame() { | 380 void SchedulerStateMachine::DidLeaveBeginFrame() { |
379 current_frame_number_++; | 381 current_frame_number_++; |
380 inside_begin_frame_ = false; | 382 inside_begin_frame_ = false; |
381 } | 383 } |
382 | 384 |
383 void SchedulerStateMachine::SetVisible(bool visible) { visible_ = visible; } | 385 void SchedulerStateMachine::SetVisible(bool visible) { visible_ = visible; } |
384 | 386 |
385 void SchedulerStateMachine::SetNeedsRedraw() { needs_redraw_ = true; } | 387 void SchedulerStateMachine::SetNeedsRedraw() { needs_redraw_ = true; } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 bool SchedulerStateMachine::HasInitializedOutputSurface() const { | 470 bool SchedulerStateMachine::HasInitializedOutputSurface() const { |
469 return output_surface_state_ == OUTPUT_SURFACE_ACTIVE; | 471 return output_surface_state_ == OUTPUT_SURFACE_ACTIVE; |
470 } | 472 } |
471 | 473 |
472 void SchedulerStateMachine::SetMaximumNumberOfFailedDrawsBeforeDrawIsForced( | 474 void SchedulerStateMachine::SetMaximumNumberOfFailedDrawsBeforeDrawIsForced( |
473 int num_draws) { | 475 int num_draws) { |
474 maximum_number_of_failed_draws_before_draw_is_forced_ = num_draws; | 476 maximum_number_of_failed_draws_before_draw_is_forced_ = num_draws; |
475 } | 477 } |
476 | 478 |
477 } // namespace cc | 479 } // namespace cc |
OLD | NEW |