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,6 +2598,36 @@ static bool ApproximatelyEqual(const gfx::Transform& a, ...@@ -2598,6 +2598,36 @@ static bool ApproximatelyEqual(const gfx::Transform& a,
return true; return true;
} }
template <typename LayerType>
void VerifyPropertyTreeValuesForLayer(LayerType* current_layer,
PropertyTrees* property_trees) {
const bool visible_rects_match =
ApproximatelyEqual(current_layer->visible_content_rect(),
current_layer->visible_rect_from_property_trees());
CHECK(visible_rects_match)
<< "expected: " << current_layer->visible_content_rect().ToString()
<< " actual: "
<< current_layer->visible_rect_from_property_trees().ToString();
const bool draw_transforms_match =
ApproximatelyEqual(current_layer->draw_transform(),
DrawTransformFromPropertyTrees(
current_layer, property_trees->transform_tree));
CHECK(draw_transforms_match)
<< "expected: " << current_layer->draw_transform().ToString()
<< " actual: "
<< DrawTransformFromPropertyTrees(
current_layer, property_trees->transform_tree).ToString();
const bool draw_opacities_match =
current_layer->draw_opacity() ==
DrawOpacityFromPropertyTrees(current_layer, property_trees->opacity_tree);
CHECK(draw_opacities_match)
<< "expected: " << current_layer->draw_opacity()
<< " actual: " << DrawOpacityFromPropertyTrees(
current_layer, property_trees->opacity_tree);
}
void VerifyPropertyTreeValues( void VerifyPropertyTreeValues(
LayerTreeHostCommon::CalcDrawPropsMainInputs* inputs) { LayerTreeHostCommon::CalcDrawPropsMainInputs* inputs) {
LayerIterator<Layer> it, end; LayerIterator<Layer> it, end;
...@@ -2607,42 +2637,21 @@ void VerifyPropertyTreeValues( ...@@ -2607,42 +2637,21 @@ void VerifyPropertyTreeValues(
Layer* current_layer = *it; Layer* current_layer = *it;
if (!it.represents_itself() || !current_layer->DrawsContent()) if (!it.represents_itself() || !current_layer->DrawsContent())
continue; continue;
VerifyPropertyTreeValuesForLayer(current_layer, inputs->property_trees);
const bool visible_rects_match =
ApproximatelyEqual(current_layer->visible_content_rect(),
current_layer->visible_rect_from_property_trees());
CHECK(visible_rects_match)
<< "expected: " << current_layer->visible_content_rect().ToString()
<< " actual: "
<< current_layer->visible_rect_from_property_trees().ToString();
const bool draw_transforms_match = ApproximatelyEqual(
current_layer->draw_transform(),
DrawTransformFromPropertyTrees(current_layer,
inputs->property_trees->transform_tree));
CHECK(draw_transforms_match)
<< "expected: " << current_layer->draw_transform().ToString()
<< " actual: "
<< DrawTransformFromPropertyTrees(
current_layer, inputs->property_trees->transform_tree)
.ToString();
const bool draw_opacities_match =
current_layer->draw_opacity() ==
DrawOpacityFromPropertyTrees(current_layer,
inputs->property_trees->opacity_tree);
CHECK(draw_opacities_match)
<< "expected: " << current_layer->draw_opacity() << " actual: "
<< DrawOpacityFromPropertyTrees(current_layer,
inputs->property_trees->opacity_tree);
} }
} }
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