From 53f7ec90b80cf9c2371c1570d0b1ce2e63332018 Mon Sep 17 00:00:00 2001 From: danakj Date: Fri, 20 May 2016 18:30:10 -0700 Subject: [PATCH] Check for a non-null GrContext on the media::Context3D during paint. The code checks that a ContextProvider was able to be found by checking the |gl| field. But if the ContextProvider was created but lost, and GrContext was not created yet, then it will fail to initialize and be null. We should avoid trying to use this context then (and not crash). R=dalecurtis@chromium.org BUG=612087 Review-Url: https://codereview.chromium.org/2003833002 Cr-Commit-Position: refs/heads/master@{#395222} --- media/blink/webmediaplayer_impl.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc index 0578c9a778d2a..0b6354a9f296e 100644 --- a/media/blink/webmediaplayer_impl.cc +++ b/media/blink/webmediaplayer_impl.cc @@ -718,9 +718,10 @@ void WebMediaPlayerImpl::paint(blink::WebCanvas* canvas, if (video_frame.get() && video_frame->HasTextures()) { if (!context_3d_cb_.is_null()) context_3d = context_3d_cb_.Run(); - // GPU Process crashed. if (!context_3d.gl) - return; + return; // Unable to get/create a shared main thread context. + if (!context_3d.gr_context) + return; // The context has been lost since and can't setup a GrContext. } skcanvas_video_renderer_.Paint(video_frame, canvas, gfx::RectF(gfx_rect), alpha, mode, pipeline_metadata_.video_rotation,