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

Unified Diff: gpu/command_buffer/client/mapped_memory.cc

Issue 12087126: Fix shared memory leak on command buffer teardown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | « gpu/command_buffer/client/gles2_implementation_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/client/mapped_memory.cc
diff --git a/gpu/command_buffer/client/mapped_memory.cc b/gpu/command_buffer/client/mapped_memory.cc
index 5278fc8af76e7bb01a6e3520a6903c08bd6faafc..8e51801a89be1852c5e4eedda0bb10d073d3a7c9 100644
--- a/gpu/command_buffer/client/mapped_memory.cc
+++ b/gpu/command_buffer/client/mapped_memory.cc
@@ -9,11 +9,6 @@
#include "../client/cmd_buffer_helper.h"
namespace gpu {
-namespace {
-void DeleteMemoryChunk(MemoryChunk* chunk) {
- delete chunk;
-}
-}
MemoryChunk::MemoryChunk(
int32 shm_id, gpu::Buffer shm, CommandBufferHelper* helper)
@@ -28,10 +23,13 @@ MappedMemoryManager::MappedMemoryManager(CommandBufferHelper* helper)
}
MappedMemoryManager::~MappedMemoryManager() {
- std::for_each(chunks_.begin(),
- chunks_.end(),
- std::pointer_to_unary_function<MemoryChunk*, void>(
- DeleteMemoryChunk));
+ CommandBuffer* cmd_buf = helper_->command_buffer();
+ for (MemoryChunkVector::iterator iter = chunks_.begin();
+ iter != chunks_.end(); ++iter) {
+ MemoryChunk* chunk = *iter;
+ cmd_buf->DestroyTransferBuffer(chunk->shm_id());
+ delete chunk;
+ }
}
void* MappedMemoryManager::Alloc(
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698