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 #ifndef SkCachedData_DEFINED | 8 #ifndef SkCachedData_DEFINED |
9 #define SkCachedData_DEFINED | 9 #define SkCachedData_DEFINED |
10 | 10 |
11 #include "SkMutex.h" | 11 #include "SkMutex.h" |
12 #include "SkTypes.h" | |
13 | 12 |
14 class SkDiscardableMemory; | 13 class SkDiscardableMemory; |
15 | 14 |
16 class SkCachedData : ::SkNoncopyable { | 15 class SkCachedData : ::SkNoncopyable { |
17 public: | 16 public: |
18 SkCachedData(void* mallocData, size_t size); | 17 SkCachedData(void* mallocData, size_t size); |
19 SkCachedData(size_t size, SkDiscardableMemory*); | 18 SkCachedData(size_t size, SkDiscardableMemory*); |
20 virtual ~SkCachedData(); | 19 virtual ~SkCachedData(); |
21 | 20 |
22 size_t size() const { return fSize; } | 21 size_t size() const { return fSize; } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 void attachToCacheAndRef() const { this->internalRef(true); } | 98 void attachToCacheAndRef() const { this->internalRef(true); } |
100 | 99 |
101 /* | 100 /* |
102 * Call when removing this instance from a SkResourceCache::Rec subclass | 101 * Call when removing this instance from a SkResourceCache::Rec subclass |
103 * (typically in the Rec's destructor). | 102 * (typically in the Rec's destructor). |
104 */ | 103 */ |
105 void detachFromCacheAndUnref() const { this->internalUnref(true); } | 104 void detachFromCacheAndUnref() const { this->internalUnref(true); } |
106 }; | 105 }; |
107 | 106 |
108 #endif | 107 #endif |
OLD | NEW |