summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-09 01:08:18 +0000
committerpiman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-09 01:08:18 +0000
commit3a95d11692d594cedaa312ee420189b13621038f (patch)
tree0e3f848fa56f0c0871749867d3cda2c52aeac9d8
parentbba32084c5b9914310b8f74359512f5729f179a9 (diff)
downloadchromium_src-3a95d11692d594cedaa312ee420189b13621038f.zip
chromium_src-3a95d11692d594cedaa312ee420189b13621038f.tar.gz
chromium_src-3a95d11692d594cedaa312ee420189b13621038f.tar.bz2
Fix surface destruction, broken by r90096
Also, initialize parameter passed to GetShaderiv/GetProgramiv that trigger asserts in debug. BUG=chromium-os:17082 TEST=youtube with pepper flash, go fullscreen and back. Review URL: http://codereview.chromium.org/7328012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91934 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/renderer/render_widget_fullscreen_pepper.cc4
-rw-r--r--webkit/plugins/ppapi/ppb_context_3d_impl.cc8
-rw-r--r--webkit/plugins/ppapi/ppb_context_3d_impl.h2
-rw-r--r--webkit/plugins/ppapi/ppb_surface_3d_impl.cc2
4 files changed, 11 insertions, 5 deletions
diff --git a/content/renderer/render_widget_fullscreen_pepper.cc b/content/renderer/render_widget_fullscreen_pepper.cc
index b9d3e21..04f9c1c 100644
--- a/content/renderer/render_widget_fullscreen_pepper.cc
+++ b/content/renderer/render_widget_fullscreen_pepper.cc
@@ -390,7 +390,7 @@ GLuint CreateShaderFromSource(gpu::gles2::GLES2Implementation* gl,
GLuint shader = gl->CreateShader(type);
gl->ShaderSource(shader, 1, &source, NULL);
gl->CompileShader(shader);
- int status;
+ int status = GL_FALSE;
gl->GetShaderiv(shader, GL_COMPILE_STATUS, &status);
if (!status) {
int size = 0;
@@ -432,7 +432,7 @@ bool RenderWidgetFullscreenPepper::InitContext() {
gl->BindAttribLocation(program_, 0, "in_tex_coord");
gl->LinkProgram(program_);
- int status;
+ int status = GL_FALSE;
gl->GetProgramiv(program_, GL_LINK_STATUS, &status);
if (!status) {
int size = 0;
diff --git a/webkit/plugins/ppapi/ppb_context_3d_impl.cc b/webkit/plugins/ppapi/ppb_context_3d_impl.cc
index e680217..e4384b4 100644
--- a/webkit/plugins/ppapi/ppb_context_3d_impl.cc
+++ b/webkit/plugins/ppapi/ppb_context_3d_impl.cc
@@ -144,7 +144,11 @@ int32_t PPB_Context3D_Impl::BindSurfaces(PP_Resource draw, PP_Resource read) {
return PP_ERROR_BADRESOURCE;
PPB_Surface3D_Impl* new_read =
static_cast<PPB_Surface3D_Impl*>(enter_read.object());
+ return BindSurfacesImpl(new_draw, new_read);
+}
+int32_t PPB_Context3D_Impl::BindSurfacesImpl(PPB_Surface3D_Impl* new_draw,
+ PPB_Surface3D_Impl* new_read) {
// TODO(alokp): Support separate draw-read surfaces.
DCHECK_EQ(new_draw, new_read);
if (new_draw != new_read)
@@ -153,12 +157,12 @@ int32_t PPB_Context3D_Impl::BindSurfaces(PP_Resource draw, PP_Resource read) {
if (new_draw == draw_surface_)
return PP_OK;
- if (new_draw->context())
+ if (new_draw && new_draw->context())
return PP_GRAPHICS3DERROR_BAD_ACCESS; // Already bound.
if (draw_surface_)
draw_surface_->BindToContext(NULL);
- if (!new_draw->BindToContext(this))
+ if (new_draw && !new_draw->BindToContext(this))
return PP_ERROR_NOMEMORY;
draw_surface_ = new_draw;
diff --git a/webkit/plugins/ppapi/ppb_context_3d_impl.h b/webkit/plugins/ppapi/ppb_context_3d_impl.h
index f4660dd..c64a7d6 100644
--- a/webkit/plugins/ppapi/ppb_context_3d_impl.h
+++ b/webkit/plugins/ppapi/ppb_context_3d_impl.h
@@ -73,6 +73,8 @@ class PPB_Context3D_Impl : public Resource,
GLenum access) OVERRIDE;
virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) OVERRIDE;
+ int32_t BindSurfacesImpl(PPB_Surface3D_Impl* draw, PPB_Surface3D_Impl* read);
+
gpu::gles2::GLES2Implementation* gles2_impl() {
return gles2_impl_.get();
}
diff --git a/webkit/plugins/ppapi/ppb_surface_3d_impl.cc b/webkit/plugins/ppapi/ppb_surface_3d_impl.cc
index 40c40cd..5cab3f6d0 100644
--- a/webkit/plugins/ppapi/ppb_surface_3d_impl.cc
+++ b/webkit/plugins/ppapi/ppb_surface_3d_impl.cc
@@ -29,7 +29,7 @@ PPB_Surface3D_Impl::PPB_Surface3D_Impl(PluginInstance* instance)
PPB_Surface3D_Impl::~PPB_Surface3D_Impl() {
if (context_)
- context_->BindSurfaces(0, 0);
+ context_->BindSurfacesImpl(NULL, NULL);
}
// static