OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "GrGpuResource.h" | 8 #include "GrGpuResource.h" |
9 #include "GrContext.h" | 9 #include "GrContext.h" |
10 #include "GrResourceCache.h" | 10 #include "GrResourceCache.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 if (this->isPurgeable()) { | 76 if (this->isPurgeable()) { |
77 traceMemoryDump->dumpNumericValue(dumpName.c_str(), "purgeable_size", "b
ytes", | 77 traceMemoryDump->dumpNumericValue(dumpName.c_str(), "purgeable_size", "b
ytes", |
78 this->gpuMemorySize()); | 78 this->gpuMemorySize()); |
79 } | 79 } |
80 | 80 |
81 // Call setMemoryBacking to allow sub-classes with implementation specific b
ackings (such as GL | 81 // Call setMemoryBacking to allow sub-classes with implementation specific b
ackings (such as GL |
82 // objects) to provide additional information. | 82 // objects) to provide additional information. |
83 this->setMemoryBacking(traceMemoryDump, dumpName); | 83 this->setMemoryBacking(traceMemoryDump, dumpName); |
84 } | 84 } |
85 | 85 |
86 const SkData* GrGpuResource::setCustomData(const SkData* data) { | |
87 SkSafeRef(data); | |
88 fData.reset(data); | |
89 return data; | |
90 } | |
91 | |
92 const GrContext* GrGpuResource::getContext() const { | 86 const GrContext* GrGpuResource::getContext() const { |
93 if (fGpu) { | 87 if (fGpu) { |
94 return fGpu->getContext(); | 88 return fGpu->getContext(); |
95 } else { | 89 } else { |
96 return nullptr; | 90 return nullptr; |
97 } | 91 } |
98 } | 92 } |
99 | 93 |
100 GrContext* GrGpuResource::getContext() { | 94 GrContext* GrGpuResource::getContext() { |
101 if (fGpu) { | 95 if (fGpu) { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 } | 194 } |
201 | 195 |
202 uint32_t GrGpuResource::CreateUniqueID() { | 196 uint32_t GrGpuResource::CreateUniqueID() { |
203 static int32_t gUniqueID = SK_InvalidUniqueID; | 197 static int32_t gUniqueID = SK_InvalidUniqueID; |
204 uint32_t id; | 198 uint32_t id; |
205 do { | 199 do { |
206 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); | 200 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); |
207 } while (id == SK_InvalidUniqueID); | 201 } while (id == SK_InvalidUniqueID); |
208 return id; | 202 return id; |
209 } | 203 } |
OLD | NEW |