Skip to content

Commit

Permalink
Add DCHECK for duplicate layers with the same cc::ElementId.
Browse files Browse the repository at this point in the history
BUG=673963
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel

Review-Url: https://codereview.chromium.org/2639103002
Cr-Commit-Position: refs/heads/master@{#444407}
  • Loading branch information
skobes-chromium authored and Commit bot committed Jan 18, 2017
1 parent eece208 commit f547b3e
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions cc/trees/layer_tree_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -544,18 +544,25 @@ LayerImpl* LayerTreeImpl::LayerByElementId(ElementId element_id) const {
}

void LayerTreeImpl::AddToElementMap(LayerImpl* layer) {
if (!layer->element_id())
ElementId element_id = layer->element_id();
if (!element_id)
return;

TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("compositor-worker"),
"LayerTreeImpl::AddToElementMap", "element",
layer->element_id().AsValue().release(), "layer_id",
layer->id());
element_id.AsValue().release(), "layer_id", layer->id());

element_layers_map_[layer->element_id()] = layer->id();
#if DCHECK_IS_ON()
LayerImpl* existing_layer = LayerByElementId(element_id);
bool element_id_collision_detected =
existing_layer && existing_layer != layer;
DCHECK(!element_id_collision_detected);
#endif

element_layers_map_[element_id] = layer->id();

layer_tree_host_impl_->mutator_host()->RegisterElement(
layer->element_id(),
element_id,
IsActiveTree() ? ElementListType::ACTIVE : ElementListType::PENDING);
}

Expand Down

0 comments on commit f547b3e

Please sign in to comment.