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

Side by Side Diff: include/gpu/GrResourceKey.h

Issue 902873002: Reimplement gpu message bus for invalidated bitmap gen IDs (Closed) Base URL: https://skia.googlesource.com/skia.git@one_tex
Patch Set: fix speeling error Created 5 years, 10 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 | « include/gpu/GrGpuResource.h ('k') | include/gpu/SkGr.h » ('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 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #ifndef GrResourceKey_DEFINED 9 #ifndef GrResourceKey_DEFINED
10 #define GrResourceKey_DEFINED 10 #define GrResourceKey_DEFINED
(...skipping 28 matching lines...) Expand all
39 fKey[kHash_MetaDataIdx] = 0; 39 fKey[kHash_MetaDataIdx] = 0;
40 fKey[kDomainAndSize_MetaDataIdx] = kInvalidDomain; 40 fKey[kDomainAndSize_MetaDataIdx] = kInvalidDomain;
41 } 41 }
42 42
43 bool operator==(const GrResourceKey& that) const { 43 bool operator==(const GrResourceKey& that) const {
44 SkASSERT(this->isValid() && that.isValid()); 44 SkASSERT(this->isValid() && that.isValid());
45 return 0 == memcmp(fKey.get(), that.fKey.get(), this->size()); 45 return 0 == memcmp(fKey.get(), that.fKey.get(), this->size());
46 } 46 }
47 47
48 GrResourceKey& operator=(const GrResourceKey& that) { 48 GrResourceKey& operator=(const GrResourceKey& that) {
49 SkASSERT(that.isValid());
49 if (this != &that) { 50 if (this != &that) {
50 size_t bytes = that.size(); 51 size_t bytes = that.size();
51 SkASSERT(SkIsAlign4(bytes)); 52 SkASSERT(SkIsAlign4(bytes));
52 fKey.reset(SkToInt(bytes / sizeof(uint32_t))); 53 fKey.reset(SkToInt(bytes / sizeof(uint32_t)));
53 memcpy(fKey.get(), that.fKey.get(), bytes); 54 memcpy(fKey.get(), that.fKey.get(), bytes);
55 this->validate();
54 } 56 }
55 return *this; 57 return *this;
56 } 58 }
57 59
58 bool isValid() const { return kInvalidDomain != this->domain(); } 60 bool isValid() const { return kInvalidDomain != this->domain(); }
59 61
60 uint32_t domain() const { return fKey[kDomainAndSize_MetaDataIdx] & 0xffff; } 62 uint32_t domain() const { return fKey[kDomainAndSize_MetaDataIdx] & 0xffff; }
61 63
62 /** size of the key data, excluding meta-data (hash, domain, etc). */ 64 /** size of the key data, excluding meta-data (hash, domain, etc). */
63 size_t dataSize() const { return this->size() - 4 * kMetaDataCnt; } 65 size_t dataSize() const { return this->size() - 4 * kMetaDataCnt; }
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 } 231 }
230 232
231 private: 233 private:
232 static int Data32CntForInnerKey(const GrContentKey& innerKey) { 234 static int Data32CntForInnerKey(const GrContentKey& innerKey) {
233 // key data + domain 235 // key data + domain
234 return SkToInt((innerKey.dataSize() >> 2) + 1); 236 return SkToInt((innerKey.dataSize() >> 2) + 1);
235 } 237 }
236 }; 238 };
237 }; 239 };
238 240
241 // The cache listens for these messages to purge junk resources proactively.
242 class GrContentKeyInvalidatedMessage {
243 public:
244 explicit GrContentKeyInvalidatedMessage(const GrContentKey& key) : fKey(key) {}
245 GrContentKeyInvalidatedMessage(const GrContentKeyInvalidatedMessage& that) : fKey(that.fKey) {}
246 GrContentKeyInvalidatedMessage& operator=(const GrContentKeyInvalidatedMessa ge& that) {
247 fKey = that.fKey;
248 return *this;
249 }
250 const GrContentKey& key() const { return fKey; }
251 private:
252 GrContentKey fKey;
253 };
239 #endif 254 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrGpuResource.h ('k') | include/gpu/SkGr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698