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

Side by Side Diff: tests/CachedDataTest.cpp

Issue 1842753002: Style bikeshed - remove extraneous whitespace (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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 | « tests/BlurTest.cpp ('k') | tests/CanvasTest.cpp » ('j') | 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 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 23 matching lines...) Expand all
34 return new SkCachedData(size, dm); 34 return new SkCachedData(size, dm);
35 } else { 35 } else {
36 return new SkCachedData(sk_malloc_throw(size), size); 36 return new SkCachedData(sk_malloc_throw(size), size);
37 } 37 }
38 } 38 }
39 39
40 // returns with the data locked by client and cache 40 // returns with the data locked by client and cache
41 static SkCachedData* test_locking(skiatest::Reporter* reporter, 41 static SkCachedData* test_locking(skiatest::Reporter* reporter,
42 size_t size, SkDiscardableMemoryPool* pool) { 42 size_t size, SkDiscardableMemoryPool* pool) {
43 SkCachedData* data = make_data(size, pool); 43 SkCachedData* data = make_data(size, pool);
44 44
45 memset(data->writable_data(), 0x80, size); // just to use writable_data() 45 memset(data->writable_data(), 0x80, size); // just to use writable_data()
46 46
47 check_data(reporter, data, 1, kNotInCache, kLocked); 47 check_data(reporter, data, 1, kNotInCache, kLocked);
48 48
49 data->ref(); 49 data->ref();
50 check_data(reporter, data, 2, kNotInCache, kLocked); 50 check_data(reporter, data, 2, kNotInCache, kLocked);
51 data->unref(); 51 data->unref();
52 check_data(reporter, data, 1, kNotInCache, kLocked); 52 check_data(reporter, data, 1, kNotInCache, kLocked);
53 53
54 data->attachToCacheAndRef(); 54 data->attachToCacheAndRef();
55 check_data(reporter, data, 2, kInCache, kLocked); 55 check_data(reporter, data, 2, kInCache, kLocked);
56 56
57 data->unref(); 57 data->unref();
58 check_data(reporter, data, 1, kInCache, kUnlocked); 58 check_data(reporter, data, 1, kInCache, kUnlocked);
59 59
60 data->ref(); 60 data->ref();
61 check_data(reporter, data, 2, kInCache, kLocked); 61 check_data(reporter, data, 2, kInCache, kLocked);
62 62
63 return data; 63 return data;
64 } 64 }
65 65
66 /* 66 /*
67 * SkCachedData behaves differently (regarding its locked/unlocked state) depen ding on 67 * SkCachedData behaves differently (regarding its locked/unlocked state) depen ding on
68 * when it is in the cache or not. Being in the cache is signaled by calling at tachToCacheAndRef() 68 * when it is in the cache or not. Being in the cache is signaled by calling at tachToCacheAndRef()
69 * instead of ref(). (and balanced by detachFromCacheAndUnref). 69 * instead of ref(). (and balanced by detachFromCacheAndUnref).
(...skipping 15 matching lines...) Expand all
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() : nullpt r); 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
OLDNEW
« no previous file with comments | « tests/BlurTest.cpp ('k') | tests/CanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698