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

Side by Side Diff: gpu/command_buffer/client/mapped_memory.cc

Issue 8369010: Add GLES2Implemention::FreeUnusedSharedMemory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm> 5 #include <algorithm>
6 #include <functional> 6 #include <functional>
7 7
8 #include "../client/mapped_memory.h" 8 #include "../client/mapped_memory.h"
9 #include "../client/cmd_buffer_helper.h" 9 #include "../client/cmd_buffer_helper.h"
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 for (size_t ii = 0; ii < chunks_.size(); ++ii) { 81 for (size_t ii = 0; ii < chunks_.size(); ++ii) {
82 MemoryChunk* chunk = chunks_[ii]; 82 MemoryChunk* chunk = chunks_[ii];
83 if (chunk->IsInChunk(pointer)) { 83 if (chunk->IsInChunk(pointer)) {
84 chunk->FreePendingToken(pointer, token); 84 chunk->FreePendingToken(pointer, token);
85 return; 85 return;
86 } 86 }
87 } 87 }
88 GPU_NOTREACHED(); 88 GPU_NOTREACHED();
89 } 89 }
90 90
91 void MappedMemoryManager::FreeUnused() {
92 CommandBuffer* cmd_buf = helper_->command_buffer();
93 MemoryChunkVector::iterator iter = chunks_.begin();
94 while (iter != chunks_.end()) {
95 MemoryChunk* chunk = *iter;
96 chunk->FreeUnused();
97 if (!chunk->InUse()) {
98 cmd_buf->DestroyTransferBuffer(chunk->shm_id());
99 iter = chunks_.erase(iter);
100 } else {
101 ++iter;
102 }
103 }
104 }
105
91 } // namespace gpu 106 } // namespace gpu
92 107
93 108
94 109
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/mapped_memory.h ('k') | gpu/command_buffer/client/mapped_memory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698