Commit a91041ae authored by Brandon Jones's avatar Brandon Jones Committed by Commit Bot

Checks to prevent occasional crashes when mirroring WebXR content

Bug: 827690
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: I509088a542dfc775262ae9807114db205ae6ac08
Reviewed-on: https://chromium-review.googlesource.com/988848Reviewed-by: default avatarIan Vollick <vollick@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548142}
parent af007379
......@@ -125,12 +125,16 @@ XRWebGLLayer::XRWebGLLayer(XRSession* session,
// If the contents need mirroring, indicate that to the drawing buffer.
if (session->exclusive() && session->outputContext() &&
session->device()->external()) {
mirroring_ = true;
drawing_buffer_->SetMirrorClient(this);
}
UpdateViewports();
}
XRWebGLLayer::~XRWebGLLayer() {}
XRWebGLLayer::~XRWebGLLayer() {
if (mirroring_)
drawing_buffer_->SetMirrorClient(nullptr);
}
void XRWebGLLayer::getXRWebGLRenderingContext(
WebGLRenderingContextOrWebGL2RenderingContext& result) const {
......
......@@ -99,6 +99,7 @@ class XRWebGLLayer final : public XRLayer,
double requested_viewport_scale_ = 1.0;
double viewport_scale_ = 1.0;
bool viewports_dirty_ = true;
bool mirroring_ = false;
};
} // namespace blink
......
......@@ -36,6 +36,9 @@ ImageLayerBridge::~ImageLayerBridge() {
}
void ImageLayerBridge::SetImage(scoped_refptr<StaticBitmapImage> image) {
if (disposed_)
return;
image_ = std::move(image);
if (image_) {
if (opacity_mode_ == kNonOpaque) {
......@@ -58,6 +61,9 @@ void ImageLayerBridge::SetImage(scoped_refptr<StaticBitmapImage> image) {
void ImageLayerBridge::SetUV(const FloatPoint left_top,
const FloatPoint right_bottom) {
if (disposed_)
return;
layer_->SetUV(WebFloatPoint(left_top.X(), left_top.Y()),
WebFloatPoint(right_bottom.X(), right_bottom.Y()));
}
......
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