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

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

Issue 16863005: cc: Add BeginFrameArgs (Closed) Base URL: http://git.chromium.org/chromium/src.git@nofrc12
Patch Set: Rebase and address comments Created 7 years, 6 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_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 11 matching lines...) Expand all
22 maximum_number_of_failed_draws_before_draw_is_forced_(3), 22 maximum_number_of_failed_draws_before_draw_is_forced_(3),
23 needs_redraw_(false), 23 needs_redraw_(false),
24 swap_used_incomplete_tile_(false), 24 swap_used_incomplete_tile_(false),
25 needs_forced_redraw_(false), 25 needs_forced_redraw_(false),
26 needs_forced_redraw_after_next_commit_(false), 26 needs_forced_redraw_after_next_commit_(false),
27 needs_commit_(false), 27 needs_commit_(false),
28 needs_forced_commit_(false), 28 needs_forced_commit_(false),
29 expect_immediate_begin_frame_for_main_thread_(false), 29 expect_immediate_begin_frame_for_main_thread_(false),
30 main_thread_needs_layer_textures_(false), 30 main_thread_needs_layer_textures_(false),
31 inside_begin_frame_(false), 31 inside_begin_frame_(false),
32 last_begin_frame_args_(BeginFrameArgs::CreateInvalid()),
32 visible_(false), 33 visible_(false),
33 can_start_(false), 34 can_start_(false),
34 can_draw_(false), 35 can_draw_(false),
35 has_pending_tree_(false), 36 has_pending_tree_(false),
36 draw_if_possible_failed_(false), 37 draw_if_possible_failed_(false),
37 texture_state_(LAYER_TEXTURE_STATE_UNLOCKED), 38 texture_state_(LAYER_TEXTURE_STATE_UNLOCKED),
38 output_surface_state_(OUTPUT_SURFACE_LOST), 39 output_surface_state_(OUTPUT_SURFACE_LOST),
39 did_create_and_initialize_first_output_surface_(false) {} 40 did_create_and_initialize_first_output_surface_(false) {}
40 41
41 std::string SchedulerStateMachine::ToString() { 42 std::string SchedulerStateMachine::ToString() {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 &str, "needs_forced_commit_ = %d; ", needs_forced_commit_); 78 &str, "needs_forced_commit_ = %d; ", needs_forced_commit_);
78 base::StringAppendF(&str, 79 base::StringAppendF(&str,
79 "expect_immediate_begin_frame_for_main_thread_ = %d; ", 80 "expect_immediate_begin_frame_for_main_thread_ = %d; ",
80 expect_immediate_begin_frame_for_main_thread_); 81 expect_immediate_begin_frame_for_main_thread_);
81 base::StringAppendF(&str, 82 base::StringAppendF(&str,
82 "main_thread_needs_layer_textures_ = %d; ", 83 "main_thread_needs_layer_textures_ = %d; ",
83 main_thread_needs_layer_textures_); 84 main_thread_needs_layer_textures_);
84 base::StringAppendF(&str, "inside_begin_frame_ = %d; ", 85 base::StringAppendF(&str, "inside_begin_frame_ = %d; ",
85 inside_begin_frame_); 86 inside_begin_frame_);
86 base::StringAppendF(&str, "last_frame_time_ = %"PRId64"; ", 87 base::StringAppendF(&str, "last_frame_time_ = %"PRId64"; ",
87 (last_frame_time_ - base::TimeTicks()).InMilliseconds()); 88 (last_begin_frame_args_.frame_time() - base::TimeTicks())
89 .InMilliseconds());
90 base::StringAppendF(&str, "last_deadline_ = %"PRId64"; ",
91 (last_begin_frame_args_.deadline() - base::TimeTicks()).InMilliseconds());
92 base::StringAppendF(&str, "last_interval_ = %"PRId64"; ",
93 last_begin_frame_args_.interval().InMilliseconds());
88 base::StringAppendF(&str, "visible_ = %d; ", visible_); 94 base::StringAppendF(&str, "visible_ = %d; ", visible_);
89 base::StringAppendF(&str, "can_start_ = %d; ", can_start_); 95 base::StringAppendF(&str, "can_start_ = %d; ", can_start_);
90 base::StringAppendF(&str, "can_draw_ = %d; ", can_draw_); 96 base::StringAppendF(&str, "can_draw_ = %d; ", can_draw_);
91 base::StringAppendF( 97 base::StringAppendF(
92 &str, "draw_if_possible_failed_ = %d; ", draw_if_possible_failed_); 98 &str, "draw_if_possible_failed_ = %d; ", draw_if_possible_failed_);
93 base::StringAppendF(&str, "has_pending_tree_ = %d; ", has_pending_tree_); 99 base::StringAppendF(&str, "has_pending_tree_ = %d; ", has_pending_tree_);
94 base::StringAppendF(&str, "texture_state_ = %d; ", texture_state_); 100 base::StringAppendF(&str, "texture_state_ = %d; ", texture_state_);
95 base::StringAppendF( 101 base::StringAppendF(
96 &str, "output_surface_state_ = %d; ", output_surface_state_); 102 &str, "output_surface_state_ = %d; ", output_surface_state_);
97 return str; 103 return str;
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 if (needs_forced_redraw_) 361 if (needs_forced_redraw_)
356 return true; 362 return true;
357 363
358 if (visible_ && swap_used_incomplete_tile_) 364 if (visible_ && swap_used_incomplete_tile_)
359 return true; 365 return true;
360 366
361 return needs_redraw_ && visible_ && 367 return needs_redraw_ && visible_ &&
362 output_surface_state_ == OUTPUT_SURFACE_ACTIVE; 368 output_surface_state_ == OUTPUT_SURFACE_ACTIVE;
363 } 369 }
364 370
365 void SchedulerStateMachine::DidEnterBeginFrame() { 371 void SchedulerStateMachine::DidEnterBeginFrame(BeginFrameArgs args) {
366 inside_begin_frame_ = true; 372 inside_begin_frame_ = true;
367 } 373 last_begin_frame_args_ = args;
368
369 void SchedulerStateMachine::SetFrameTime(base::TimeTicks frame_time) {
370 last_frame_time_ = frame_time;
371 } 374 }
372 375
373 void SchedulerStateMachine::DidLeaveBeginFrame() { 376 void SchedulerStateMachine::DidLeaveBeginFrame() {
374 current_frame_number_++; 377 current_frame_number_++;
375 inside_begin_frame_ = false; 378 inside_begin_frame_ = false;
376 } 379 }
377 380
378 void SchedulerStateMachine::SetVisible(bool visible) { visible_ = visible; } 381 void SchedulerStateMachine::SetVisible(bool visible) { visible_ = visible; }
379 382
380 void SchedulerStateMachine::SetNeedsRedraw() { needs_redraw_ = true; } 383 void SchedulerStateMachine::SetNeedsRedraw() { needs_redraw_ = true; }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 bool SchedulerStateMachine::HasInitializedOutputSurface() const { 466 bool SchedulerStateMachine::HasInitializedOutputSurface() const {
464 return output_surface_state_ == OUTPUT_SURFACE_ACTIVE; 467 return output_surface_state_ == OUTPUT_SURFACE_ACTIVE;
465 } 468 }
466 469
467 void SchedulerStateMachine::SetMaximumNumberOfFailedDrawsBeforeDrawIsForced( 470 void SchedulerStateMachine::SetMaximumNumberOfFailedDrawsBeforeDrawIsForced(
468 int num_draws) { 471 int num_draws) {
469 maximum_number_of_failed_draws_before_draw_is_forced_ = num_draws; 472 maximum_number_of_failed_draws_before_draw_is_forced_ = num_draws;
470 } 473 }
471 474
472 } // namespace cc 475 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698