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

Side by Side Diff: tests/ResourceCacheTest.cpp

Issue 504313002: Make GrGpuResources register with GrResourceCache2 after fully constructed. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix insertion for GlyphPathRange. Created 6 years, 3 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/gl/GrGLVertexBuffer.cpp ('k') | no next file » | 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 2013 Google Inc. 2 * Copyright 2013 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 #if SK_SUPPORT_GPU 8 #if SK_SUPPORT_GPU
9 9
10 #include "GrContextFactory.h" 10 #include "GrContextFactory.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 static const size_t kDefaultSize = 100; 62 static const size_t kDefaultSize = 100;
63 63
64 public: 64 public:
65 SK_DECLARE_INST_COUNT(TestResource); 65 SK_DECLARE_INST_COUNT(TestResource);
66 TestResource(GrGpu* gpu, size_t size = kDefaultSize) 66 TestResource(GrGpu* gpu, size_t size = kDefaultSize)
67 : INHERITED(gpu, false) 67 : INHERITED(gpu, false)
68 , fCache(NULL) 68 , fCache(NULL)
69 , fToDelete(NULL) 69 , fToDelete(NULL)
70 , fSize(size) { 70 , fSize(size) {
71 ++fAlive; 71 ++fAlive;
72 this->registerWithCache();
72 } 73 }
73 74
74 ~TestResource() { 75 ~TestResource() {
75 --fAlive; 76 --fAlive;
76 if (NULL != fToDelete) { 77 if (NULL != fToDelete) {
77 // Breaks our little 2-element cycle below. 78 // Breaks our little 2-element cycle below.
78 fToDelete->setDeleteWhenDestroyed(NULL, NULL); 79 fToDelete->setDeleteWhenDestroyed(NULL, NULL);
79 fCache->deleteResource(fToDelete->getCacheEntry()); 80 fCache->deleteResource(fToDelete->getCacheEntry());
80 } 81 }
81 this->release(); 82 this->release();
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 SkCanvas canvas(device.get()); 302 SkCanvas canvas(device.get());
302 303
303 test_cache(reporter, context, &canvas); 304 test_cache(reporter, context, &canvas);
304 test_purge_invalidated(reporter, context); 305 test_purge_invalidated(reporter, context);
305 test_cache_delete_on_destruction(reporter, context); 306 test_cache_delete_on_destruction(reporter, context);
306 test_resource_size_changed(reporter, context); 307 test_resource_size_changed(reporter, context);
307 } 308 }
308 } 309 }
309 310
310 #endif 311 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLVertexBuffer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698