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

Unified Diff: cc/trees/layer_tree_host_common.cc

Issue 1135393007: cc: Add property tree verification for compositor thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@compproptree_1_turn_off_verification
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_common.cc
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc
index 897c1246c8cf134c79ebd4ab416cec1e8895a767..90b438b1428200cd3bd1b33a7ed8d5b43009691a 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -2598,6 +2598,36 @@ static bool ApproximatelyEqual(const gfx::Transform& a,
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(
LayerTreeHostCommon::CalcDrawPropsMainInputs* inputs) {
LayerIterator<Layer> it, end;
@@ -2607,42 +2637,21 @@ void VerifyPropertyTreeValues(
Layer* current_layer = *it;
if (!it.represents_itself() || !current_layer->DrawsContent())
continue;
-
- 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);
+ VerifyPropertyTreeValuesForLayer(current_layer, inputs->property_trees);
}
}
void VerifyPropertyTreeValues(
LayerTreeHostCommon::CalcDrawPropsImplInputs* inputs) {
- // TODO(enne): need to synchronize compositor thread changes
- // for animation and scrolling to the property trees before these
- // can be correct.
+ LayerIterator<LayerImpl> it, end;
+ for (it = LayerIterator<LayerImpl>::Begin(inputs->render_surface_layer_list),
+ 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 {
« 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