| 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 if (needs_forced_redraw_) | 360 if (needs_forced_redraw_) |
| 356 return true; | 361 return true; |
| 357 | 362 |
| 358 if (visible_ && swap_used_incomplete_tile_) | 363 if (visible_ && swap_used_incomplete_tile_) |
| 359 return true; | 364 return true; |
| 360 | 365 |
| 361 return needs_redraw_ && visible_ && | 366 return needs_redraw_ && visible_ && |
| 362 output_surface_state_ == OUTPUT_SURFACE_ACTIVE; | 367 output_surface_state_ == OUTPUT_SURFACE_ACTIVE; |
| 363 } | 368 } |
| 364 | 369 |
| 365 void SchedulerStateMachine::DidEnterBeginFrame() { | 370 void SchedulerStateMachine::DidEnterBeginFrame(BeginFrameArgs args) { |
| 366 inside_begin_frame_ = true; | 371 inside_begin_frame_ = true; |
| 367 } | 372 last_begin_frame_args_ = args; |
| 368 | |
| 369 void SchedulerStateMachine::SetFrameTime(base::TimeTicks frame_time) { | |
| 370 last_frame_time_ = frame_time; | |
| 371 } | 373 } |
| 372 | 374 |
| 373 void SchedulerStateMachine::DidLeaveBeginFrame() { | 375 void SchedulerStateMachine::DidLeaveBeginFrame() { |
| 374 current_frame_number_++; | 376 current_frame_number_++; |
| 375 inside_begin_frame_ = false; | 377 inside_begin_frame_ = false; |
| 376 } | 378 } |
| 377 | 379 |
| 378 void SchedulerStateMachine::SetVisible(bool visible) { visible_ = visible; } | 380 void SchedulerStateMachine::SetVisible(bool visible) { visible_ = visible; } |
| 379 | 381 |
| 380 void SchedulerStateMachine::SetNeedsRedraw() { needs_redraw_ = true; } | 382 void SchedulerStateMachine::SetNeedsRedraw() { needs_redraw_ = true; } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 bool SchedulerStateMachine::HasInitializedOutputSurface() const { | 465 bool SchedulerStateMachine::HasInitializedOutputSurface() const { |
| 464 return output_surface_state_ == OUTPUT_SURFACE_ACTIVE; | 466 return output_surface_state_ == OUTPUT_SURFACE_ACTIVE; |
| 465 } | 467 } |
| 466 | 468 |
| 467 void SchedulerStateMachine::SetMaximumNumberOfFailedDrawsBeforeDrawIsForced( | 469 void SchedulerStateMachine::SetMaximumNumberOfFailedDrawsBeforeDrawIsForced( |
| 468 int num_draws) { | 470 int num_draws) { |
| 469 maximum_number_of_failed_draws_before_draw_is_forced_ = num_draws; | 471 maximum_number_of_failed_draws_before_draw_is_forced_ = num_draws; |
| 470 } | 472 } |
| 471 | 473 |
| 472 } // namespace cc | 474 } // namespace cc |
| OLD | NEW |