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(); | |
73 } | 72 } |
74 | 73 |
75 ~TestResource() { | 74 ~TestResource() { |
76 --fAlive; | 75 --fAlive; |
77 if (NULL != fToDelete) { | 76 if (NULL != fToDelete) { |
78 // Breaks our little 2-element cycle below. | 77 // Breaks our little 2-element cycle below. |
79 fToDelete->setDeleteWhenDestroyed(NULL, NULL); | 78 fToDelete->setDeleteWhenDestroyed(NULL, NULL); |
80 fCache->deleteResource(fToDelete->getCacheEntry()); | 79 fCache->deleteResource(fToDelete->getCacheEntry()); |
81 } | 80 } |
82 this->release(); | 81 this->release(); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 SkCanvas canvas(device.get()); | 301 SkCanvas canvas(device.get()); |
303 | 302 |
304 test_cache(reporter, context, &canvas); | 303 test_cache(reporter, context, &canvas); |
305 test_purge_invalidated(reporter, context); | 304 test_purge_invalidated(reporter, context); |
306 test_cache_delete_on_destruction(reporter, context); | 305 test_cache_delete_on_destruction(reporter, context); |
307 test_resource_size_changed(reporter, context); | 306 test_resource_size_changed(reporter, context); |
308 } | 307 } |
309 } | 308 } |
310 | 309 |
311 #endif | 310 #endif |
OLD | NEW |