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

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

Issue 1132723003: Make GrResourceCache perf less sensitive to key length change (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove an unused variable in the test Created 5 years, 7 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 | « bench/GrResourceCacheBench.cpp ('k') | no next file » | 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 39
40 /** Reset to an invalid key. */ 40 /** Reset to an invalid key. */
41 void reset() { 41 void reset() {
42 GR_STATIC_ASSERT((uint16_t)kInvalidDomain == kInvalidDomain); 42 GR_STATIC_ASSERT((uint16_t)kInvalidDomain == kInvalidDomain);
43 fKey.reset(kMetaDataCnt); 43 fKey.reset(kMetaDataCnt);
44 fKey[kHash_MetaDataIdx] = 0; 44 fKey[kHash_MetaDataIdx] = 0;
45 fKey[kDomainAndSize_MetaDataIdx] = kInvalidDomain; 45 fKey[kDomainAndSize_MetaDataIdx] = kInvalidDomain;
46 } 46 }
47 47
48 bool operator==(const GrResourceKey& that) const { 48 bool operator==(const GrResourceKey& that) const {
49 return 0 == memcmp(fKey.get(), that.fKey.get(), this->size()); 49 return this->hash() == that.hash() &&
50 0 == memcmp(&fKey[kHash_MetaDataIdx + 1],
51 &that.fKey[kHash_MetaDataIdx + 1],
52 this->internalSize() - sizeof(uint32_t));
50 } 53 }
51 54
52 GrResourceKey& operator=(const GrResourceKey& that) { 55 GrResourceKey& operator=(const GrResourceKey& that) {
53 SkASSERT(that.isValid()); 56 SkASSERT(that.isValid());
54 if (this != &that) { 57 if (this != &that) {
55 size_t bytes = that.size(); 58 size_t bytes = that.size();
56 SkASSERT(SkIsAlign4(bytes)); 59 SkASSERT(SkIsAlign4(bytes));
57 fKey.reset(SkToInt(bytes / sizeof(uint32_t))); 60 fKey.reset(SkToInt(bytes / sizeof(uint32_t)));
58 memcpy(fKey.get(), that.fKey.get(), bytes); 61 memcpy(fKey.get(), that.fKey.get(), bytes);
59 this->validate(); 62 this->validate();
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 fKey = that.fKey; 299 fKey = that.fKey;
297 return *this; 300 return *this;
298 } 301 }
299 302
300 const GrUniqueKey& key() const { return fKey; } 303 const GrUniqueKey& key() const { return fKey; }
301 304
302 private: 305 private:
303 GrUniqueKey fKey; 306 GrUniqueKey fKey;
304 }; 307 };
305 #endif 308 #endif
OLDNEW
« no previous file with comments | « bench/GrResourceCacheBench.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698