OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |