Skip to content

Commit

Permalink
cc: Main thread skip single layers instead of subtrees
Browse files Browse the repository at this point in the history
This is a mirror change of issue 1811423002 on the main
thread. After getting rid of tree hierarchy in LayerTreeHost,
we won't be able to skip subtrees, instead we skip every
single layer.

The behavior remains unchanged: a layer is skipped when it
meets the legacy subtree-skipping criteria or one of its
ancestors meets.

The follow-up patch will remove CallFunctionForEveryLayer and
use the iterator instead.

BUG=600509
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel

Review URL: https://codereview.chromium.org/1864183002

Cr-Commit-Position: refs/heads/master@{#386083}
  • Loading branch information
sunxd authored and Commit bot committed Apr 8, 2016
1 parent 5f90425 commit 0f10629
Show file tree
Hide file tree
Showing 21 changed files with 259 additions and 192 deletions.
9 changes: 6 additions & 3 deletions cc/debug/debug_rect_history.cc
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ void DebugRectHistory::SaveScreenSpaceRects(
void DebugRectHistory::SaveTouchEventHandlerRects(LayerTreeImpl* tree_impl) {
LayerTreeHostCommon::CallFunctionForEveryLayer(
tree_impl,
[this](LayerImpl* layer) { SaveTouchEventHandlerRectsCallback(layer); });
[this](LayerImpl* layer) { SaveTouchEventHandlerRectsCallback(layer); },
CallFunctionLayerType::ALL_LAYERS);
}

void DebugRectHistory::SaveTouchEventHandlerRectsCallback(LayerImpl* layer) {
Expand Down Expand Up @@ -199,7 +200,8 @@ void DebugRectHistory::SaveWheelEventHandlerRects(LayerImpl* root_layer) {
void DebugRectHistory::SaveScrollEventHandlerRects(LayerTreeImpl* tree_impl) {
LayerTreeHostCommon::CallFunctionForEveryLayer(
tree_impl,
[this](LayerImpl* layer) { SaveScrollEventHandlerRectsCallback(layer); });
[this](LayerImpl* layer) { SaveScrollEventHandlerRectsCallback(layer); },
CallFunctionLayerType::ALL_LAYERS);
}

void DebugRectHistory::SaveScrollEventHandlerRectsCallback(LayerImpl* layer) {
Expand All @@ -215,7 +217,8 @@ void DebugRectHistory::SaveScrollEventHandlerRectsCallback(LayerImpl* layer) {
void DebugRectHistory::SaveNonFastScrollableRects(LayerTreeImpl* tree_impl) {
LayerTreeHostCommon::CallFunctionForEveryLayer(
tree_impl,
[this](LayerImpl* layer) { SaveNonFastScrollableRectsCallback(layer); });
[this](LayerImpl* layer) { SaveNonFastScrollableRectsCallback(layer); },
CallFunctionLayerType::ALL_LAYERS);
}

void DebugRectHistory::SaveNonFastScrollableRectsCallback(LayerImpl* layer) {
Expand Down
3 changes: 2 additions & 1 deletion cc/debug/invalidation_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ InvalidationBenchmark::~InvalidationBenchmark() {

void InvalidationBenchmark::DidUpdateLayers(LayerTreeHost* host) {
LayerTreeHostCommon::CallFunctionForEveryLayer(
host, [this](Layer* layer) { layer->RunMicroBenchmark(this); });
host, [this](Layer* layer) { layer->RunMicroBenchmark(this); },
CallFunctionLayerType::ALL_LAYERS);
}

void InvalidationBenchmark::RunOnLayer(PictureLayer* layer) {
Expand Down
3 changes: 2 additions & 1 deletion cc/debug/rasterize_and_record_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ RasterizeAndRecordBenchmark::~RasterizeAndRecordBenchmark() {
void RasterizeAndRecordBenchmark::DidUpdateLayers(LayerTreeHost* host) {
host_ = host;
LayerTreeHostCommon::CallFunctionForEveryLayer(
host, [this](Layer* layer) { layer->RunMicroBenchmark(this); });
host, [this](Layer* layer) { layer->RunMicroBenchmark(this); },
CallFunctionLayerType::ALL_LAYERS);

DCHECK(!results_.get());
results_ = make_scoped_ptr(new base::DictionaryValue);
Expand Down
6 changes: 4 additions & 2 deletions cc/debug/rasterize_and_record_benchmark_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,12 @@ RasterizeAndRecordBenchmarkImpl::~RasterizeAndRecordBenchmarkImpl() {}
void RasterizeAndRecordBenchmarkImpl::DidCompleteCommit(
LayerTreeHostImpl* host) {
LayerTreeHostCommon::CallFunctionForEveryLayer(
host->active_tree(), [this](LayerImpl* layer) {
host->active_tree(),
[this](LayerImpl* layer) {
rasterize_results_.total_layers++;
layer->RunMicroBenchmark(this);
});
},
CallFunctionLayerType::ALL_LAYERS);

scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue());
result->SetDouble("rasterize_time_ms",
Expand Down
1 change: 1 addition & 0 deletions cc/layers/layer_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class CC_EXPORT LayerImpl {
void OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset);
void OnTransformIsPotentiallyAnimatingChanged(bool is_animating);
bool IsActive() const;
bool OpacityCanAnimateOnImplThread() const { return false; }

// Tree structure.
LayerImpl* parent() { return parent_; }
Expand Down
3 changes: 2 additions & 1 deletion cc/layers/layer_proto_converter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ void LayerProtoConverter::RecursivelyFindAllLayers(Layer* root_layer,
LayerIdMap* layer_id_map) {
LayerTreeHostCommon::CallFunctionForEveryLayer(
root_layer->layer_tree_host(),
[layer_id_map](Layer* layer) { (*layer_id_map)[layer->id()] = layer; });
[layer_id_map](Layer* layer) { (*layer_id_map)[layer->id()] = layer; },
CallFunctionLayerType::ALL_LAYERS);
}

// static
Expand Down
2 changes: 1 addition & 1 deletion cc/layers/layer_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ bool HasTransformAnimationThatInflatesBounds(const LayerImpl& layer) {
}

inline bool HasAncestorTransformAnimation(const TransformNode* transform_node) {
return transform_node->data.to_screen_is_animated;
return transform_node->data.to_screen_is_potentially_animated;
}

inline bool HasAncestorFilterAnimation(const LayerImpl& layer) {
Expand Down
2 changes: 1 addition & 1 deletion cc/proto/property_tree.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ message TranformNodeData {
optional bool is_invertible = 13;
optional bool ancestors_are_invertible = 14;
optional bool is_animated = 15;
optional bool to_screen_is_animated = 16;
optional bool to_screen_is_potentially_animated = 16;
optional bool has_only_translation_animations = 17;
optional bool to_screen_has_scale_animation = 18;
optional bool flattens_inherited_transform = 19;
Expand Down
4 changes: 2 additions & 2 deletions cc/test/layer_tree_host_common_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ void LayerTreeHostCommonTestBase::
draw_property_utils::UpdatePropertyTrees(property_trees,
can_render_to_separate_surface);
draw_property_utils::FindLayersThatNeedUpdates(
root_layer, property_trees->transform_tree, property_trees->effect_tree,
&update_layer_list_);
root_layer->layer_tree_host(), property_trees->transform_tree,
property_trees->effect_tree, &update_layer_list_);
draw_property_utils::ComputeVisibleRectsForTesting(
property_trees, can_render_to_separate_surface, &update_layer_list_);
}
Expand Down
Loading

0 comments on commit 0f10629

Please sign in to comment.