diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-12 00:26:04 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-12 00:26:04 +0000 |
commit | 9d2eae83f7202da680b9b944ff27b7559ac2a6e7 (patch) | |
tree | f3383cbedd772db504bb1ac7240b84e50f74b9e2 /gpu | |
parent | bb49d8cbafa5ce78868a69c879eabffc2499c215 (diff) | |
download | chromium_src-9d2eae83f7202da680b9b944ff27b7559ac2a6e7.zip chromium_src-9d2eae83f7202da680b9b944ff27b7559ac2a6e7.tar.gz chromium_src-9d2eae83f7202da680b9b944ff27b7559ac2a6e7.tar.bz2 |
Revert "Revert 116821 - Make StrictSharedIdHandler free its unused ids."
Now that the command buffer no-op if the GPU process crashes
this CL should work again
BUG=109575,109330
TEST=Ran gpu_tests mentioned in bug
TBR=zmo@chromium.org
Review URL: http://codereview.chromium.org/9187032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117334 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/command_buffer/client/gles2_implementation.cc | 22 | ||||
-rw-r--r-- | gpu/command_buffer/client/gles2_implementation_unittest.cc | 6 |
2 files changed, 26 insertions, 2 deletions
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc index 37ef085..d22d842 100644 --- a/gpu/command_buffer/client/gles2_implementation.cc +++ b/gpu/command_buffer/client/gles2_implementation.cc @@ -143,7 +143,9 @@ class StrictSharedIdHandler : public IdHandlerInterface { id_namespace_(id_namespace) { } - virtual ~StrictSharedIdHandler() { } + virtual ~StrictSharedIdHandler() { + Destroy(); + } virtual void MakeIds(GLuint id_offset, GLsizei n, GLuint* ids) { for (GLsizei ii = 0; ii < n; ++ii) { @@ -185,6 +187,19 @@ class StrictSharedIdHandler : public IdHandlerInterface { typedef std::queue<GLuint> ResourceIdQueue; typedef std::set<GLuint> ResourceIdSet; + void Destroy() { + // Free all the ids not being used. + while (!free_ids_.empty()) { + GLuint ids[kNumIdsToGet]; + int count = 0; + while (count < kNumIdsToGet && !free_ids_.empty()) { + ids[count++] = free_ids_.front(); + free_ids_.pop(); + } + gles2_->DeleteSharedIdsCHROMIUM(id_namespace_, count, ids); + } + } + GLuint GetId(GLuint id_offset) { if (free_ids_.empty()) { GLuint ids[kNumIdsToGet]; @@ -725,6 +740,11 @@ GLES2Implementation::~GLES2Implementation() { #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) DeleteBuffers(arraysize(reserved_ids_), &reserved_ids_[0]); #endif + for (int i = 0; i < id_namespaces::kNumIdNamespaces; ++i) { + id_handlers_[i].reset(); + } + // Make sure the commands make it the service. + Finish(); } void GLES2Implementation::SetSharedMemoryChunkSizeMultiple( diff --git a/gpu/command_buffer/client/gles2_implementation_unittest.cc b/gpu/command_buffer/client/gles2_implementation_unittest.cc index dc94ad3..46f60ae 100644 --- a/gpu/command_buffer/client/gles2_implementation_unittest.cc +++ b/gpu/command_buffer/client/gles2_implementation_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -16,6 +16,7 @@ #endif using testing::_; +using testing::AnyNumber; using testing::DoAll; using testing::InSequence; using testing::Invoke; @@ -447,6 +448,9 @@ class GLES2ImplementationTest : public GLES2CommandBufferTestBase { } virtual void TearDown() { + Mock::VerifyAndClear(gl_.get()); + EXPECT_CALL(*command_buffer_, OnFlush(_)).Times(AnyNumber()); + gl_.reset(); } void Initialize(bool shared_resources, bool bind_generates_resource) { |