Commit 17b91f53 authored by danakj's avatar danakj Committed by Commit Bot

Crash the renderer process if it tries to re-register SharedBitmapId

A SharedBitmapId must be unique and should only be registered with
the display compositor once (and is implicitly unregistered if the
CompositorFrameSink is lost that it was registered to). Crash the
renderer if it violates this principle on a single CompositorFrameSink
so we can help track down why this is happening.

R=kylechar@chromium.org

Bug: 862584
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I37f36d0e4be20c5313c92e9e3a319803c0a58aaf
Reviewed-on: https://chromium-review.googlesource.com/1153467Reviewed-by: default avatarkylechar <kylechar@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578751}
parent 8b8a2033
......@@ -183,12 +183,18 @@ void AsyncLayerTreeFrameSink::DidAllocateSharedBitmap(
mojo::ScopedSharedBufferHandle buffer,
const viz::SharedBitmapId& id) {
DCHECK(compositor_frame_sink_ptr_);
// TODO(crbug.com/862584): Try to understand why SharedBitmapIds are being
// registered more than once, if it's happening with a single
// CompositorFrameSink.
CHECK_EQ(registered_bitmaps_.count(id), 0u);
registered_bitmaps_.insert(id);
compositor_frame_sink_ptr_->DidAllocateSharedBitmap(std::move(buffer), id);
}
void AsyncLayerTreeFrameSink::DidDeleteSharedBitmap(
const viz::SharedBitmapId& id) {
DCHECK(compositor_frame_sink_ptr_);
registered_bitmaps_.erase(id);
compositor_frame_sink_ptr_->DidDeleteSharedBitmap(id);
}
......
......@@ -138,6 +138,11 @@ class CC_MOJO_EMBEDDER_EXPORT AsyncLayerTreeFrameSink
float last_submitted_device_scale_factor_ = 1.f;
gfx::Size last_submitted_size_in_pixels_;
// TODO(crbug.com/862584): Try to understand why SharedBitmapIds are being
// registered more than once, if it's happening with a single
// CompositorFrameSink.
base::flat_set<viz::SharedBitmapId> registered_bitmaps_;
base::WeakPtrFactory<AsyncLayerTreeFrameSink> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(AsyncLayerTreeFrameSink);
......
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