| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 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 | 10 |
| 11 #include "GrResourceCache.h" | 11 #include "GrResourceCache.h" |
| 12 #include "GrResource.h" | 12 #include "GrResource.h" |
| 13 | 13 |
| 14 DECLARE_SKMESSAGEBUS_MESSAGE(GrResourceInvalidatedMessage); | 14 DECLARE_SKMESSAGEBUS_MESSAGE(GrResourceInvalidatedMessage); |
| 15 | 15 |
| 16 GrResourceKey::ResourceType GrResourceKey::GenerateResourceType() { | 16 GrResourceKey::ResourceType GrResourceKey::GenerateResourceType() { |
| 17 static int32_t gNextType = 0; | 17 static int32_t gNextType = 0; |
| 18 | 18 |
| 19 int32_t type = sk_atomic_inc(&gNextType); | 19 int32_t type = sk_atomic_inc(&gNextType); |
| 20 if (type >= (1 << 8 * sizeof(ResourceType))) { | 20 if (type >= (1 << 8 * sizeof(ResourceType))) { |
| 21 GrCrash("Too many Resource Types"); | 21 SkFAIL("Too many Resource Types"); |
| 22 } | 22 } |
| 23 | 23 |
| 24 return static_cast<ResourceType>(type); | 24 return static_cast<ResourceType>(type); |
| 25 } | 25 } |
| 26 | 26 |
| 27 /////////////////////////////////////////////////////////////////////////////// | 27 /////////////////////////////////////////////////////////////////////////////// |
| 28 | 28 |
| 29 GrResourceEntry::GrResourceEntry(const GrResourceKey& key, GrResource* resource) | 29 GrResourceEntry::GrResourceEntry(const GrResourceKey& key, GrResource* resource) |
| 30 : fKey(key), fResource(resource) { | 30 : fKey(key), fResource(resource) { |
| 31 // we assume ownership of the resource, and will unref it when we die | 31 // we assume ownership of the resource, and will unref it when we die |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 fEntryBytes, fHighWaterEntryBytes); | 483 fEntryBytes, fHighWaterEntryBytes); |
| 484 SkDebugf("\t\tDetached Entry Count: current %d high %d\n", | 484 SkDebugf("\t\tDetached Entry Count: current %d high %d\n", |
| 485 fClientDetachedCount, fHighWaterClientDetachedCount); | 485 fClientDetachedCount, fHighWaterClientDetachedCount); |
| 486 SkDebugf("\t\tDetached Bytes: current %d high %d\n", | 486 SkDebugf("\t\tDetached Bytes: current %d high %d\n", |
| 487 fClientDetachedBytes, fHighWaterClientDetachedBytes); | 487 fClientDetachedBytes, fHighWaterClientDetachedBytes); |
| 488 } | 488 } |
| 489 | 489 |
| 490 #endif | 490 #endif |
| 491 | 491 |
| 492 /////////////////////////////////////////////////////////////////////////////// | 492 /////////////////////////////////////////////////////////////////////////////// |
| OLD | NEW |