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

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

Issue 11840002: Explicitly free shared memory buffers on GL client destruction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add null-check Created 7 years, 9 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
« no previous file with comments | « no previous file | gpu/command_buffer/client/gles2_implementation_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // A class to emulate GLES2 over command buffers. 5 // A class to emulate GLES2 over command buffers.
6 6
7 #include "../client/gles2_implementation.h" 7 #include "../client/gles2_implementation.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) 197 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS)
198 DeleteBuffers(arraysize(reserved_ids_), &reserved_ids_[0]); 198 DeleteBuffers(arraysize(reserved_ids_), &reserved_ids_[0]);
199 #endif 199 #endif
200 buffer_tracker_.reset(); 200 buffer_tracker_.reset();
201 201
202 // The share group needs to be able to use a command buffer to talk 202 // The share group needs to be able to use a command buffer to talk
203 // to service if it's destroyed so set one for it then release the reference. 203 // to service if it's destroyed so set one for it then release the reference.
204 // If it's destroyed it will use this GLES2Implemenation. 204 // If it's destroyed it will use this GLES2Implemenation.
205 share_group_->SetGLES2ImplementationForDestruction(this); 205 share_group_->SetGLES2ImplementationForDestruction(this);
206 share_group_ = NULL; 206 share_group_ = NULL;
207 // Make sure the commands make it the service. 207 // Finally, finish commands and free shared memory buffers.
208 Finish(); 208 FreeEverything();
209 } 209 }
210 210
211 GLES2CmdHelper* GLES2Implementation::helper() const { 211 GLES2CmdHelper* GLES2Implementation::helper() const {
212 return helper_; 212 return helper_;
213 } 213 }
214 214
215 GLuint GLES2Implementation::MakeTextureId() { 215 GLuint GLES2Implementation::MakeTextureId() {
216 GLuint id; 216 GLuint id;
217 GetIdHandler(id_namespaces::kTextures)->MakeIds(this, 0, 1, &id); 217 GetIdHandler(id_namespaces::kTextures)->MakeIds(this, 0, 1, &id);
218 return id; 218 return id;
(...skipping 24 matching lines...) Expand all
243 unsigned int multiple) { 243 unsigned int multiple) {
244 mapped_memory_->set_chunk_size_multiple(multiple); 244 mapped_memory_->set_chunk_size_multiple(multiple);
245 } 245 }
246 246
247 void GLES2Implementation::FreeUnusedSharedMemory() { 247 void GLES2Implementation::FreeUnusedSharedMemory() {
248 mapped_memory_->FreeUnused(); 248 mapped_memory_->FreeUnused();
249 } 249 }
250 250
251 void GLES2Implementation::FreeEverything() { 251 void GLES2Implementation::FreeEverything() {
252 Finish(); 252 Finish();
253 query_tracker_->Shrink(); 253 if (query_tracker_.get())
254 query_tracker_->Shrink();
254 FreeUnusedSharedMemory(); 255 FreeUnusedSharedMemory();
255 transfer_buffer_->Free(); 256 transfer_buffer_->Free();
256 helper_->FreeRingBuffer(); 257 helper_->FreeRingBuffer();
257 } 258 }
258 259
259 void GLES2Implementation::WaitForCmd() { 260 void GLES2Implementation::WaitForCmd() {
260 TRACE_EVENT0("gpu", "GLES2::WaitForCmd"); 261 TRACE_EVENT0("gpu", "GLES2::WaitForCmd");
261 helper_->CommandBufferHelper::Finish(); 262 helper_->CommandBufferHelper::Finish();
262 } 263 }
263 264
(...skipping 3183 matching lines...) Expand 10 before | Expand all | Expand 10 after
3447 CheckGLError(); 3448 CheckGLError();
3448 } 3449 }
3449 3450
3450 // Include the auto-generated part of this file. We split this because it means 3451 // Include the auto-generated part of this file. We split this because it means
3451 // we can easily edit the non-auto generated parts right here in this file 3452 // we can easily edit the non-auto generated parts right here in this file
3452 // instead of having to edit some template or the code generator. 3453 // instead of having to edit some template or the code generator.
3453 #include "../client/gles2_implementation_impl_autogen.h" 3454 #include "../client/gles2_implementation_impl_autogen.h"
3454 3455
3455 } // namespace gles2 3456 } // namespace gles2
3456 } // namespace gpu 3457 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/client/gles2_implementation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698