| OLD | NEW |
| 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 | 9 |
| 10 #include "GrResourceCache2.h" | 10 #include "GrResourceCache2.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 SkFAIL("Too many Resource Types"); | 26 SkFAIL("Too many Resource Types"); |
| 27 } | 27 } |
| 28 | 28 |
| 29 return static_cast<ResourceType>(type); | 29 return static_cast<ResourceType>(type); |
| 30 } | 30 } |
| 31 | 31 |
| 32 GrContentKey::Domain GrContentKey::GenerateDomain() { | 32 GrContentKey::Domain GrContentKey::GenerateDomain() { |
| 33 static int32_t gDomain = INHERITED::kInvalidDomain + 1; | 33 static int32_t gDomain = INHERITED::kInvalidDomain + 1; |
| 34 | 34 |
| 35 int32_t domain = sk_atomic_inc(&gDomain); | 35 int32_t domain = sk_atomic_inc(&gDomain); |
| 36 if (kInvalidDomain == gDomain) { | 36 if (domain > SK_MaxU16) { |
| 37 SkFAIL("Too many Content Key Domains"); | 37 SkFAIL("Too many Content Key Domains"); |
| 38 } | 38 } |
| 39 | 39 |
| 40 return static_cast<Domain>(domain); | 40 return static_cast<Domain>(domain); |
| 41 } | 41 } |
| 42 uint32_t GrResourceKeyHash(const uint32_t* data, size_t size) { | 42 uint32_t GrResourceKeyHash(const uint32_t* data, size_t size) { |
| 43 return SkChecksum::Compute(data, size); | 43 return SkChecksum::Compute(data, size); |
| 44 } | 44 } |
| 45 | 45 |
| 46 ////////////////////////////////////////////////////////////////////////////// | 46 ////////////////////////////////////////////////////////////////////////////// |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 | 488 |
| 489 SkDebugf("Budget: %d items %d bytes\n", fMaxCount, fMaxBytes); | 489 SkDebugf("Budget: %d items %d bytes\n", fMaxCount, fMaxBytes); |
| 490 SkDebugf("\t\tEntry Count: current %d" | 490 SkDebugf("\t\tEntry Count: current %d" |
| 491 " (%d budgeted, %d wrapped, %d locked, %d scratch %.2g%% full), hig
h %d\n", | 491 " (%d budgeted, %d wrapped, %d locked, %d scratch %.2g%% full), hig
h %d\n", |
| 492 fCount, fBudgetedCount, wrapped, locked, scratch, countUtilization, fHig
hWaterCount); | 492 fCount, fBudgetedCount, wrapped, locked, scratch, countUtilization, fHig
hWaterCount); |
| 493 SkDebugf("\t\tEntry Bytes: current %d (budgeted %d, %.2g%% full, %d unbudget
ed) high %d\n", | 493 SkDebugf("\t\tEntry Bytes: current %d (budgeted %d, %.2g%% full, %d unbudget
ed) high %d\n", |
| 494 fBytes, fBudgetedBytes, byteUtilization, unbudgetedSize, fHighWa
terBytes); | 494 fBytes, fBudgetedBytes, byteUtilization, unbudgetedSize, fHighWa
terBytes); |
| 495 } | 495 } |
| 496 | 496 |
| 497 #endif | 497 #endif |
| OLD | NEW |