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

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

Issue 894013002: patch from issue 886233004 at patchset 40001 (http://crrev.com/886233004#ps40001) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 10 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 | « src/gpu/GrGpu.h ('k') | src/gpu/GrResourceCache2.cpp » ('j') | 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 #ifndef GrResourceCache2_DEFINED 9 #ifndef GrResourceCache2_DEFINED
10 #define GrResourceCache2_DEFINED 10 #define GrResourceCache2_DEFINED
11 11
12 #include "GrGpuResource.h" 12 #include "GrGpuResource.h"
13 #include "GrGpuResourceCacheAccess.h" 13 #include "GrGpuResourceCacheAccess.h"
14 #include "GrResourceKey.h" 14 #include "GrResourceKey.h"
15 #include "SkRefCnt.h" 15 #include "SkRefCnt.h"
16 #include "SkTInternalLList.h" 16 #include "SkTInternalLList.h"
17 #include "SkTMultiMap.h" 17 #include "SkTMultiMap.h"
18 18
19 class SkString;
20
19 /** 21 /**
20 * Manages the lifetime of all GrGpuResource instances. 22 * Manages the lifetime of all GrGpuResource instances.
21 * 23 *
22 * Resources may have optionally have two types of keys: 24 * Resources may have optionally have two types of keys:
23 * 1) A scratch key. This is for resources whose allocations are cached but not their contents. 25 * 1) A scratch key. This is for resources whose allocations are cached but not their contents.
24 * Multiple resources can share the same scratch key. This is so a calle r can have two 26 * Multiple resources can share the same scratch key. This is so a calle r can have two
25 * resource instances with the same properties (e.g. multipass rendering that ping-pongs 27 * resource instances with the same properties (e.g. multipass rendering that ping-pongs
26 * between two temporary surfaces. The scratch key is set at resource cr eation time and 28 * between two temporary surfaces. The scratch key is set at resource cr eation time and
27 * should never change. Resources need not have a scratch key. 29 * should never change. Resources need not have a scratch key.
28 * 2) A content key. This key represents the contents of the resource rathe r than just its 30 * 2) A content key. This key represents the contents of the resource rathe r than just its
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 * Set the callback the cache should use when it is still over budget after a purge. The 'data' 141 * Set the callback the cache should use when it is still over budget after a purge. The 'data'
140 * provided here will be passed back to the callback. Note that the cache wi ll attempt to purge 142 * provided here will be passed back to the callback. Note that the cache wi ll attempt to purge
141 * any resources newly freed by the callback. 143 * any resources newly freed by the callback.
142 */ 144 */
143 void setOverBudgetCallback(PFOverBudgetCB overBudgetCB, void* data) { 145 void setOverBudgetCallback(PFOverBudgetCB overBudgetCB, void* data) {
144 fOverBudgetCB = overBudgetCB; 146 fOverBudgetCB = overBudgetCB;
145 fOverBudgetData = data; 147 fOverBudgetData = data;
146 } 148 }
147 149
148 #if GR_GPU_STATS 150 #if GR_GPU_STATS
149 void printStats() const; 151 void dumpStats(SkString*) const;
150 #endif 152 #endif
151 153
152 private: 154 private:
153 /////////////////////////////////////////////////////////////////////////// 155 ///////////////////////////////////////////////////////////////////////////
154 /// @name Methods accessible via ResourceAccess 156 /// @name Methods accessible via ResourceAccess
155 //// 157 ////
156 void insertResource(GrGpuResource*); 158 void insertResource(GrGpuResource*);
157 void removeResource(GrGpuResource*); 159 void removeResource(GrGpuResource*);
158 void notifyPurgeable(GrGpuResource*); 160 void notifyPurgeable(GrGpuResource*);
159 void didChangeGpuMemorySize(const GrGpuResource*, size_t oldSize); 161 void didChangeGpuMemorySize(const GrGpuResource*, size_t oldSize);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 297
296 friend class GrGpuResource; // To access all the proxy inline methods. 298 friend class GrGpuResource; // To access all the proxy inline methods.
297 friend class GrResourceCache2; // To create this type. 299 friend class GrResourceCache2; // To create this type.
298 }; 300 };
299 301
300 inline GrResourceCache2::ResourceAccess GrResourceCache2::resourceAccess() { 302 inline GrResourceCache2::ResourceAccess GrResourceCache2::resourceAccess() {
301 return ResourceAccess(this); 303 return ResourceAccess(this);
302 } 304 }
303 305
304 #endif 306 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrGpu.h ('k') | src/gpu/GrResourceCache2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698