| OLD | NEW | 
|---|
| 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 "SkCachedData.h" | 8 #include "SkCachedData.h" | 
| 9 #include "SkDiscardableMemoryPool.h" | 9 #include "SkDiscardableMemoryPool.h" | 
| 10 #include "Test.h" | 10 #include "Test.h" | 
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 71  *  Thus, among other things, we test the end-of-life behavior when the client i
    s the last owner | 71  *  Thus, among other things, we test the end-of-life behavior when the client i
    s the last owner | 
| 72  *  and when the cache is. | 72  *  and when the cache is. | 
| 73  */ | 73  */ | 
| 74 DEF_TEST(CachedData, reporter) { | 74 DEF_TEST(CachedData, reporter) { | 
| 75     SkAutoTUnref<SkDiscardableMemoryPool> pool(SkDiscardableMemoryPool::Create(1
    000)); | 75     SkAutoTUnref<SkDiscardableMemoryPool> pool(SkDiscardableMemoryPool::Create(1
    000)); | 
| 76 | 76 | 
| 77     for (int useDiscardable = 0; useDiscardable <= 1; ++useDiscardable) { | 77     for (int useDiscardable = 0; useDiscardable <= 1; ++useDiscardable) { | 
| 78         const size_t size = 100; | 78         const size_t size = 100; | 
| 79 | 79 | 
| 80         // test with client as last owner | 80         // test with client as last owner | 
| 81         SkCachedData* data = test_locking(reporter, size, useDiscardable ? pool.
    get() : NULL); | 81         SkCachedData* data = test_locking(reporter, size, useDiscardable ? pool.
    get() : nullptr); | 
| 82         check_data(reporter, data, 2, kInCache, kLocked); | 82         check_data(reporter, data, 2, kInCache, kLocked); | 
| 83         data->detachFromCacheAndUnref(); | 83         data->detachFromCacheAndUnref(); | 
| 84         check_data(reporter, data, 1, kNotInCache, kLocked); | 84         check_data(reporter, data, 1, kNotInCache, kLocked); | 
| 85         data->unref(); | 85         data->unref(); | 
| 86 | 86 | 
| 87         // test with cache as last owner | 87         // test with cache as last owner | 
| 88         data = test_locking(reporter, size, useDiscardable ? pool.get() : NULL); | 88         data = test_locking(reporter, size, useDiscardable ? pool.get() : nullpt
    r); | 
| 89         check_data(reporter, data, 2, kInCache, kLocked); | 89         check_data(reporter, data, 2, kInCache, kLocked); | 
| 90         data->unref(); | 90         data->unref(); | 
| 91         check_data(reporter, data, 1, kInCache, kUnlocked); | 91         check_data(reporter, data, 1, kInCache, kUnlocked); | 
| 92         data->detachFromCacheAndUnref(); | 92         data->detachFromCacheAndUnref(); | 
| 93     } | 93     } | 
| 94 } | 94 } | 
| 95 | 95 | 
| OLD | NEW | 
|---|