| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #ifdef SK_DEBUG | 8 #ifdef SK_DEBUG |
| 9 | 9 |
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 REPORTER_ASSERT(reporter, !memcmp(memory, (void*) buffer, size))
; | 72 REPORTER_ASSERT(reporter, !memcmp(memory, (void*) buffer, size))
; |
| 73 } | 73 } |
| 74 cache->releaseCache(ID); | 74 cache->releaseCache(ID); |
| 75 REPORTER_ASSERT(reporter, cache->getMemoryStatus(ID) | 75 REPORTER_ASSERT(reporter, cache->getMemoryStatus(ID) |
| 76 != SkImageCache::kPinned_MemoryStatus); | 76 != SkImageCache::kPinned_MemoryStatus); |
| 77 cache->purgeAllUnpinnedCaches(); | 77 cache->purgeAllUnpinnedCaches(); |
| 78 REPORTER_ASSERT(reporter, cache->getMemoryStatus(ID) | 78 REPORTER_ASSERT(reporter, cache->getMemoryStatus(ID) |
| 79 != SkImageCache::kPinned_MemoryStatus); | 79 != SkImageCache::kPinned_MemoryStatus); |
| 80 memory = cache->pinCache(ID, &dataStatus); | 80 memory = cache->pinCache(ID, &dataStatus); |
| 81 if (memory != NULL) { | 81 if (memory != NULL) { |
| 82 // Since the cache was thrown away, and ID was not pinned, it sh
ould have | 82 // The memory block may or may not have survived the purging (at
the |
| 83 // been purged. | 83 // memory manager's whim) so we cannot check dataStatus here. |
| 84 REPORTER_ASSERT(reporter, SkImageCache::kUninitialized_DataStatu
s == dataStatus); | |
| 85 cache->releaseCache(ID); | 84 cache->releaseCache(ID); |
| 86 REPORTER_ASSERT(reporter, cache->getMemoryStatus(ID) | 85 REPORTER_ASSERT(reporter, cache->getMemoryStatus(ID) |
| 87 != SkImageCache::kPinned_MemoryStatus)
; | 86 != SkImageCache::kPinned_MemoryStatus)
; |
| 88 cache->throwAwayCache(ID); | 87 cache->throwAwayCache(ID); |
| 89 REPORTER_ASSERT(reporter, cache->getMemoryStatus(ID) | 88 REPORTER_ASSERT(reporter, cache->getMemoryStatus(ID) |
| 90 == SkImageCache::kFreed_MemoryStatus); | 89 == SkImageCache::kFreed_MemoryStatus); |
| 91 } else { | 90 } else { |
| 92 REPORTER_ASSERT(reporter, cache->getMemoryStatus(ID) | 91 REPORTER_ASSERT(reporter, cache->getMemoryStatus(ID) |
| 93 == SkImageCache::kFreed_MemoryStatus); | 92 == SkImageCache::kFreed_MemoryStatus); |
| 94 } | 93 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 if (encodeSucceeded) { | 188 if (encodeSucceeded) { |
| 190 test_factory(reporter, cache, encodedBitmap, *bitmap.get()); | 189 test_factory(reporter, cache, encodedBitmap, *bitmap.get()); |
| 191 } | 190 } |
| 192 } | 191 } |
| 193 } | 192 } |
| 194 | 193 |
| 195 #include "TestClassDef.h" | 194 #include "TestClassDef.h" |
| 196 DEFINE_TESTCLASS("BitmapFactory", TestBitmapFactoryClass, TestBitmapFactory) | 195 DEFINE_TESTCLASS("BitmapFactory", TestBitmapFactoryClass, TestBitmapFactory) |
| 197 | 196 |
| 198 #endif // SK_DEBUG | 197 #endif // SK_DEBUG |
| OLD | NEW |