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

Side by Side Diff: src/gpu/GrLayerCache.cpp

Issue 481443002: Add GrResourceCache2. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix leaks Created 6 years, 4 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
« no previous file with comments | « src/gpu/GrGpuResource.cpp ('k') | src/gpu/GrResourceCache.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrAtlas.h" 8 #include "GrAtlas.h"
9 #include "GrGpu.h" 9 #include "GrGpu.h"
10 #include "GrLayerCache.h" 10 #include "GrLayerCache.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 GrCachedLayer* layer = &(*iter); 105 GrCachedLayer* layer = &(*iter);
106 this->unlock(layer); 106 this->unlock(layer);
107 SkDELETE(layer); 107 SkDELETE(layer);
108 } 108 }
109 fLayerHash.rewind(); 109 fLayerHash.rewind();
110 110
111 // The atlas only lets go of its texture when the atlas is deleted. 111 // The atlas only lets go of its texture when the atlas is deleted.
112 fAtlas.free(); 112 fAtlas.free();
113 // GrLayerCache always assumes an atlas exists so recreate it. The atlas 113 // GrLayerCache always assumes an atlas exists so recreate it. The atlas
114 // lazily allocates a replacement texture so reallocating a new 114 // lazily allocates a replacement texture so reallocating a new
115 // atlas here won't disrupt a GrContext::contextDestroyed or freeGpuResource s. 115 // atlas here won't disrupt a GrContext::abandonContext or freeGpuResources.
116 // TODO: Make GrLayerCache lazily allocate the atlas manager? 116 // TODO: Make GrLayerCache lazily allocate the atlas manager?
117 this->initAtlas(); 117 this->initAtlas();
118 } 118 }
119 119
120 GrCachedLayer* GrLayerCache::createLayer(uint32_t pictureID, 120 GrCachedLayer* GrLayerCache::createLayer(uint32_t pictureID,
121 int start, int stop, 121 int start, int stop,
122 const SkMatrix& ctm) { 122 const SkMatrix& ctm) {
123 SkASSERT(pictureID != SK_InvalidGenID && start > 0 && stop > 0); 123 SkASSERT(pictureID != SK_InvalidGenID && start > 0 && stop > 0);
124 124
125 GrCachedLayer* layer = SkNEW_ARGS(GrCachedLayer, (pictureID, start, stop, ct m)); 125 GrCachedLayer* layer = SkNEW_ARGS(GrCachedLayer, (pictureID, start, stop, ct m));
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 414
415 void GrLayerCache::processDeletedPictures() { 415 void GrLayerCache::processDeletedPictures() {
416 SkTDArray<GrPictureDeletedMessage> deletedPictures; 416 SkTDArray<GrPictureDeletedMessage> deletedPictures;
417 fPictDeletionInbox.poll(&deletedPictures); 417 fPictDeletionInbox.poll(&deletedPictures);
418 418
419 for (int i = 0; i < deletedPictures.count(); i++) { 419 for (int i = 0; i < deletedPictures.count(); i++) {
420 this->purge(deletedPictures[i].pictureID); 420 this->purge(deletedPictures[i].pictureID);
421 } 421 }
422 } 422 }
423 423
OLDNEW
« no previous file with comments | « src/gpu/GrGpuResource.cpp ('k') | src/gpu/GrResourceCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698