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

Side by Side Diff: src/core/SkCachedData.h

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 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 | « src/core/SkBuffer.cpp ('k') | src/core/SkCachedData.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 #ifndef SkCachedData_DEFINED 8 #ifndef SkCachedData_DEFINED
9 #define SkCachedData_DEFINED 9 #define SkCachedData_DEFINED
10 10
(...skipping 18 matching lines...) Expand all
29 29
30 int testing_only_getRefCnt() const { return fRefCnt; } 30 int testing_only_getRefCnt() const { return fRefCnt; }
31 bool testing_only_isLocked() const { return fIsLocked; } 31 bool testing_only_isLocked() const { return fIsLocked; }
32 bool testing_only_isInCache() const { return fInCache; } 32 bool testing_only_isInCache() const { return fInCache; }
33 33
34 SkDiscardableMemory* diagnostic_only_getDiscardable() const { 34 SkDiscardableMemory* diagnostic_only_getDiscardable() const {
35 return kDiscardableMemory_StorageType == fStorageType ? fStorage.fDM : n ullptr; 35 return kDiscardableMemory_StorageType == fStorageType ? fStorage.fDM : n ullptr;
36 } 36 }
37 37
38 protected: 38 protected:
39 // called when fData changes. could be NULL. 39 // called when fData changes. could be nullptr.
40 virtual void onDataChange(void* oldData, void* newData) {} 40 virtual void onDataChange(void* oldData, void* newData) {}
41 41
42 private: 42 private:
43 SkMutex fMutex; // could use a pool of these... 43 SkMutex fMutex; // could use a pool of these...
44 44
45 enum StorageType { 45 enum StorageType {
46 kDiscardableMemory_StorageType, 46 kDiscardableMemory_StorageType,
47 kMalloc_StorageType 47 kMalloc_StorageType
48 }; 48 };
49 49
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 86
87 /* 87 /*
88 * Attaching a data to to a SkResourceCache (only one at a time) enables th e data to be 88 * Attaching a data to to a SkResourceCache (only one at a time) enables th e data to be
89 * unlocked when the cache is the only owner, thus freeing it to be purged (assuming the 89 * unlocked when the cache is the only owner, thus freeing it to be purged (assuming the
90 * data is backed by a SkDiscardableMemory). 90 * data is backed by a SkDiscardableMemory).
91 * 91 *
92 * When attached, it also automatically attempts to "lock" the data when th e first client 92 * When attached, it also automatically attempts to "lock" the data when th e first client
93 * ref's the data (typically from a find(key, visitor) call). 93 * ref's the data (typically from a find(key, visitor) call).
94 * 94 *
95 * Thus the data will always be "locked" when a non-cache has a ref on it ( whether or not 95 * Thus the data will always be "locked" when a non-cache has a ref on it ( whether or not
96 * the lock succeeded to recover the memory -- check data() to see if it is NULL). 96 * the lock succeeded to recover the memory -- check data() to see if it is nullptr).
97 */ 97 */
98 98
99 /* 99 /*
100 * Call when adding this instance to a SkResourceCache::Rec subclass 100 * Call when adding this instance to a SkResourceCache::Rec subclass
101 * (typically in the Rec's constructor). 101 * (typically in the Rec's constructor).
102 */ 102 */
103 void attachToCacheAndRef() const { this->internalRef(true); } 103 void attachToCacheAndRef() const { this->internalRef(true); }
104 104
105 /* 105 /*
106 * Call when removing this instance from a SkResourceCache::Rec subclass 106 * Call when removing this instance from a SkResourceCache::Rec subclass
107 * (typically in the Rec's destructor). 107 * (typically in the Rec's destructor).
108 */ 108 */
109 void detachFromCacheAndUnref() const { this->internalUnref(true); } 109 void detachFromCacheAndUnref() const { this->internalUnref(true); }
110 }; 110 };
111 111
112 #endif 112 #endif
OLDNEW
« no previous file with comments | « src/core/SkBuffer.cpp ('k') | src/core/SkCachedData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698