Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(967)

Unified Diff: content/renderer/render_widget_fullscreen_pepper.cc

Issue 12673002: pepper: Use the RenderThread's shared context as the parent context. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_widget_fullscreen_pepper.h ('k') | webkit/plugins/ppapi/fullscreen_container.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..c9344267858676394a48a58ed512905978735f00 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,17 +450,12 @@ void RenderWidgetFullscreenPepper::DidChangeCursor(
webkit::ppapi::PluginDelegate::PlatformContext3D*
RenderWidgetFullscreenPepper::CreateContext3D() {
#ifdef ENABLE_GPU
- return new PlatformContext3DImpl(this);
+ return new PlatformContext3DImpl;
#else
return NULL;
#endif
}
-void RenderWidgetFullscreenPepper::ReparentContext(
- webkit::ppapi::PluginDelegate::PlatformContext3D* context) {
- static_cast<PlatformContext3DImpl*>(context)->SetParentContext(this);
-}
-
bool RenderWidgetFullscreenPepper::OnMessageReceived(const IPC::Message& msg) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(RenderWidgetFullscreenPepper, msg)
@@ -565,7 +559,7 @@ void RenderWidgetFullscreenPepper::CreateContext() {
attributes.depth = false;
attributes.stencil = false;
attributes.antialias = false;
- attributes.shareResources = false;
+ attributes.shareResources = true;
attributes.preferDiscreteGPU = true;
context_ = WebGraphicsContext3DCommandBufferImpl::CreateViewContext(
RenderThreadImpl::current(),
@@ -686,11 +680,26 @@ bool RenderWidgetFullscreenPepper::InitContext() {
bool RenderWidgetFullscreenPepper::CheckCompositing() {
bool compositing =
webwidget_ && webwidget_->isAcceleratedCompositingActive();
+
+ if (compositing) {
+ if (context_ && context_->isContextLost()) {
+ DestroyContext(context_, program_, buffer_);
+ context_ = NULL;
+ }
+ if (!context_)
+ CreateContext();
piman 2013/03/08 18:27:08 If CreateContext fails, we should reset compositin
danakj 2013/03/08 18:40:28 Done.
+ }
+
if (compositing != is_accelerated_compositing_active_) {
if (compositing)
didActivateCompositor(-1);
- else
+ else {
+ if (context_) {
+ DestroyContext(context_, program_, buffer_);
+ context_ = NULL;
+ }
didDeactivateCompositor();
+ }
}
return compositing;
}
@@ -704,14 +713,4 @@ void RenderWidgetFullscreenPepper::SwapBuffers() {
didCommitAndDrawCompositorFrame();
}
-WebGraphicsContext3DCommandBufferImpl*
-RenderWidgetFullscreenPepper::GetParentContextForPlatformContext3D() {
- if (!context_) {
- CreateContext();
- }
- if (!context_)
- return NULL;
- return context_;
-}
-
} // namespace content
« no previous file with comments | « content/renderer/render_widget_fullscreen_pepper.h ('k') | webkit/plugins/ppapi/fullscreen_container.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698