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

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

Issue 1264283002: Add abliity to set textblob cache budget to GrContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweak Created 5 years, 4 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 | « include/gpu/GrContext.h ('k') | src/gpu/GrTextBlobCache.h » ('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 2013 Google Inc. 3 * Copyright 2013 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 #include "GrTest.h" 9 #include "GrTest.h"
10 10
11 #include "GrBufferedDrawTarget.h" 11 #include "GrBufferedDrawTarget.h"
12 #include "GrContextOptions.h" 12 #include "GrContextOptions.h"
13 #include "GrGpuResourceCacheAccess.h" 13 #include "GrGpuResourceCacheAccess.h"
14 #include "GrResourceCache.h" 14 #include "GrResourceCache.h"
15 #include "GrTextBlobCache.h"
15 #include "SkString.h" 16 #include "SkString.h"
16 17
17 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) { 18 void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) {
18 SkASSERT(!fContext); 19 SkASSERT(!fContext);
19 20
20 fContext.reset(SkRef(ctx)); 21 fContext.reset(SkRef(ctx));
21 fDrawTarget.reset(SkRef(target)); 22 fDrawTarget.reset(SkRef(target));
22 } 23 }
23 24
24 void GrContext::getTestTarget(GrTestTarget* tar) { 25 void GrContext::getTestTarget(GrTestTarget* tar) {
25 this->flush(); 26 this->flush();
26 // We could create a proxy GrDrawTarget that passes through to fGpu until ~G rTextTarget() and 27 // We could create a proxy GrDrawTarget that passes through to fGpu until ~G rTextTarget() and
27 // then disconnects. This would help prevent test writers from mixing using the returned 28 // then disconnects. This would help prevent test writers from mixing using the returned
28 // GrDrawTarget and regular drawing. We could also assert or fail in GrConte xt drawing methods 29 // GrDrawTarget and regular drawing. We could also assert or fail in GrConte xt drawing methods
29 // until ~GrTestTarget(). 30 // until ~GrTestTarget().
30 tar->init(this, fDrawingMgr.fDrawTarget); 31 tar->init(this, fDrawingMgr.fDrawTarget);
31 } 32 }
32 33
34 void GrContext::setTextBlobCacheLimit_ForTesting(size_t bytes) {
35 fTextBlobCache->setBudget(bytes);
36 }
37
33 /////////////////////////////////////////////////////////////////////////////// 38 ///////////////////////////////////////////////////////////////////////////////
34 39
35 void GrContext::purgeAllUnlockedResources() { 40 void GrContext::purgeAllUnlockedResources() {
36 fResourceCache->purgeAllUnlocked(); 41 fResourceCache->purgeAllUnlocked();
37 } 42 }
38 43
39 void GrContext::dumpCacheStats(SkString* out) const { 44 void GrContext::dumpCacheStats(SkString* out) const {
40 #if GR_CACHE_STATS 45 #if GR_CACHE_STATS
41 fResourceCache->dumpStats(out); 46 fResourceCache->dumpStats(out);
42 #endif 47 #endif
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 SkASSERT(NULL == fGpu); 263 SkASSERT(NULL == fGpu);
259 fGpu = SkNEW_ARGS(MockGpu, (this, options)); 264 fGpu = SkNEW_ARGS(MockGpu, (this, options));
260 SkASSERT(fGpu); 265 SkASSERT(fGpu);
261 this->initCommon(); 266 this->initCommon();
262 267
263 // We delete these because we want to test the cache starting with zero reso urces. Also, none of 268 // We delete these because we want to test the cache starting with zero reso urces. Also, none of
264 // these objects are required for any of tests that use this context. TODO: make stop allocating 269 // these objects are required for any of tests that use this context. TODO: make stop allocating
265 // resources in the buffer pools. 270 // resources in the buffer pools.
266 fDrawingMgr.abandon(); 271 fDrawingMgr.abandon();
267 } 272 }
OLDNEW
« no previous file with comments | « include/gpu/GrContext.h ('k') | src/gpu/GrTextBlobCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698