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

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

Issue 23694031: Fix race conditions in window snapshot code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Nit Created 7 years, 2 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
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <string> 9 #include <string>
10 10
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 visible_(true), 126 visible_(true),
127 page_scale_factor_(1.f), 127 page_scale_factor_(1.f),
128 min_page_scale_factor_(1.f), 128 min_page_scale_factor_(1.f),
129 max_page_scale_factor_(1.f), 129 max_page_scale_factor_(1.f),
130 trigger_idle_updates_(true), 130 trigger_idle_updates_(true),
131 background_color_(SK_ColorWHITE), 131 background_color_(SK_ColorWHITE),
132 has_transparent_background_(false), 132 has_transparent_background_(false),
133 partial_texture_update_requests_(0), 133 partial_texture_update_requests_(0),
134 in_paint_layer_contents_(false), 134 in_paint_layer_contents_(false),
135 total_frames_used_for_lcd_text_metrics_(0), 135 total_frames_used_for_lcd_text_metrics_(0),
136 tree_id_(s_next_tree_id++) { 136 tree_id_(s_next_tree_id++),
137 next_commit_forces_redraw_(false) {
137 if (settings_.accelerated_animation_enabled) 138 if (settings_.accelerated_animation_enabled)
138 animation_registrar_ = AnimationRegistrar::Create(); 139 animation_registrar_ = AnimationRegistrar::Create();
139 s_num_layer_tree_instances++; 140 s_num_layer_tree_instances++;
140 rendering_stats_instrumentation_->set_record_rendering_stats( 141 rendering_stats_instrumentation_->set_record_rendering_stats(
141 debug_state_.RecordRenderingStats()); 142 debug_state_.RecordRenderingStats());
142 } 143 }
143 144
144 bool LayerTreeHost::Initialize( 145 bool LayerTreeHost::Initialize(
145 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { 146 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) {
146 if (impl_task_runner.get()) 147 if (impl_task_runner.get())
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 // In impl-side painting, synchronize to the pending tree so that it has 317 // In impl-side painting, synchronize to the pending tree so that it has
317 // time to raster before being displayed. If no pending tree is needed, 318 // time to raster before being displayed. If no pending tree is needed,
318 // synchronization can happen directly to the active tree and 319 // synchronization can happen directly to the active tree and
319 // unlinked contents resources can be reclaimed immediately. 320 // unlinked contents resources can be reclaimed immediately.
320 LayerTreeImpl* sync_tree; 321 LayerTreeImpl* sync_tree;
321 if (settings_.impl_side_painting) { 322 if (settings_.impl_side_painting) {
322 // Commits should not occur while there is already a pending tree. 323 // Commits should not occur while there is already a pending tree.
323 DCHECK(!host_impl->pending_tree()); 324 DCHECK(!host_impl->pending_tree());
324 host_impl->CreatePendingTree(); 325 host_impl->CreatePendingTree();
325 sync_tree = host_impl->pending_tree(); 326 sync_tree = host_impl->pending_tree();
327 if (next_commit_forces_redraw_)
328 sync_tree->ForceRedrawNextActivation();
326 } else { 329 } else {
330 if (next_commit_forces_redraw_)
331 host_impl->SetFullRootLayerDamage();
327 contents_texture_manager_->ReduceMemory(host_impl->resource_provider()); 332 contents_texture_manager_->ReduceMemory(host_impl->resource_provider());
328 sync_tree = host_impl->active_tree(); 333 sync_tree = host_impl->active_tree();
329 } 334 }
330 335
336 next_commit_forces_redraw_ = false;
337
331 sync_tree->set_source_frame_number(source_frame_number()); 338 sync_tree->set_source_frame_number(source_frame_number());
332 339
333 if (needs_full_tree_sync_) 340 if (needs_full_tree_sync_)
334 sync_tree->SetRootLayer(TreeSynchronizer::SynchronizeTrees( 341 sync_tree->SetRootLayer(TreeSynchronizer::SynchronizeTrees(
335 root_layer(), sync_tree->DetachLayerTree(), sync_tree)); 342 root_layer(), sync_tree->DetachLayerTree(), sync_tree));
336 { 343 {
337 TRACE_EVENT0("cc", "LayerTreeHost::PushProperties"); 344 TRACE_EVENT0("cc", "LayerTreeHost::PushProperties");
338 TreeSynchronizer::PushProperties(root_layer(), sync_tree->root_layer()); 345 TreeSynchronizer::PushProperties(root_layer(), sync_tree->root_layer());
339 } 346 }
340 347
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 } 565 }
559 566
560 bool LayerTreeHost::CommitRequested() const { 567 bool LayerTreeHost::CommitRequested() const {
561 return proxy_->CommitRequested(); 568 return proxy_->CommitRequested();
562 } 569 }
563 570
564 void LayerTreeHost::SetNextCommitWaitsForActivation() { 571 void LayerTreeHost::SetNextCommitWaitsForActivation() {
565 proxy_->SetNextCommitWaitsForActivation(); 572 proxy_->SetNextCommitWaitsForActivation();
566 } 573 }
567 574
575 void LayerTreeHost::SetNextCommitForcesRedraw() {
576 next_commit_forces_redraw_ = true;
577 }
578
568 void LayerTreeHost::SetAnimationEvents(scoped_ptr<AnimationEventsVector> events, 579 void LayerTreeHost::SetAnimationEvents(scoped_ptr<AnimationEventsVector> events,
569 base::Time wall_clock_time) { 580 base::Time wall_clock_time) {
570 DCHECK(proxy_->IsMainThread()); 581 DCHECK(proxy_->IsMainThread());
571 for (size_t event_index = 0; event_index < events->size(); ++event_index) { 582 for (size_t event_index = 0; event_index < events->size(); ++event_index) {
572 int event_layer_id = (*events)[event_index].layer_id; 583 int event_layer_id = (*events)[event_index].layer_id;
573 584
574 // Use the map of all controllers, not just active ones, since non-active 585 // Use the map of all controllers, not just active ones, since non-active
575 // controllers may still receive events for impl-only animations. 586 // controllers may still receive events for impl-only animations.
576 const AnimationRegistrar::AnimationControllerMap& animation_controllers = 587 const AnimationRegistrar::AnimationControllerMap& animation_controllers =
577 animation_registrar_->all_animation_controllers(); 588 animation_registrar_->all_animation_controllers();
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 outer_viewport_scroll_layer_ = outer_viewport_scroll_layer; 1271 outer_viewport_scroll_layer_ = outer_viewport_scroll_layer;
1261 } 1272 }
1262 1273
1263 bool LayerTreeHost::ScheduleMicroBenchmark( 1274 bool LayerTreeHost::ScheduleMicroBenchmark(
1264 const std::string& benchmark_name, 1275 const std::string& benchmark_name,
1265 const MicroBenchmark::DoneCallback& callback) { 1276 const MicroBenchmark::DoneCallback& callback) {
1266 return micro_benchmark_controller_.ScheduleRun(benchmark_name, callback); 1277 return micro_benchmark_controller_.ScheduleRun(benchmark_name, callback);
1267 } 1278 }
1268 1279
1269 } // namespace cc 1280 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698