diff options
Diffstat (limited to 'webkit/glue')
-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]; |