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

Side by Side Diff: src/lazy/SkDiscardableMemoryPool.cpp

Issue 806653007: Fix up all the easy virtual ... SK_OVERRIDE cases. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 11 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/lazy/SkCachingPixelRef.h ('k') | src/lazy/SkDiscardablePixelRef.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 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkDiscardableMemory.h" 8 #include "SkDiscardableMemory.h"
9 #include "SkDiscardableMemoryPool.h" 9 #include "SkDiscardableMemoryPool.h"
10 #include "SkImageGenerator.h" 10 #include "SkImageGenerator.h"
(...skipping 14 matching lines...) Expand all
25 * pool works. 25 * pool works.
26 */ 26 */
27 class DiscardableMemoryPool : public SkDiscardableMemoryPool { 27 class DiscardableMemoryPool : public SkDiscardableMemoryPool {
28 public: 28 public:
29 /** 29 /**
30 * Without mutex, will be not be thread safe. 30 * Without mutex, will be not be thread safe.
31 */ 31 */
32 DiscardableMemoryPool(size_t budget, SkBaseMutex* mutex = NULL); 32 DiscardableMemoryPool(size_t budget, SkBaseMutex* mutex = NULL);
33 virtual ~DiscardableMemoryPool(); 33 virtual ~DiscardableMemoryPool();
34 34
35 virtual SkDiscardableMemory* create(size_t bytes) SK_OVERRIDE; 35 SkDiscardableMemory* create(size_t bytes) SK_OVERRIDE;
36 36
37 virtual size_t getRAMUsed() SK_OVERRIDE; 37 size_t getRAMUsed() SK_OVERRIDE;
38 virtual void setRAMBudget(size_t budget) SK_OVERRIDE; 38 void setRAMBudget(size_t budget) SK_OVERRIDE;
39 virtual size_t getRAMBudget() SK_OVERRIDE { return fBudget; } 39 size_t getRAMBudget() SK_OVERRIDE { return fBudget; }
40 40
41 /** purges all unlocked DMs */ 41 /** purges all unlocked DMs */
42 virtual void dumpPool() SK_OVERRIDE; 42 void dumpPool() SK_OVERRIDE;
43 43
44 #if SK_LAZY_CACHE_STATS // Defined in SkDiscardableMemoryPool.h 44 #if SK_LAZY_CACHE_STATS // Defined in SkDiscardableMemoryPool.h
45 virtual int getCacheHits() SK_OVERRIDE { return fCacheHits; } 45 int getCacheHits() SK_OVERRIDE { return fCacheHits; }
46 virtual int getCacheMisses() SK_OVERRIDE { return fCacheMisses; } 46 int getCacheMisses() SK_OVERRIDE { return fCacheMisses; }
47 virtual void resetCacheHitsAndMisses() SK_OVERRIDE { 47 void resetCacheHitsAndMisses() SK_OVERRIDE {
48 fCacheHits = fCacheMisses = 0; 48 fCacheHits = fCacheMisses = 0;
49 } 49 }
50 int fCacheHits; 50 int fCacheHits;
51 int fCacheMisses; 51 int fCacheMisses;
52 #endif // SK_LAZY_CACHE_STATS 52 #endif // SK_LAZY_CACHE_STATS
53 53
54 private: 54 private:
55 SkBaseMutex* fMutex; 55 SkBaseMutex* fMutex;
56 size_t fBudget; 56 size_t fBudget;
57 size_t fUsed; 57 size_t fUsed;
(...skipping 15 matching lines...) Expand all
73 73
74 /** 74 /**
75 * A PoolDiscardableMemory is a SkDiscardableMemory that relies on 75 * A PoolDiscardableMemory is a SkDiscardableMemory that relies on
76 * a DiscardableMemoryPool object to manage the memory. 76 * a DiscardableMemoryPool object to manage the memory.
77 */ 77 */
78 class PoolDiscardableMemory : public SkDiscardableMemory { 78 class PoolDiscardableMemory : public SkDiscardableMemory {
79 public: 79 public:
80 PoolDiscardableMemory(DiscardableMemoryPool* pool, 80 PoolDiscardableMemory(DiscardableMemoryPool* pool,
81 void* pointer, size_t bytes); 81 void* pointer, size_t bytes);
82 virtual ~PoolDiscardableMemory(); 82 virtual ~PoolDiscardableMemory();
83 virtual bool lock() SK_OVERRIDE; 83 bool lock() SK_OVERRIDE;
84 virtual void* data() SK_OVERRIDE; 84 void* data() SK_OVERRIDE;
85 virtual void unlock() SK_OVERRIDE; 85 void unlock() SK_OVERRIDE;
86 friend class DiscardableMemoryPool; 86 friend class DiscardableMemoryPool;
87 private: 87 private:
88 SK_DECLARE_INTERNAL_LLIST_INTERFACE(PoolDiscardableMemory); 88 SK_DECLARE_INTERNAL_LLIST_INTERFACE(PoolDiscardableMemory);
89 DiscardableMemoryPool* const fPool; 89 DiscardableMemoryPool* const fPool;
90 bool fLocked; 90 bool fLocked;
91 void* fPointer; 91 void* fPointer;
92 const size_t fBytes; 92 const size_t fBytes;
93 }; 93 };
94 94
95 PoolDiscardableMemory::PoolDiscardableMemory(DiscardableMemoryPool* pool, 95 PoolDiscardableMemory::PoolDiscardableMemory(DiscardableMemoryPool* pool,
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 return SkNEW_ARGS(DiscardableMemoryPool, (size, mutex)); 260 return SkNEW_ARGS(DiscardableMemoryPool, (size, mutex));
261 } 261 }
262 262
263 SK_DECLARE_STATIC_LAZY_PTR(SkDiscardableMemoryPool, global, create_global_pool); 263 SK_DECLARE_STATIC_LAZY_PTR(SkDiscardableMemoryPool, global, create_global_pool);
264 264
265 SkDiscardableMemoryPool* SkGetGlobalDiscardableMemoryPool() { 265 SkDiscardableMemoryPool* SkGetGlobalDiscardableMemoryPool() {
266 return global.get(); 266 return global.get();
267 } 267 }
268 268
269 //////////////////////////////////////////////////////////////////////////////// 269 ////////////////////////////////////////////////////////////////////////////////
OLDNEW
« no previous file with comments | « src/lazy/SkCachingPixelRef.h ('k') | src/lazy/SkDiscardablePixelRef.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698