Commit 07371986 authored by enne's avatar enne Committed by Commit bot

cc: Add property tree verification for compositor thread

Depends on https://codereview.chromium.org/1134753005 to turn off
verify_property_trees everywhere so that this doesn't break the world.

This verification is turned off by default, and can be enabled
locally everywhere by reverting the above patch.

R=ajuma@chromium.org,vollick@chromium.org
BUG=481585

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

Cr-Commit-Position: refs/heads/master@{#330639}
parent 933b352b
...@@ -2598,16 +2598,9 @@ static bool ApproximatelyEqual(const gfx::Transform& a, ...@@ -2598,16 +2598,9 @@ static bool ApproximatelyEqual(const gfx::Transform& a,
return true; return true;
} }
void VerifyPropertyTreeValues( template <typename LayerType>
LayerTreeHostCommon::CalcDrawPropsMainInputs* inputs) { void VerifyPropertyTreeValuesForLayer(LayerType* current_layer,
LayerIterator<Layer> it, end; PropertyTrees* property_trees) {
for (it = LayerIterator<Layer>::Begin(inputs->render_surface_layer_list),
end = LayerIterator<Layer>::End(inputs->render_surface_layer_list);
it != end; ++it) {
Layer* current_layer = *it;
if (!it.represents_itself() || !current_layer->DrawsContent())
continue;
const bool visible_rects_match = const bool visible_rects_match =
ApproximatelyEqual(current_layer->visible_content_rect(), ApproximatelyEqual(current_layer->visible_content_rect(),
current_layer->visible_rect_from_property_trees()); current_layer->visible_rect_from_property_trees());
...@@ -2616,33 +2609,49 @@ void VerifyPropertyTreeValues( ...@@ -2616,33 +2609,49 @@ void VerifyPropertyTreeValues(
<< " actual: " << " actual: "
<< current_layer->visible_rect_from_property_trees().ToString(); << current_layer->visible_rect_from_property_trees().ToString();
const bool draw_transforms_match = ApproximatelyEqual( const bool draw_transforms_match =
current_layer->draw_transform(), ApproximatelyEqual(current_layer->draw_transform(),
DrawTransformFromPropertyTrees(current_layer, DrawTransformFromPropertyTrees(
inputs->property_trees->transform_tree)); current_layer, property_trees->transform_tree));
CHECK(draw_transforms_match) CHECK(draw_transforms_match)
<< "expected: " << current_layer->draw_transform().ToString() << "expected: " << current_layer->draw_transform().ToString()
<< " actual: " << " actual: "
<< DrawTransformFromPropertyTrees( << DrawTransformFromPropertyTrees(
current_layer, inputs->property_trees->transform_tree) current_layer, property_trees->transform_tree).ToString();
.ToString();
const bool draw_opacities_match = const bool draw_opacities_match =
current_layer->draw_opacity() == current_layer->draw_opacity() ==
DrawOpacityFromPropertyTrees(current_layer, DrawOpacityFromPropertyTrees(current_layer, property_trees->opacity_tree);
inputs->property_trees->opacity_tree);
CHECK(draw_opacities_match) CHECK(draw_opacities_match)
<< "expected: " << current_layer->draw_opacity() << " actual: " << "expected: " << current_layer->draw_opacity()
<< DrawOpacityFromPropertyTrees(current_layer, << " actual: " << DrawOpacityFromPropertyTrees(
inputs->property_trees->opacity_tree); current_layer, property_trees->opacity_tree);
}
void VerifyPropertyTreeValues(
LayerTreeHostCommon::CalcDrawPropsMainInputs* inputs) {
LayerIterator<Layer> it, end;
for (it = LayerIterator<Layer>::Begin(inputs->render_surface_layer_list),
end = LayerIterator<Layer>::End(inputs->render_surface_layer_list);
it != end; ++it) {
Layer* current_layer = *it;
if (!it.represents_itself() || !current_layer->DrawsContent())
continue;
VerifyPropertyTreeValuesForLayer(current_layer, inputs->property_trees);
} }
} }
void VerifyPropertyTreeValues( void VerifyPropertyTreeValues(
LayerTreeHostCommon::CalcDrawPropsImplInputs* inputs) { LayerTreeHostCommon::CalcDrawPropsImplInputs* inputs) {
// TODO(enne): need to synchronize compositor thread changes LayerIterator<LayerImpl> it, end;
// for animation and scrolling to the property trees before these for (it = LayerIterator<LayerImpl>::Begin(inputs->render_surface_layer_list),
// can be correct. end = LayerIterator<LayerImpl>::End(inputs->render_surface_layer_list);
it != end; ++it) {
LayerImpl* current_layer = *it;
if (!it.represents_itself() || !current_layer->DrawsContent())
continue;
VerifyPropertyTreeValuesForLayer(current_layer, inputs->property_trees);
}
} }
enum PropertyTreeOption { enum PropertyTreeOption {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment