Commit e07e849e authored by Peng Huang's avatar Peng Huang Committed by Commit Bot

SkiaOutputDeviceBufferQueue: fix crashes in BeginScopedWriteAccess

Base on the log, the crash is because ProduceSkia failed, so we need
check it indead of assuming ProdcueSkia() will be always successfully.
So the upper level can handle the failure properly.

[ERROR:shared_image_backing_factory_ahardwarebuffer.cc(843)] Failed to bind egl image
[ERROR:shared_image_manager.cc(219)] SharedImageManager::ProduceSkia: Trying to produce a Skia representation from an incompatible mailbox.

Bug: 1055511
Change-Id: Ib7e3494c36a3172efd3e6c3e66b51df771f09328
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2083713Reviewed-by: default avatarVasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746107}
parent 66be5149
...@@ -56,16 +56,31 @@ class SkiaOutputDeviceBufferQueue::Image { ...@@ -56,16 +56,31 @@ class SkiaOutputDeviceBufferQueue::Image {
DLOG(ERROR) << "CreateSharedImage failed."; DLOG(ERROR) << "CreateSharedImage failed.";
return false; return false;
} }
// Initialize |shared_image_deletor_| to make sure the shared image backing
// will be released with the Image.
shared_image_deletor_.ReplaceClosure(base::BindOnce(
base::IgnoreResult(&gpu::SharedImageFactory::DestroySharedImage),
base::Unretained(factory_), mailbox));
skia_representation_ = representation_factory_->ProduceSkia( skia_representation_ = representation_factory_->ProduceSkia(
mailbox, deps->GetSharedContextState()); mailbox, deps->GetSharedContextState());
if (!skia_representation_) {
DLOG(ERROR) << "ProduceSkia() failed.";
return false;
}
overlay_representation_ = representation_factory_->ProduceOverlay(mailbox); overlay_representation_ = representation_factory_->ProduceOverlay(mailbox);
// If the backing doesn't support overlay, then fallback to GL. // If the backing doesn't support overlay, then fallback to GL.
if (!overlay_representation_) if (!overlay_representation_)
gl_representation_ = representation_factory_->ProduceGLTexture(mailbox); gl_representation_ = representation_factory_->ProduceGLTexture(mailbox);
shared_image_deletor_.ReplaceClosure(base::BindOnce(
base::IgnoreResult(&gpu::SharedImageFactory::DestroySharedImage), if (!overlay_representation_ && !gl_representation_) {
base::Unretained(factory_), mailbox)); DLOG(ERROR) << "ProduceOverlay() and ProduceGLTexture() failed.";
return false;
}
return true; return true;
} }
......
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