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

Side by Side Diff: src/gpu/GrResourceCache2.cpp

Issue 827923006: Cap id size returned by GrScratchKey::GenerateResourceType (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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 | « no previous file | 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 9
10 #include "GrResourceCache2.h" 10 #include "GrResourceCache2.h"
11 #include "GrGpuResource.h" 11 #include "GrGpuResource.h"
12 12
13 #include "SkChecksum.h" 13 #include "SkChecksum.h"
14 #include "SkGr.h" 14 #include "SkGr.h"
15 #include "SkMessageBus.h" 15 #include "SkMessageBus.h"
16 16
17 DECLARE_SKMESSAGEBUS_MESSAGE(GrResourceInvalidatedMessage); 17 DECLARE_SKMESSAGEBUS_MESSAGE(GrResourceInvalidatedMessage);
18 18
19 ////////////////////////////////////////////////////////////////////////////// 19 //////////////////////////////////////////////////////////////////////////////
20 20
21 GrScratchKey::ResourceType GrScratchKey::GenerateResourceType() { 21 GrScratchKey::ResourceType GrScratchKey::GenerateResourceType() {
22 static int32_t gType = kInvalidResourceType + 1; 22 static int32_t gType = kInvalidResourceType + 1;
23 23
24 int32_t type = sk_atomic_inc(&gType); 24 int32_t type = sk_atomic_inc(&gType);
25 if (kInvalidResourceType == type) { 25 if (type > SK_MaxU16) {
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 32
33 void GrScratchKey::Builder::finish() { 33 void GrScratchKey::Builder::finish() {
34 if (NULL == fKey) { 34 if (NULL == fKey) {
35 return; 35 return;
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 483
484 SkDebugf("Budget: %d items %d bytes\n", fMaxCount, fMaxBytes); 484 SkDebugf("Budget: %d items %d bytes\n", fMaxCount, fMaxBytes);
485 SkDebugf("\t\tEntry Count: current %d" 485 SkDebugf("\t\tEntry Count: current %d"
486 " (%d budgeted, %d wrapped, %d locked, %d scratch %.2g%% full), hig h %d\n", 486 " (%d budgeted, %d wrapped, %d locked, %d scratch %.2g%% full), hig h %d\n",
487 fCount, fBudgetedCount, wrapped, locked, scratch, countUtilization, fHig hWaterCount); 487 fCount, fBudgetedCount, wrapped, locked, scratch, countUtilization, fHig hWaterCount);
488 SkDebugf("\t\tEntry Bytes: current %d (budgeted %d, %.2g%% full, %d unbudget ed) high %d\n", 488 SkDebugf("\t\tEntry Bytes: current %d (budgeted %d, %.2g%% full, %d unbudget ed) high %d\n",
489 fBytes, fBudgetedBytes, byteUtilization, unbudgetedSize, fHighWa terBytes); 489 fBytes, fBudgetedBytes, byteUtilization, unbudgetedSize, fHighWa terBytes);
490 } 490 }
491 491
492 #endif 492 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698