Chromium Code Reviews| Index: content/renderer/render_widget_fullscreen_pepper.cc |
| diff --git a/content/renderer/render_widget_fullscreen_pepper.cc b/content/renderer/render_widget_fullscreen_pepper.cc |
| index 3154bbbda7b6c14e0c3b2621ca6c5c04daa8be93..59b41aea5ebd4dcd06a2ec44f179e1e70c4758cb 100644 |
| --- a/content/renderer/render_widget_fullscreen_pepper.cc |
| +++ b/content/renderer/render_widget_fullscreen_pepper.cc |
| @@ -332,8 +332,7 @@ class PepperWidget : public WebWidget { |
| } |
| virtual bool isAcceleratedCompositingActive() const { |
| - return widget_->context() && widget_->plugin() && |
| - (widget_->plugin()->GetBackingTextureId() != 0); |
| + return widget_->plugin() && widget_->plugin()->GetBackingTextureId(); |
| } |
| private: |
| @@ -451,7 +450,7 @@ void RenderWidgetFullscreenPepper::DidChangeCursor( |
| webkit::ppapi::PluginDelegate::PlatformContext3D* |
| RenderWidgetFullscreenPepper::CreateContext3D() { |
| #ifdef ENABLE_GPU |
| - return new PlatformContext3DImpl(this); |
| + return new PlatformContext3DImpl; |
|
piman
2013/03/08 22:37:52
we probably want to return NULL if switches::kDisa
danakj
2013/03/08 22:40:46
I am scared of that, the old code would not have r
piman
2013/03/08 22:44:09
It should be safe. It's only called from PPB_Grap
|
| #else |
| return NULL; |
| #endif |
| @@ -459,7 +458,14 @@ RenderWidgetFullscreenPepper::CreateContext3D() { |
| void RenderWidgetFullscreenPepper::ReparentContext( |
| webkit::ppapi::PluginDelegate::PlatformContext3D* context) { |
| - static_cast<PlatformContext3DImpl*>(context)->SetParentContext(this); |
| + PlatformContext3DImpl* context_impl = |
| + static_cast<PlatformContext3DImpl*>(context); |
| + |
| + CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| + if (command_line->HasSwitch(switches::kDisableFlashFullscreen3d)) |
| + context_impl->DestroyParentContextProviderAndBackingTexture(); |
| + else |
| + context_impl->SetParentAndCreateBackingTextureIfNeeded(); |
| } |
| bool RenderWidgetFullscreenPepper::OnMessageReceived(const IPC::Message& msg) { |
| @@ -558,14 +564,11 @@ void RenderWidgetFullscreenPepper::Composite() { |
| void RenderWidgetFullscreenPepper::CreateContext() { |
| DCHECK(!context_); |
| - CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| - if (command_line->HasSwitch(switches::kDisableFlashFullscreen3d)) |
| - return; |
| WebKit::WebGraphicsContext3D::Attributes attributes; |
| attributes.depth = false; |
| attributes.stencil = false; |
| attributes.antialias = false; |
| - attributes.shareResources = false; |
| + attributes.shareResources = true; |
| attributes.preferDiscreteGPU = true; |
| context_ = WebGraphicsContext3DCommandBufferImpl::CreateViewContext( |
| RenderThreadImpl::current(), |
| @@ -684,13 +687,28 @@ bool RenderWidgetFullscreenPepper::InitContext() { |
| } |
| bool RenderWidgetFullscreenPepper::CheckCompositing() { |
| - bool compositing = |
| - webwidget_ && webwidget_->isAcceleratedCompositingActive(); |
| + bool compositing = webwidget_ && webwidget_->isAcceleratedCompositingActive(); |
| + if (compositing) { |
| + if (context_ && context_->isContextLost()) { |
| + DestroyContext(context_, program_, buffer_); |
| + context_ = NULL; |
| + } |
| + if (!context_) |
| + CreateContext(); |
| + if (!context_) |
| + compositing = false; |
| + } |
| + |
| if (compositing != is_accelerated_compositing_active_) { |
| - if (compositing) |
| + if (compositing) { |
| didActivateCompositor(-1); |
| - else |
| + } else { |
| + if (context_) { |
| + DestroyContext(context_, program_, buffer_); |
| + context_ = NULL; |
| + } |
| didDeactivateCompositor(); |
| + } |
| } |
| return compositing; |
| } |
| @@ -704,14 +722,4 @@ void RenderWidgetFullscreenPepper::SwapBuffers() { |
| didCommitAndDrawCompositorFrame(); |
| } |
| -WebGraphicsContext3DCommandBufferImpl* |
| -RenderWidgetFullscreenPepper::GetParentContextForPlatformContext3D() { |
| - if (!context_) { |
| - CreateContext(); |
| - } |
| - if (!context_) |
| - return NULL; |
| - return context_; |
| -} |
| - |
| } // namespace content |