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

Side by Side Diff: bench/GrResourceCacheBench.cpp

Issue 923143002: Split out methods in GrGpuResource::CacheAccess that can be called outside of the cache. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: do warning workaround in the right place 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 | « no previous file | gyp/gpu.gypi » ('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 "Benchmark.h" 9 #include "Benchmark.h"
10 10
11 #if SK_SUPPORT_GPU 11 #if SK_SUPPORT_GPU
12 12
13 #include "GrGpuResource.h" 13 #include "GrGpuResource.h"
14 #include "GrGpuResourcePriv.h"
14 #include "GrContext.h" 15 #include "GrContext.h"
15 #include "GrGpu.h" 16 #include "GrGpu.h"
16 #include "GrResourceCache.h" 17 #include "GrResourceCache.h"
17 #include "SkCanvas.h" 18 #include "SkCanvas.h"
18 19
19 enum { 20 enum {
20 CACHE_SIZE_COUNT = 4096, 21 CACHE_SIZE_COUNT = 4096,
21 }; 22 };
22 23
23 class BenchResource : public GrGpuResource { 24 class BenchResource : public GrGpuResource {
(...skipping 14 matching lines...) Expand all
38 size_t onGpuMemorySize() const SK_OVERRIDE { return 100; } 39 size_t onGpuMemorySize() const SK_OVERRIDE { return 100; }
39 40
40 typedef GrGpuResource INHERITED; 41 typedef GrGpuResource INHERITED;
41 }; 42 };
42 43
43 static void populate_cache(GrGpu* gpu, int resourceCount) { 44 static void populate_cache(GrGpu* gpu, int resourceCount) {
44 for (int i = 0; i < resourceCount; ++i) { 45 for (int i = 0; i < resourceCount; ++i) {
45 GrContentKey key; 46 GrContentKey key;
46 BenchResource::ComputeKey(i, &key); 47 BenchResource::ComputeKey(i, &key);
47 GrGpuResource* resource = SkNEW_ARGS(BenchResource, (gpu)); 48 GrGpuResource* resource = SkNEW_ARGS(BenchResource, (gpu));
48 resource->cacheAccess().setContentKey(key); 49 resource->resourcePriv().setContentKey(key);
49 resource->unref(); 50 resource->unref();
50 } 51 }
51 } 52 }
52 53
53 class GrResourceCacheBenchAdd : public Benchmark { 54 class GrResourceCacheBenchAdd : public Benchmark {
54 public: 55 public:
55 bool isSuitableFor(Backend backend) SK_OVERRIDE { 56 bool isSuitableFor(Backend backend) SK_OVERRIDE {
56 return backend == kNonRendering_Backend; 57 return backend == kNonRendering_Backend;
57 } 58 }
58 59
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 136
136 private: 137 private:
137 SkAutoTUnref<GrContext> fContext; 138 SkAutoTUnref<GrContext> fContext;
138 typedef Benchmark INHERITED; 139 typedef Benchmark INHERITED;
139 }; 140 };
140 141
141 DEF_BENCH( return new GrResourceCacheBenchAdd(); ) 142 DEF_BENCH( return new GrResourceCacheBenchAdd(); )
142 DEF_BENCH( return new GrResourceCacheBenchFind(); ) 143 DEF_BENCH( return new GrResourceCacheBenchFind(); )
143 144
144 #endif 145 #endif
OLDNEW
« no previous file with comments | « no previous file | gyp/gpu.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698