diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-22 22:49:34 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-22 22:49:34 +0000 |
commit | d92bec4353b077c5fef2d77d13ba7b3ae5e1d248 (patch) | |
tree | 0465e1ca7e24b75d17c23bea9c929ada64e54484 /webkit/glue/plugins | |
parent | 921720c8059acd219da442611d226330d9537083 (diff) | |
download | chromium_src-d92bec4353b077c5fef2d77d13ba7b3ae5e1d248.zip chromium_src-d92bec4353b077c5fef2d77d13ba7b3ae5e1d248.tar.gz chromium_src-d92bec4353b077c5fef2d77d13ba7b3ae5e1d248.tar.bz2 |
Make accelerated Mac plugins handle GL initialization failure instead of crashing
BUG=62565
TEST=Run with --use-gl=osmesa on 10.6, and open a YouTube video. The plugin should not crash, and audion should still play (but without video).
Review URL: http://codereview.chromium.org/5233005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67016 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/plugins')
-rw-r--r-- | webkit/glue/plugins/webplugin_accelerated_surface_mac.h | 1 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl_mac.mm | 13 |
2 files changed, 10 insertions, 4 deletions
diff --git a/webkit/glue/plugins/webplugin_accelerated_surface_mac.h b/webkit/glue/plugins/webplugin_accelerated_surface_mac.h index ba3f8ca..13980ca 100644 --- a/webkit/glue/plugins/webplugin_accelerated_surface_mac.h +++ b/webkit/glue/plugins/webplugin_accelerated_surface_mac.h @@ -28,6 +28,7 @@ class WebPluginAcceleratedSurface { virtual void SetSize(const gfx::Size& size) = 0; // Returns the context used to draw into this surface. + // If initializing the surface failed, this will be NULL. virtual CGLContextObj context() = 0; // Readies the surface for drawing. Must be called before any drawing session. diff --git a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm index 33747d9..7b0cb7a 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm +++ b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm @@ -376,9 +376,14 @@ bool WebPluginDelegateImpl::PlatformInitialize() { layer_ = layer; surface_ = plugin_->GetAcceleratedSurface(); - renderer_ = [[CARenderer rendererWithCGLContext:surface_->context() - options:NULL] retain]; - [renderer_ setLayer:layer_]; + // If surface initialization fails for some reason, just continue + // without any drawing; returning false would be a more confusing user + // experience (since it triggers a missing plugin placeholder). + if (surface_->context()) { + renderer_ = [[CARenderer rendererWithCGLContext:surface_->context() + options:NULL] retain]; + [renderer_ setLayer:layer_]; + } plugin_->BindFakePluginWindowHandle(false); } break; @@ -978,7 +983,7 @@ void WebPluginDelegateImpl::SetImeEnabled(bool enabled) { void WebPluginDelegateImpl::DrawLayerInSurface() { // If we haven't plumbed up the surface yet, don't try to draw. - if (!windowed_handle()) + if (!windowed_handle() || !renderer_) return; [renderer_ beginFrameAtTime:CACurrentMediaTime() timeStamp:NULL]; |