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

Side by Side Diff: cc/trees/layer_tree_host.cc

Issue 23530003: cc: Block commit on activate by setting a flag on LayerTreeHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
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/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <stack> 8 #include <stack>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 82
83 static int s_next_tree_id = 1; 83 static int s_next_tree_id = 1;
84 84
85 LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, 85 LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client,
86 const LayerTreeSettings& settings) 86 const LayerTreeSettings& settings)
87 : next_ui_resource_id_(1), 87 : next_ui_resource_id_(1),
88 animating_(false), 88 animating_(false),
89 needs_full_tree_sync_(true), 89 needs_full_tree_sync_(true),
90 needs_filter_context_(false), 90 needs_filter_context_(false),
91 commit_waits_for_activation_(false),
91 client_(client), 92 client_(client),
92 source_frame_number_(0), 93 source_frame_number_(0),
93 rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()), 94 rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()),
94 output_surface_can_be_initialized_(true), 95 output_surface_can_be_initialized_(true),
95 output_surface_lost_(true), 96 output_surface_lost_(true),
96 num_failed_recreate_attempts_(0), 97 num_failed_recreate_attempts_(0),
97 settings_(settings), 98 settings_(settings),
98 debug_state_(settings.initial_debug_state), 99 debug_state_(settings.initial_debug_state),
99 overdraw_bottom_height_(0.f), 100 overdraw_bottom_height_(0.f),
100 device_scale_factor_(1.f), 101 device_scale_factor_(1.f),
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 if (sync_tree->ContentsTexturesPurged()) 377 if (sync_tree->ContentsTexturesPurged())
377 sync_tree->ResetContentsTexturesPurged(); 378 sync_tree->ResetContentsTexturesPurged();
378 } 379 }
379 380
380 if (!settings_.impl_side_painting) { 381 if (!settings_.impl_side_painting) {
381 // If we're not in impl-side painting, the tree is immediately 382 // If we're not in impl-side painting, the tree is immediately
382 // considered active. 383 // considered active.
383 sync_tree->DidBecomeActive(); 384 sync_tree->DidBecomeActive();
384 } 385 }
385 386
387 commit_waits_for_activation_ = false;
386 source_frame_number_++; 388 source_frame_number_++;
387 } 389 }
388 390
389 void LayerTreeHost::WillCommit() { 391 void LayerTreeHost::WillCommit() {
390 client_->WillCommit(); 392 client_->WillCommit();
391 } 393 }
392 394
393 void LayerTreeHost::UpdateHudLayer() { 395 void LayerTreeHost::UpdateHudLayer() {
394 if (debug_state_.ShowHudInfo()) { 396 if (debug_state_.ShowHudInfo()) {
395 if (!hud_layer_.get()) 397 if (!hud_layer_.get())
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 // Top controls are only used in threaded mode. 1084 // Top controls are only used in threaded mode.
1083 proxy_->ImplThreadTaskRunner()->PostTask( 1085 proxy_->ImplThreadTaskRunner()->PostTask(
1084 FROM_HERE, 1086 FROM_HERE,
1085 base::Bind(&TopControlsManager::UpdateTopControlsState, 1087 base::Bind(&TopControlsManager::UpdateTopControlsState,
1086 top_controls_manager_weak_ptr_, 1088 top_controls_manager_weak_ptr_,
1087 constraints, 1089 constraints,
1088 current, 1090 current,
1089 animate)); 1091 animate));
1090 } 1092 }
1091 1093
1092 bool LayerTreeHost::BlocksPendingCommit() const {
1093 if (!root_layer_.get())
1094 return false;
1095 return root_layer_->BlocksPendingCommitRecursive();
1096 }
1097
1098 scoped_ptr<base::Value> LayerTreeHost::AsValue() const { 1094 scoped_ptr<base::Value> LayerTreeHost::AsValue() const {
1099 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 1095 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
1100 state->Set("proxy", proxy_->AsValue().release()); 1096 state->Set("proxy", proxy_->AsValue().release());
1101 return state.PassAs<base::Value>(); 1097 return state.PassAs<base::Value>();
1102 } 1098 }
1103 1099
1104 void LayerTreeHost::AnimateLayers(base::TimeTicks time) { 1100 void LayerTreeHost::AnimateLayers(base::TimeTicks time) {
1105 rendering_stats_instrumentation_->IncrementAnimationFrameCount(); 1101 rendering_stats_instrumentation_->IncrementAnimationFrameCount();
1106 if (!settings_.accelerated_animation_enabled || 1102 if (!settings_.accelerated_animation_enabled ||
1107 animation_registrar_->active_animation_controllers().empty()) 1103 animation_registrar_->active_animation_controllers().empty())
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 void LayerTreeHost::DidLoseUIResources() { 1165 void LayerTreeHost::DidLoseUIResources() {
1170 // When output surface is lost, we need to recreate the resource. 1166 // When output surface is lost, we need to recreate the resource.
1171 for (UIResourceClientMap::iterator iter = ui_resource_client_map_.begin(); 1167 for (UIResourceClientMap::iterator iter = ui_resource_client_map_.begin();
1172 iter != ui_resource_client_map_.end(); 1168 iter != ui_resource_client_map_.end();
1173 ++iter) { 1169 ++iter) {
1174 UIResourceLost(iter->first); 1170 UIResourceLost(iter->first);
1175 } 1171 }
1176 } 1172 }
1177 1173
1178 } // namespace cc 1174 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698