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

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

Issue 705413002: Remove GrResourceKey from GrResourceCache (Closed) Base URL: https://skia.googlesource.com/skia.git@content
Patch Set: rebase Created 6 years, 1 month 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
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 GrResourceCache2_DEFINED 9 #ifndef GrResourceCache2_DEFINED
10 #define GrResourceCache2_DEFINED 10 #define GrResourceCache2_DEFINED
(...skipping 11 matching lines...) Expand all
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,
49 }; 47 };
50 GrGpuResource* findAndRefScratchResource(const GrResourceKey& scratchKey, ui nt32_t flags = 0); 48 GrGpuResource* findAndRefScratchResource(const GrResourceKey& scratchKey, ui nt32_t flags = 0);
51 49
52 #ifdef SK_DEBUG 50 #ifdef SK_DEBUG
53 // This is not particularly fast and only used for validation, so debug only . 51 // Not particularly fast and only used for validation, so debug-only
54 int countScratchEntriesForKey(const GrResourceKey& scratchKey) const { 52 int countScratchEntriesForKey(const GrResourceKey& scratchKey) const {
55 SkASSERT(scratchKey.isScratch()); 53 SkASSERT(scratchKey.isScratch());
56 return fScratchMap.countForKey(scratchKey); 54 return fScratchMap.countForKey(scratchKey);
57 } 55 }
58 #endif 56 #endif
59 57
60 GrGpuResource* findAndRefContentResource(const GrResourceKey& contentKey) { 58 GrGpuResource* findAndRefContentResource(const GrResourceKey& contentKey) {
61 SkASSERT(!contentKey.isScratch()); 59 SkASSERT(!contentKey.isScratch());
62 return SkSafeRef(fContentHash.find(contentKey)); 60 return SkSafeRef(fContentHash.find(contentKey));
63 } 61 }
(...skipping 30 matching lines...) Expand all
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698