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 #ifndef GrResourceCache2_DEFINED | 9 #ifndef GrResourceCache2_DEFINED |
10 #define GrResourceCache2_DEFINED | 10 #define GrResourceCache2_DEFINED |
(...skipping 11 matching lines...) Expand all Loading... |
22 */ | 22 */ |
23 class GrResourceCache2 { | 23 class GrResourceCache2 { |
24 public: | 24 public: |
25 GrResourceCache2() : fCount(0) {}; | 25 GrResourceCache2() : fCount(0) {}; |
26 ~GrResourceCache2(); | 26 ~GrResourceCache2(); |
27 | 27 |
28 void insertResource(GrGpuResource*); | 28 void insertResource(GrGpuResource*); |
29 | 29 |
30 void removeResource(GrGpuResource*); | 30 void removeResource(GrGpuResource*); |
31 | 31 |
32 void willRemoveContentKey(const GrGpuResource*); | |
33 | |
34 // This currently returns a bool and fails when an existing resource has a k
ey that collides | 32 // This currently returns a bool and fails when an existing resource has a k
ey that collides |
35 // with the new content key. In the future it will null out the content key
for the existing | 33 // with the new content key. In the future it will null out the content key
for the existing |
36 // resource. The failure is a temporary measure taken because duties are spl
it between two | 34 // resource. The failure is a temporary measure taken because duties are spl
it between two |
37 // cache objects currently. | 35 // cache objects currently. |
38 bool didAddContentKey(GrGpuResource*); | 36 bool didSetContentKey(GrGpuResource*); |
39 | 37 |
40 void abandonAll(); | 38 void abandonAll(); |
41 | 39 |
42 void releaseAll(); | 40 void releaseAll(); |
43 | 41 |
44 enum { | 42 enum { |
45 /** Preferentially returns scratch resources with no pending IO. */ | 43 /** Preferentially returns scratch resources with no pending IO. */ |
46 kPreferNoPendingIO_ScratchFlag = 0x1, | 44 kPreferNoPendingIO_ScratchFlag = 0x1, |
47 /** Will not return any resources that match but have pending IO. */ | 45 /** Will not return any resources that match but have pending IO. */ |
48 kRequireNoPendingIO_ScratchFlag = 0x2, | 46 kRequireNoPendingIO_ScratchFlag = 0x2, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 92 |
95 int fCount; | 93 int fCount; |
96 SkTInternalLList<GrGpuResource> fResources; | 94 SkTInternalLList<GrGpuResource> fResources; |
97 // This map holds all resources that can be used as scratch resources. | 95 // This map holds all resources that can be used as scratch resources. |
98 ScratchMap fScratchMap; | 96 ScratchMap fScratchMap; |
99 // This holds all resources that have content keys. | 97 // This holds all resources that have content keys. |
100 ContentHash fContentHash; | 98 ContentHash fContentHash; |
101 }; | 99 }; |
102 | 100 |
103 #endif | 101 #endif |
OLD | NEW |