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

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

Issue 2951853004: cc: Add CHECKS to diagnose invalid property tree indices on impl thread. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | no next file » | 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 23 matching lines...) Expand all
34 #include "cc/base/math_util.h" 34 #include "cc/base/math_util.h"
35 #include "cc/debug/rendering_stats_instrumentation.h" 35 #include "cc/debug/rendering_stats_instrumentation.h"
36 #include "cc/input/layer_selection_bound.h" 36 #include "cc/input/layer_selection_bound.h"
37 #include "cc/input/page_scale_animation.h" 37 #include "cc/input/page_scale_animation.h"
38 #include "cc/layers/heads_up_display_layer.h" 38 #include "cc/layers/heads_up_display_layer.h"
39 #include "cc/layers/heads_up_display_layer_impl.h" 39 #include "cc/layers/heads_up_display_layer_impl.h"
40 #include "cc/layers/layer.h" 40 #include "cc/layers/layer.h"
41 #include "cc/layers/painted_scrollbar_layer.h" 41 #include "cc/layers/painted_scrollbar_layer.h"
42 #include "cc/resources/ui_resource_manager.h" 42 #include "cc/resources/ui_resource_manager.h"
43 #include "cc/tiles/frame_viewer_instrumentation.h" 43 #include "cc/tiles/frame_viewer_instrumentation.h"
44 #include "cc/trees/clip_node.h"
44 #include "cc/trees/draw_property_utils.h" 45 #include "cc/trees/draw_property_utils.h"
45 #include "cc/trees/effect_node.h" 46 #include "cc/trees/effect_node.h"
46 #include "cc/trees/layer_tree_host_client.h" 47 #include "cc/trees/layer_tree_host_client.h"
47 #include "cc/trees/layer_tree_host_common.h" 48 #include "cc/trees/layer_tree_host_common.h"
48 #include "cc/trees/layer_tree_host_impl.h" 49 #include "cc/trees/layer_tree_host_impl.h"
49 #include "cc/trees/mutator_host.h" 50 #include "cc/trees/mutator_host.h"
50 #include "cc/trees/property_tree_builder.h" 51 #include "cc/trees/property_tree_builder.h"
51 #include "cc/trees/proxy_main.h" 52 #include "cc/trees/proxy_main.h"
53 #include "cc/trees/scroll_node.h"
52 #include "cc/trees/single_thread_proxy.h" 54 #include "cc/trees/single_thread_proxy.h"
53 #include "cc/trees/swap_promise_manager.h" 55 #include "cc/trees/swap_promise_manager.h"
54 #include "cc/trees/transform_node.h" 56 #include "cc/trees/transform_node.h"
55 #include "cc/trees/tree_synchronizer.h" 57 #include "cc/trees/tree_synchronizer.h"
56 #include "ui/gfx/geometry/size_conversions.h" 58 #include "ui/gfx/geometry/size_conversions.h"
57 #include "ui/gfx/geometry/vector2d_conversions.h" 59 #include "ui/gfx/geometry/vector2d_conversions.h"
58 60
59 namespace { 61 namespace {
60 static base::StaticAtomicSequenceNumber s_layer_tree_host_sequence_number; 62 static base::StaticAtomicSequenceNumber s_layer_tree_host_sequence_number;
61 } 63 }
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 sync_tree->UpdatePropertyTreeScrollingAndAnimationFromMainThread( 352 sync_tree->UpdatePropertyTreeScrollingAndAnimationFromMainThread(
351 is_impl_side_update); 353 is_impl_side_update);
352 354
353 TRACE_EVENT0("cc", "LayerTreeHostInProcess::AnimationHost::PushProperties"); 355 TRACE_EVENT0("cc", "LayerTreeHostInProcess::AnimationHost::PushProperties");
354 DCHECK(host_impl->mutator_host()); 356 DCHECK(host_impl->mutator_host());
355 mutator_host_->PushPropertiesTo(host_impl->mutator_host()); 357 mutator_host_->PushPropertiesTo(host_impl->mutator_host());
356 358
357 sync_tree->lifecycle().AdvanceTo(LayerTreeLifecycle::kNotSyncing); 359 sync_tree->lifecycle().AdvanceTo(LayerTreeLifecycle::kNotSyncing);
358 } 360 }
359 361
362 // Temporary check to debug crbug.com/726423. The property tree indices on the
363 // LayerTree should be valid after the PropertyTree update above.
364 for (auto* layer_impl : *sync_tree) {
365 CHECK(layer_impl);
366 CHECK(sync_tree->property_trees()->transform_tree.Node(
367 layer_impl->transform_tree_index()));
368 CHECK(sync_tree->property_trees()->clip_tree.Node(
369 layer_impl->clip_tree_index()));
370 CHECK(sync_tree->property_trees()->effect_tree.Node(
371 layer_impl->effect_tree_index()));
372 CHECK(sync_tree->property_trees()->scroll_tree.Node(
373 layer_impl->scroll_tree_index()));
374 }
375
360 // Transfer image decode requests to the impl thread. 376 // Transfer image decode requests to the impl thread.
361 for (auto& request : queued_image_decodes_) 377 for (auto& request : queued_image_decodes_)
362 host_impl->QueueImageDecode(std::move(request.first), request.second); 378 host_impl->QueueImageDecode(std::move(request.first), request.second);
363 queued_image_decodes_.clear(); 379 queued_image_decodes_.clear();
364 380
365 micro_benchmark_controller_.ScheduleImplBenchmarks(host_impl); 381 micro_benchmark_controller_.ScheduleImplBenchmarks(host_impl);
366 property_trees_.ResetAllChangeTracking(); 382 property_trees_.ResetAllChangeTracking();
367 } 383 }
368 384
369 void LayerTreeHost::PushPropertyTreesTo(LayerTreeImpl* tree_impl) { 385 void LayerTreeHost::PushPropertyTreesTo(LayerTreeImpl* tree_impl) {
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 TRACE_EVENT_INSTANT1( 737 TRACE_EVENT_INSTANT1(
722 "cc", "LayerTreeHostInProcess::UpdateLayers_BuiltPropertyTrees", 738 "cc", "LayerTreeHostInProcess::UpdateLayers_BuiltPropertyTrees",
723 TRACE_EVENT_SCOPE_THREAD, "property_trees", 739 TRACE_EVENT_SCOPE_THREAD, "property_trees",
724 property_trees->AsTracedValue()); 740 property_trees->AsTracedValue());
725 } else { 741 } else {
726 TRACE_EVENT_INSTANT1( 742 TRACE_EVENT_INSTANT1(
727 "cc", "LayerTreeHostInProcess::UpdateLayers_ReceivedPropertyTrees", 743 "cc", "LayerTreeHostInProcess::UpdateLayers_ReceivedPropertyTrees",
728 TRACE_EVENT_SCOPE_THREAD, "property_trees", 744 TRACE_EVENT_SCOPE_THREAD, "property_trees",
729 property_trees->AsTracedValue()); 745 property_trees->AsTracedValue());
730 } 746 }
747
748 // Temporary check to debug crbug.com/726423. The property tree indices on
749 // the LayerTreeImpl should be valid after all state synchronization has
750 // finished.
751 for (auto* layer : *this) {
752 CHECK(property_trees_.transform_tree.Node(layer->transform_tree_index()));
753 CHECK(property_trees_.clip_tree.Node(layer->clip_tree_index()));
754 CHECK(property_trees_.effect_tree.Node(layer->effect_tree_index()));
755 CHECK(property_trees_.scroll_tree.Node(layer->scroll_tree_index()));
756 }
757
731 draw_property_utils::UpdatePropertyTrees(this, property_trees); 758 draw_property_utils::UpdatePropertyTrees(this, property_trees);
732 draw_property_utils::FindLayersThatNeedUpdates(this, property_trees, 759 draw_property_utils::FindLayersThatNeedUpdates(this, property_trees,
733 &update_layer_list); 760 &update_layer_list);
734 } 761 }
735 762
736 bool content_is_suitable_for_gpu = true; 763 bool content_is_suitable_for_gpu = true;
737 bool did_paint_content = 764 bool did_paint_content =
738 PaintContent(update_layer_list, &content_is_suitable_for_gpu); 765 PaintContent(update_layer_list, &content_is_suitable_for_gpu);
739 766
740 if (content_is_suitable_for_gpu) { 767 if (content_is_suitable_for_gpu) {
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
1459 1486
1460 void LayerTreeHost::SetHasCopyRequest(bool has_copy_request) { 1487 void LayerTreeHost::SetHasCopyRequest(bool has_copy_request) {
1461 has_copy_request_ = has_copy_request; 1488 has_copy_request_ = has_copy_request;
1462 } 1489 }
1463 1490
1464 void LayerTreeHost::RequestBeginMainFrameNotExpected(bool new_state) { 1491 void LayerTreeHost::RequestBeginMainFrameNotExpected(bool new_state) {
1465 proxy_->RequestBeginMainFrameNotExpected(new_state); 1492 proxy_->RequestBeginMainFrameNotExpected(new_state);
1466 } 1493 }
1467 1494
1468 } // namespace cc 1495 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698