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

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

Issue 1413153014: Add a flag for enabling compositor property trees (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/trees/layer_tree_host_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 const LayerImpl* inner_viewport_scroll_layer, 72 const LayerImpl* inner_viewport_scroll_layer,
73 const LayerImpl* outer_viewport_scroll_layer, 73 const LayerImpl* outer_viewport_scroll_layer,
74 const gfx::Vector2dF& elastic_overscroll, 74 const gfx::Vector2dF& elastic_overscroll,
75 const LayerImpl* elastic_overscroll_application_layer, 75 const LayerImpl* elastic_overscroll_application_layer,
76 int max_texture_size, 76 int max_texture_size,
77 bool can_use_lcd_text, 77 bool can_use_lcd_text,
78 bool layers_always_allowed_lcd_text, 78 bool layers_always_allowed_lcd_text,
79 bool can_render_to_separate_surface, 79 bool can_render_to_separate_surface,
80 bool can_adjust_raster_scales, 80 bool can_adjust_raster_scales,
81 bool verify_property_trees, 81 bool verify_property_trees,
82 bool use_property_trees,
82 LayerImplList* render_surface_layer_list, 83 LayerImplList* render_surface_layer_list,
83 int current_render_surface_layer_list_id, 84 int current_render_surface_layer_list_id,
84 PropertyTrees* property_trees) 85 PropertyTrees* property_trees)
85 : root_layer(root_layer), 86 : root_layer(root_layer),
86 device_viewport_size(device_viewport_size), 87 device_viewport_size(device_viewport_size),
87 device_transform(device_transform), 88 device_transform(device_transform),
88 device_scale_factor(device_scale_factor), 89 device_scale_factor(device_scale_factor),
89 page_scale_factor(page_scale_factor), 90 page_scale_factor(page_scale_factor),
90 page_scale_layer(page_scale_layer), 91 page_scale_layer(page_scale_layer),
91 inner_viewport_scroll_layer(inner_viewport_scroll_layer), 92 inner_viewport_scroll_layer(inner_viewport_scroll_layer),
92 outer_viewport_scroll_layer(outer_viewport_scroll_layer), 93 outer_viewport_scroll_layer(outer_viewport_scroll_layer),
93 elastic_overscroll(elastic_overscroll), 94 elastic_overscroll(elastic_overscroll),
94 elastic_overscroll_application_layer( 95 elastic_overscroll_application_layer(
95 elastic_overscroll_application_layer), 96 elastic_overscroll_application_layer),
96 max_texture_size(max_texture_size), 97 max_texture_size(max_texture_size),
97 can_use_lcd_text(can_use_lcd_text), 98 can_use_lcd_text(can_use_lcd_text),
98 layers_always_allowed_lcd_text(layers_always_allowed_lcd_text), 99 layers_always_allowed_lcd_text(layers_always_allowed_lcd_text),
99 can_render_to_separate_surface(can_render_to_separate_surface), 100 can_render_to_separate_surface(can_render_to_separate_surface),
100 can_adjust_raster_scales(can_adjust_raster_scales), 101 can_adjust_raster_scales(can_adjust_raster_scales),
101 verify_property_trees(verify_property_trees), 102 verify_property_trees(verify_property_trees),
103 use_property_trees(use_property_trees),
102 render_surface_layer_list(render_surface_layer_list), 104 render_surface_layer_list(render_surface_layer_list),
103 current_render_surface_layer_list_id( 105 current_render_surface_layer_list_id(
104 current_render_surface_layer_list_id), 106 current_render_surface_layer_list_id),
105 property_trees(property_trees) {} 107 property_trees(property_trees) {}
106 108
107 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting:: 109 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting::
108 CalcDrawPropsImplInputsForTesting(LayerImpl* root_layer, 110 CalcDrawPropsImplInputsForTesting(LayerImpl* root_layer,
109 const gfx::Size& device_viewport_size, 111 const gfx::Size& device_viewport_size,
110 const gfx::Transform& device_transform, 112 const gfx::Transform& device_transform,
111 LayerImplList* render_surface_layer_list) 113 LayerImplList* render_surface_layer_list)
112 : CalcDrawPropsImplInputs(root_layer, 114 : CalcDrawPropsImplInputs(root_layer,
113 device_viewport_size, 115 device_viewport_size,
114 device_transform, 116 device_transform,
115 1.f, 117 1.f,
116 1.f, 118 1.f,
117 NULL, 119 NULL,
118 NULL, 120 NULL,
119 NULL, 121 NULL,
120 gfx::Vector2dF(), 122 gfx::Vector2dF(),
121 NULL, 123 NULL,
122 std::numeric_limits<int>::max() / 2, 124 std::numeric_limits<int>::max() / 2,
123 false, 125 false,
124 false, 126 false,
125 true, 127 true,
126 false, 128 false,
127 true, 129 true,
130 false,
128 render_surface_layer_list, 131 render_surface_layer_list,
129 0, 132 0,
130 GetPropertyTrees(root_layer)) { 133 GetPropertyTrees(root_layer)) {
131 DCHECK(root_layer); 134 DCHECK(root_layer);
132 DCHECK(render_surface_layer_list); 135 DCHECK(render_surface_layer_list);
133 } 136 }
134 137
135 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting:: 138 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting::
136 CalcDrawPropsImplInputsForTesting(LayerImpl* root_layer, 139 CalcDrawPropsImplInputsForTesting(LayerImpl* root_layer,
137 const gfx::Size& device_viewport_size, 140 const gfx::Size& device_viewport_size,
(...skipping 2290 matching lines...) Expand 10 before | Expand all | Expand 10 after
2428 void CalculateRenderSurfaceLayerListInternal( 2431 void CalculateRenderSurfaceLayerListInternal(
2429 LayerImpl* layer, 2432 LayerImpl* layer,
2430 PropertyTrees* property_trees, 2433 PropertyTrees* property_trees,
2431 LayerImplList* render_surface_layer_list, 2434 LayerImplList* render_surface_layer_list,
2432 LayerImplList* descendants, 2435 LayerImplList* descendants,
2433 RenderSurfaceImpl* nearest_occlusion_immune_ancestor, 2436 RenderSurfaceImpl* nearest_occlusion_immune_ancestor,
2434 bool subtree_visible_from_ancestor, 2437 bool subtree_visible_from_ancestor,
2435 const bool can_render_to_separate_surface, 2438 const bool can_render_to_separate_surface,
2436 const int current_render_surface_layer_list_id, 2439 const int current_render_surface_layer_list_id,
2437 const int max_texture_size, 2440 const int max_texture_size,
2438 const bool verify_property_trees) { 2441 const bool verify_property_trees,
2442 const bool use_property_trees) {
2439 // This calculates top level Render Surface Layer List, and Layer List for all 2443 // This calculates top level Render Surface Layer List, and Layer List for all
2440 // Render Surfaces. 2444 // Render Surfaces.
2441 2445
2442 // |layer| is current layer. 2446 // |layer| is current layer.
2443 2447
2444 // |render_surface_layer_list| is the top level RenderSurfaceLayerList. 2448 // |render_surface_layer_list| is the top level RenderSurfaceLayerList.
2445 2449
2446 // |descendants| is used to determine what's in current layer's render 2450 // |descendants| is used to determine what's in current layer's render
2447 // surface's layer list. 2451 // surface's layer list.
2448 2452
(...skipping 24 matching lines...) Expand all
2473 (can_render_to_separate_surface && layer->render_surface()); 2477 (can_render_to_separate_surface && layer->render_surface());
2474 2478
2475 if (render_to_separate_surface) { 2479 if (render_to_separate_surface) {
2476 DCHECK(layer->render_surface()); 2480 DCHECK(layer->render_surface());
2477 if (!layer->double_sided() && 2481 if (!layer->double_sided() &&
2478 IsSurfaceBackFaceVisible(layer, layer->draw_transform())) { 2482 IsSurfaceBackFaceVisible(layer, layer->draw_transform())) {
2479 layer->ClearRenderSurfaceLayerList(); 2483 layer->ClearRenderSurfaceLayerList();
2480 layer->draw_properties().render_target = nullptr; 2484 layer->draw_properties().render_target = nullptr;
2481 return; 2485 return;
2482 } 2486 }
2487
2488 if (use_property_trees) {
2489 RenderSurfaceDrawProperties draw_properties;
2490 ComputeSurfaceDrawPropertiesUsingPropertyTrees(
2491 layer->render_surface(), property_trees, &draw_properties);
2492 // TODO(ajuma): Once property tree verification is removed, make the above
2493 // call directly set the surface's properties, so that the copying below
2494 // is no longer needed.
2495 layer->render_surface()->SetIsClipped(draw_properties.is_clipped);
2496 layer->render_surface()->SetDrawOpacity(draw_properties.draw_opacity);
2497 layer->render_surface()->SetDrawTransform(draw_properties.draw_transform);
2498 layer->render_surface()->SetScreenSpaceTransform(
2499 draw_properties.screen_space_transform);
2500 layer->render_surface()->SetReplicaDrawTransform(
2501 draw_properties.replica_draw_transform);
2502 layer->render_surface()->SetReplicaScreenSpaceTransform(
2503 draw_properties.replica_screen_space_transform);
2504 layer->render_surface()->SetClipRect(draw_properties.clip_rect);
2505 }
2506
2483 if (IsRootLayer(layer)) { 2507 if (IsRootLayer(layer)) {
2484 // The root surface does not contribute to any other surface, it has no 2508 // The root surface does not contribute to any other surface, it has no
2485 // target. 2509 // target.
2486 layer->render_surface()->set_contributes_to_drawn_surface(false); 2510 layer->render_surface()->set_contributes_to_drawn_surface(false);
2487 } else { 2511 } else {
2488 // Even if the |layer_is_drawn|, it only contributes to a drawn surface 2512 // Even if the |layer_is_drawn|, it only contributes to a drawn surface
2489 // when the |layer_is_visible|. 2513 // when the |layer_is_visible|.
2490 layer->render_surface()->set_contributes_to_drawn_surface( 2514 layer->render_surface()->set_contributes_to_drawn_surface(
2491 layer_is_visible); 2515 layer_is_visible);
2492 } 2516 }
(...skipping 21 matching lines...) Expand all
2514 2538
2515 size_t descendants_size = descendants->size(); 2539 size_t descendants_size = descendants->size();
2516 2540
2517 bool layer_should_be_skipped = LayerShouldBeSkipped(layer, layer_is_drawn); 2541 bool layer_should_be_skipped = LayerShouldBeSkipped(layer, layer_is_drawn);
2518 if (!layer_should_be_skipped) { 2542 if (!layer_should_be_skipped) {
2519 MarkLayerWithRenderSurfaceLayerListId(layer, 2543 MarkLayerWithRenderSurfaceLayerListId(layer,
2520 current_render_surface_layer_list_id); 2544 current_render_surface_layer_list_id);
2521 descendants->push_back(layer); 2545 descendants->push_back(layer);
2522 } 2546 }
2523 2547
2548 bool compute_content_rects = verify_property_trees || use_property_trees;
2549
2524 // Clear the old accumulated content rect of surface. 2550 // Clear the old accumulated content rect of surface.
2525 if (verify_property_trees && render_to_separate_surface) 2551 if (compute_content_rects && render_to_separate_surface)
2526 layer->render_surface()->SetAccumulatedContentRect(gfx::Rect()); 2552 layer->render_surface()->SetAccumulatedContentRect(gfx::Rect());
2527 2553
2528 for (auto& child_layer : layer->children()) { 2554 for (auto& child_layer : layer->children()) {
2529 CalculateRenderSurfaceLayerListInternal( 2555 CalculateRenderSurfaceLayerListInternal(
2530 child_layer, property_trees, render_surface_layer_list, descendants, 2556 child_layer, property_trees, render_surface_layer_list, descendants,
2531 nearest_occlusion_immune_ancestor, layer_is_drawn, 2557 nearest_occlusion_immune_ancestor, layer_is_drawn,
2532 can_render_to_separate_surface, current_render_surface_layer_list_id, 2558 can_render_to_separate_surface, current_render_surface_layer_list_id,
2533 max_texture_size, verify_property_trees); 2559 max_texture_size, verify_property_trees, use_property_trees);
2534 2560
2535 // If the child is its own render target, then it has a render surface. 2561 // If the child is its own render target, then it has a render surface.
2536 if (child_layer->render_target() == child_layer && 2562 if (child_layer->render_target() == child_layer &&
2537 !child_layer->render_surface()->layer_list().empty() && 2563 !child_layer->render_surface()->layer_list().empty() &&
2538 !child_layer->render_surface()->content_rect().IsEmpty()) { 2564 !child_layer->render_surface()->content_rect().IsEmpty()) {
2539 // This child will contribute its render surface, which means 2565 // This child will contribute its render surface, which means
2540 // we need to mark just the mask layer (and replica mask layer) 2566 // we need to mark just the mask layer (and replica mask layer)
2541 // with the id. 2567 // with the id.
2542 MarkMasksWithRenderSurfaceLayerListId( 2568 MarkMasksWithRenderSurfaceLayerListId(
2543 child_layer, current_render_surface_layer_list_id); 2569 child_layer, current_render_surface_layer_list_id);
2544 descendants->push_back(child_layer); 2570 descendants->push_back(child_layer);
2545 } 2571 }
2546 2572
2547 if (child_layer->layer_or_descendant_is_drawn()) { 2573 if (child_layer->layer_or_descendant_is_drawn()) {
2548 bool layer_or_descendant_is_drawn = true; 2574 bool layer_or_descendant_is_drawn = true;
2549 layer->set_layer_or_descendant_is_drawn(layer_or_descendant_is_drawn); 2575 layer->set_layer_or_descendant_is_drawn(layer_or_descendant_is_drawn);
2550 } 2576 }
2551 } 2577 }
2552 2578
2553 if (render_to_separate_surface && !IsRootLayer(layer) && 2579 if (render_to_separate_surface && !IsRootLayer(layer) &&
2554 layer->render_surface()->layer_list().empty()) { 2580 layer->render_surface()->layer_list().empty()) {
2555 RemoveSurfaceForEarlyExit(layer, render_surface_layer_list); 2581 RemoveSurfaceForEarlyExit(layer, render_surface_layer_list);
2556 return; 2582 return;
2557 } 2583 }
2558 2584
2559 // The render surface's content rect is the union of drawable content rects 2585 // The render surface's content rect is the union of drawable content rects
2560 // of the layers that draw into the surface. If the render surface is clipped, 2586 // of the layers that draw into the surface. If the render surface is clipped,
2561 // it is also intersected with the render's surface clip rect. 2587 // it is also intersected with the render's surface clip rect.
2562 if (verify_property_trees) { 2588 if (compute_content_rects) {
2563 if (!IsRootLayer(layer)) { 2589 if (!IsRootLayer(layer)) {
2564 if (render_to_separate_surface) { 2590 if (render_to_separate_surface) {
2565 gfx::Rect surface_content_rect = 2591 gfx::Rect surface_content_rect =
2566 layer->render_surface()->accumulated_content_rect(); 2592 layer->render_surface()->accumulated_content_rect();
2567 // If the owning layer of a render surface draws content, the content 2593 // If the owning layer of a render surface draws content, the content
2568 // rect of the render surface is expanded to include the drawable 2594 // rect of the render surface is expanded to include the drawable
2569 // content rect of the layer. 2595 // content rect of the layer.
2570 if (layer->DrawsContent()) 2596 if (layer->DrawsContent())
2571 surface_content_rect.Union(layer->drawable_content_rect()); 2597 surface_content_rect.Union(layer->drawable_content_rect());
2572 2598
(...skipping 10 matching lines...) Expand all
2583 layer->render_surface()->draw_transform()); 2609 layer->render_surface()->draw_transform());
2584 surface_content_rect.Intersect(surface_clip_rect); 2610 surface_content_rect.Intersect(surface_clip_rect);
2585 } 2611 }
2586 } 2612 }
2587 // The RenderSurfaceImpl backing texture cannot exceed the maximum 2613 // The RenderSurfaceImpl backing texture cannot exceed the maximum
2588 // supported texture size. 2614 // supported texture size.
2589 surface_content_rect.set_width( 2615 surface_content_rect.set_width(
2590 std::min(surface_content_rect.width(), max_texture_size)); 2616 std::min(surface_content_rect.width(), max_texture_size));
2591 surface_content_rect.set_height( 2617 surface_content_rect.set_height(
2592 std::min(surface_content_rect.height(), max_texture_size)); 2618 std::min(surface_content_rect.height(), max_texture_size));
2593 layer->render_surface()->SetContentRectFromPropertyTrees( 2619 if (use_property_trees)
2594 surface_content_rect); 2620 layer->render_surface()->SetContentRect(surface_content_rect);
2621 if (verify_property_trees) {
2622 layer->render_surface()->SetContentRectFromPropertyTrees(
2623 surface_content_rect);
2624 }
2595 } 2625 }
2596 const LayerImpl* parent_target = layer->parent()->render_target(); 2626 const LayerImpl* parent_target = layer->parent()->render_target();
2597 if (!IsRootLayer(parent_target)) { 2627 if (!IsRootLayer(parent_target)) {
2598 gfx::Rect surface_content_rect = 2628 gfx::Rect surface_content_rect =
2599 parent_target->render_surface()->accumulated_content_rect(); 2629 parent_target->render_surface()->accumulated_content_rect();
2600 if (render_to_separate_surface) { 2630 if (render_to_separate_surface) {
2601 // If the layer owns a surface, then the content rect is in the wrong 2631 // If the layer owns a surface, then the content rect is in the wrong
2602 // space. Instead, we will use the surface's DrawableContentRect which 2632 // space. Instead, we will use the surface's DrawableContentRect which
2603 // is in target space as required. We also need to clip it with the 2633 // is in target space as required. We also need to clip it with the
2604 // target's clip if the target is clipped. 2634 // target's clip if the target is clipped.
2605 surface_content_rect.Union(gfx::ToEnclosedRect( 2635 surface_content_rect.Union(gfx::ToEnclosedRect(
2606 layer->render_surface()->DrawableContentRect())); 2636 layer->render_surface()->DrawableContentRect()));
2607 if (parent_target->is_clipped()) 2637 if (parent_target->is_clipped())
2608 surface_content_rect.Intersect(parent_target->clip_rect()); 2638 surface_content_rect.Intersect(parent_target->clip_rect());
2609 } else if (layer->DrawsContent()) { 2639 } else if (layer->DrawsContent()) {
2610 surface_content_rect.Union(layer->drawable_content_rect()); 2640 surface_content_rect.Union(layer->drawable_content_rect());
2611 } 2641 }
2612 parent_target->render_surface()->SetAccumulatedContentRect( 2642 parent_target->render_surface()->SetAccumulatedContentRect(
2613 surface_content_rect); 2643 surface_content_rect);
2614 } 2644 }
2615 } else { 2645 } else {
2616 // The root layer's surface content rect is always the entire viewport. 2646 // The root layer's surface content rect is always the entire viewport.
2617 gfx::Rect viewport = 2647 gfx::Rect viewport =
2618 gfx::ToEnclosingRect(property_trees->clip_tree.ViewportClip()); 2648 gfx::ToEnclosingRect(property_trees->clip_tree.ViewportClip());
2619 layer->render_surface()->SetContentRectFromPropertyTrees(viewport); 2649 if (use_property_trees)
2650 layer->render_surface()->SetContentRect(viewport);
2651 if (verify_property_trees)
2652 layer->render_surface()->SetContentRectFromPropertyTrees(viewport);
2620 } 2653 }
2621 } 2654 }
2622 2655
2623 if (render_to_separate_surface && !IsRootLayer(layer) && 2656 if (render_to_separate_surface && !IsRootLayer(layer) &&
2624 layer->render_surface()->DrawableContentRect().IsEmpty()) { 2657 layer->render_surface()->DrawableContentRect().IsEmpty()) {
2625 RemoveSurfaceForEarlyExit(layer, render_surface_layer_list); 2658 RemoveSurfaceForEarlyExit(layer, render_surface_layer_list);
2626 return; 2659 return;
2627 } 2660 }
2628 2661
2629 // If neither this layer nor any of its children were added, early out. 2662 // If neither this layer nor any of its children were added, early out.
(...skipping 16 matching lines...) Expand all
2646 } 2679 }
2647 2680
2648 void CalculateRenderSurfaceLayerList( 2681 void CalculateRenderSurfaceLayerList(
2649 LayerTreeHostCommon::CalcDrawPropsImplInputs* inputs) { 2682 LayerTreeHostCommon::CalcDrawPropsImplInputs* inputs) {
2650 const bool subtree_visible_from_ancestor = true; 2683 const bool subtree_visible_from_ancestor = true;
2651 CalculateRenderSurfaceLayerListInternal( 2684 CalculateRenderSurfaceLayerListInternal(
2652 inputs->root_layer, inputs->property_trees, 2685 inputs->root_layer, inputs->property_trees,
2653 inputs->render_surface_layer_list, nullptr, nullptr, 2686 inputs->render_surface_layer_list, nullptr, nullptr,
2654 subtree_visible_from_ancestor, inputs->can_render_to_separate_surface, 2687 subtree_visible_from_ancestor, inputs->can_render_to_separate_surface,
2655 inputs->current_render_surface_layer_list_id, inputs->max_texture_size, 2688 inputs->current_render_surface_layer_list_id, inputs->max_texture_size,
2656 inputs->verify_property_trees); 2689 inputs->verify_property_trees, inputs->use_property_trees);
2690 }
2691
2692 static void ComputeMaskLayerDrawProperties(const LayerImpl* layer,
2693 LayerImpl* mask_layer) {
2694 DrawProperties& mask_layer_draw_properties = mask_layer->draw_properties();
2695 mask_layer_draw_properties.visible_layer_rect = gfx::Rect(layer->bounds());
2696 mask_layer_draw_properties.target_space_transform = layer->draw_transform();
2697 mask_layer_draw_properties.maximum_animation_contents_scale =
2698 layer->draw_properties().maximum_animation_contents_scale;
2699 mask_layer_draw_properties.starting_animation_contents_scale =
2700 layer->draw_properties().starting_animation_contents_scale;
2657 } 2701 }
2658 2702
2659 void CalculateDrawPropertiesAndVerify( 2703 void CalculateDrawPropertiesAndVerify(
2660 LayerTreeHostCommon::CalcDrawPropsImplInputs* inputs, 2704 LayerTreeHostCommon::CalcDrawPropsImplInputs* inputs,
2661 PropertyTreeOption property_tree_option) { 2705 PropertyTreeOption property_tree_option) {
2662 SubtreeGlobals globals;
2663 DataForRecursion data_for_recursion;
2664 inputs->render_surface_layer_list->clear(); 2706 inputs->render_surface_layer_list->clear();
2665 2707
2666 ProcessCalcDrawPropsInputs(*inputs, &globals, &data_for_recursion);
2667 UpdateMetaInformationSequenceNumber(inputs->root_layer); 2708 UpdateMetaInformationSequenceNumber(inputs->root_layer);
2668 PreCalculateMetaInformationRecursiveData recursive_data; 2709 PreCalculateMetaInformationRecursiveData recursive_data;
2669 PreCalculateMetaInformationInternal(inputs->root_layer, &recursive_data); 2710 PreCalculateMetaInformationInternal(inputs->root_layer, &recursive_data);
2670 2711
2671 const bool should_measure_property_tree_performance = 2712 const bool should_measure_property_tree_performance =
2672 inputs->verify_property_trees && 2713 inputs->verify_property_trees &&
2673 (property_tree_option == BUILD_PROPERTY_TREES_IF_NEEDED); 2714 (property_tree_option == BUILD_PROPERTY_TREES_IF_NEEDED);
2674 2715
2675 if (inputs->verify_property_trees) { 2716 LayerImplList visible_layer_list;
2676 LayerImplList update_layer_list; 2717 if (inputs->verify_property_trees || inputs->use_property_trees) {
2677
2678 switch (property_tree_option) { 2718 switch (property_tree_option) {
2679 case BUILD_PROPERTY_TREES_IF_NEEDED: { 2719 case BUILD_PROPERTY_TREES_IF_NEEDED: {
2680 // The translation from layer to property trees is an intermediate 2720 // The translation from layer to property trees is an intermediate
2681 // state. We will eventually get these data passed directly to the 2721 // state. We will eventually get these data passed directly to the
2682 // compositor. 2722 // compositor.
2683 if (should_measure_property_tree_performance) { 2723 if (should_measure_property_tree_performance) {
2684 TRACE_EVENT_BEGIN0( 2724 TRACE_EVENT_BEGIN0(
2685 TRACE_DISABLED_BY_DEFAULT("cc.debug.cdp-perf"), 2725 TRACE_DISABLED_BY_DEFAULT("cc.debug.cdp-perf"),
2686 "LayerTreeHostCommon::ComputeVisibleRectsWithPropertyTrees"); 2726 "LayerTreeHostCommon::ComputeVisibleRectsWithPropertyTrees");
2687 } 2727 }
2688 2728
2689 BuildPropertyTreesAndComputeVisibleRects( 2729 BuildPropertyTreesAndComputeVisibleRects(
2690 inputs->root_layer, inputs->page_scale_layer, 2730 inputs->root_layer, inputs->page_scale_layer,
2691 inputs->inner_viewport_scroll_layer, 2731 inputs->inner_viewport_scroll_layer,
2692 inputs->outer_viewport_scroll_layer, inputs->page_scale_factor, 2732 inputs->outer_viewport_scroll_layer, inputs->page_scale_factor,
2693 inputs->device_scale_factor, 2733 inputs->device_scale_factor,
2694 gfx::Rect(inputs->device_viewport_size), inputs->device_transform, 2734 gfx::Rect(inputs->device_viewport_size), inputs->device_transform,
2695 inputs->can_render_to_separate_surface, inputs->property_trees, 2735 inputs->can_render_to_separate_surface, inputs->property_trees,
2696 &update_layer_list); 2736 &visible_layer_list);
2697 2737
2698 if (should_measure_property_tree_performance) { 2738 if (should_measure_property_tree_performance) {
2699 TRACE_EVENT_END0( 2739 TRACE_EVENT_END0(
2700 TRACE_DISABLED_BY_DEFAULT("cc.debug.cdp-perf"), 2740 TRACE_DISABLED_BY_DEFAULT("cc.debug.cdp-perf"),
2701 "LayerTreeHostCommon::ComputeVisibleRectsWithPropertyTrees"); 2741 "LayerTreeHostCommon::ComputeVisibleRectsWithPropertyTrees");
2702 } 2742 }
2703 2743
2704 break; 2744 break;
2705 } 2745 }
2706 case DONT_BUILD_PROPERTY_TREES: { 2746 case DONT_BUILD_PROPERTY_TREES: {
(...skipping 11 matching lines...) Expand all
2718 // Similarly, the device viewport and device transform are shared 2758 // Similarly, the device viewport and device transform are shared
2719 // by both trees. 2759 // by both trees.
2720 inputs->property_trees->clip_tree.SetViewportClip( 2760 inputs->property_trees->clip_tree.SetViewportClip(
2721 gfx::RectF(gfx::SizeF(inputs->device_viewport_size))); 2761 gfx::RectF(gfx::SizeF(inputs->device_viewport_size)));
2722 inputs->property_trees->transform_tree.SetDeviceTransform( 2762 inputs->property_trees->transform_tree.SetDeviceTransform(
2723 inputs->device_transform, inputs->root_layer->position()); 2763 inputs->device_transform, inputs->root_layer->position());
2724 inputs->property_trees->transform_tree.SetDeviceTransformScaleFactor( 2764 inputs->property_trees->transform_tree.SetDeviceTransformScaleFactor(
2725 inputs->device_transform); 2765 inputs->device_transform);
2726 ComputeVisibleRectsUsingPropertyTrees( 2766 ComputeVisibleRectsUsingPropertyTrees(
2727 inputs->root_layer, inputs->property_trees, 2767 inputs->root_layer, inputs->property_trees,
2728 inputs->can_render_to_separate_surface, &update_layer_list); 2768 inputs->can_render_to_separate_surface, &visible_layer_list);
2729 break; 2769 break;
2730 } 2770 }
2731 } 2771 }
2732 } 2772 }
2733 2773
2734 if (should_measure_property_tree_performance) { 2774 if (should_measure_property_tree_performance) {
2735 TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("cc.debug.cdp-perf"), 2775 TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("cc.debug.cdp-perf"),
2736 "LayerTreeHostCommon::CalculateDrawProperties"); 2776 "LayerTreeHostCommon::CalculateDrawProperties");
2737 } 2777 }
2738 2778
2739 std::vector<AccumulatedSurfaceState> accumulated_surface_state; 2779 std::vector<AccumulatedSurfaceState> accumulated_surface_state;
2740 CalculateRenderTarget(inputs); 2780 CalculateRenderTarget(inputs);
2741 CalculateDrawPropertiesInternal(inputs->root_layer, globals, 2781 if (inputs->use_property_trees) {
2742 data_for_recursion, 2782 for (LayerImpl* layer : visible_layer_list) {
2743 &accumulated_surface_state); 2783 ComputeLayerDrawPropertiesUsingPropertyTrees(
2784 layer, inputs->property_trees, inputs->layers_always_allowed_lcd_text,
2785 inputs->can_use_lcd_text, &layer->draw_properties());
2786 if (layer->mask_layer())
2787 ComputeMaskLayerDrawProperties(layer, layer->mask_layer());
2788 LayerImpl* replica_mask_layer = layer->replica_layer()
2789 ? layer->replica_layer()->mask_layer()
2790 : nullptr;
2791 if (replica_mask_layer)
2792 ComputeMaskLayerDrawProperties(layer, replica_mask_layer);
2793 }
2794 } else {
2795 SubtreeGlobals globals;
2796 DataForRecursion data_for_recursion;
2797 ProcessCalcDrawPropsInputs(*inputs, &globals, &data_for_recursion);
2798 CalculateDrawPropertiesInternal(inputs->root_layer, globals,
2799 data_for_recursion,
2800 &accumulated_surface_state);
2801 }
2744 CalculateRenderSurfaceLayerList(inputs); 2802 CalculateRenderSurfaceLayerList(inputs);
2745 2803
2746 if (should_measure_property_tree_performance) { 2804 if (should_measure_property_tree_performance) {
2747 TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("cc.debug.cdp-perf"), 2805 TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("cc.debug.cdp-perf"),
2748 "LayerTreeHostCommon::CalculateDrawProperties"); 2806 "LayerTreeHostCommon::CalculateDrawProperties");
2749 } 2807 }
2750 2808
2751 if (inputs->verify_property_trees) 2809 if (inputs->verify_property_trees)
2752 VerifyPropertyTreeValues(inputs); 2810 VerifyPropertyTreeValues(inputs);
2753 2811
(...skipping 30 matching lines...) Expand all
2784 2842
2785 PropertyTrees* GetPropertyTrees(Layer* layer) { 2843 PropertyTrees* GetPropertyTrees(Layer* layer) {
2786 return layer->layer_tree_host()->property_trees(); 2844 return layer->layer_tree_host()->property_trees();
2787 } 2845 }
2788 2846
2789 PropertyTrees* GetPropertyTrees(LayerImpl* layer) { 2847 PropertyTrees* GetPropertyTrees(LayerImpl* layer) {
2790 return layer->layer_tree_impl()->property_trees(); 2848 return layer->layer_tree_impl()->property_trees();
2791 } 2849 }
2792 2850
2793 } // namespace cc 2851 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698