From 31cfebe0eaaba1036314eab5e2a17d52f743bdd1 Mon Sep 17 00:00:00 2001 From: "alexeypa@google.com" <alexeypa@google.com@0039d316-1c4b-4281-b951-d872f2087c98> Date: Mon, 22 Jul 2013 22:49:00 +0000 Subject: Revert 212978 "Fix a memory leak." Specilative revert. We suspect it might be causing http://build.chromium.org/p/chromium.linux/builders/Linux%20Tests%20%28dbg%29%282%29/builds/37159 > Fix a memory leak. > > ProgramManager::UnuseProgram was never called in existing code > because state_.current_program was cleared first. So the current > program object leaks. > > The fix is to clear state_.current_program at the end of function. > > BUG=258772 > > Review URL: https://chromiumcodereview.appspot.com/19577012 TBR=feng@chromium.org Review URL: https://codereview.chromium.org/19947005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212989 0039d316-1c4b-4281-b951-d872f2087c98 --- gpu/command_buffer/service/gles2_cmd_decoder.cc | 7 ++----- gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc | 4 ---- 2 files changed, 2 insertions(+), 9 deletions(-) (limited to 'gpu') diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index f38ff8e..3c49a73 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -3134,6 +3134,7 @@ void GLES2DecoderImpl::Destroy(bool have_context) { state_.texture_units.clear(); state_.bound_array_buffer = NULL; state_.current_query = NULL; + state_.current_program = NULL; state_.bound_read_framebuffer = NULL; state_.bound_draw_framebuffer = NULL; state_.bound_renderbuffer = NULL; @@ -3154,6 +3155,7 @@ void GLES2DecoderImpl::Destroy(bool have_context) { if (state_.current_program.get()) { program_manager()->UnuseProgram(shader_manager(), state_.current_program.get()); + state_.current_program = NULL; } if (attrib_0_buffer_id_) { @@ -3237,11 +3239,6 @@ void GLES2DecoderImpl::Destroy(bool have_context) { context_ = NULL; } - // Current program must be cleared after calling - // ProgramManager::UnuseProgram. Otherwise, we can - // leak objects. http://crbug.com/258772 - state_.current_program = NULL; - #if defined(OS_MACOSX) for (TextureToIOSurfaceMap::iterator it = texture_to_io_surface_map_.begin(); it != texture_to_io_surface_map_.end(); ++it) { diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc index ed8725d..09ed184 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc @@ -292,8 +292,6 @@ TEST_F(GLES2DecoderWithShaderTest, DrawArraysDeletedProgramSucceeds) { EXPECT_CALL(*gl_, DrawArrays(_, _, _)) .Times(1) .RetiresOnSaturation(); - EXPECT_CALL(*gl_, DeleteProgram(kServiceProgramId)) - .Times(1); DrawArrays cmd; cmd.Init(GL_TRIANGLES, 0, kNumVertices); EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); @@ -687,8 +685,6 @@ TEST_F(GLES2DecoderWithShaderTest, DrawElementsDeletedProgramSucceeds) { EXPECT_CALL(*gl_, DrawElements(_, _, _, _)) .Times(1); - EXPECT_CALL(*gl_, DeleteProgram(kServiceProgramId)) - .Times(1); DrawElements cmd; cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, GL_UNSIGNED_SHORT, kValidIndexRangeStart * 2); -- cgit v1.1