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

Side by Side Diff: include/ports/SkMacImageCache.h

Issue 12433020: Improvements/additions to SkImageCache/SkLazyPixelRef. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Modified a comment. Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef SkMacImageCache_DEFINED
9 #define SkMacImageCache_DEFINED
10
11 #include "SkImageCache.h"
12
13 #ifdef SK_DEBUG
14 #include "SkTDArray.h"
15 #endif
16
17 #include <mach/mach.h>
18
19
20 /**
21 * Interface for a cache that manages pixel memory.
22 */
23 class SkMacImageCache : public SkImageCache {
24
25 public:
26 /**
27 * Get a pointer to the single global instance of SkMacImageCache.
28 */
29 static SkMacImageCache* GetMacImageCache();
30
31 virtual void* allocAndPinCache(size_t bytes, intptr_t* ID) SK_OVERRIDE;
32 virtual void* pinCache(intptr_t ID, SkImageCache::PurgeStatus*) SK_OVERRIDE;
33 virtual void releaseCache(intptr_t ID) SK_OVERRIDE;
34 virtual void throwAwayCache(intptr_t ID) SK_OVERRIDE;
35
36 #ifdef SK_DEBUG
37 virtual PinStatus getPinStatus(intptr_t ID) const SK_OVERRIDE;
38 virtual void purgeAllCaches() SK_OVERRIDE;
39 virtual ~SkMacImageCache();
40 #endif
41
42 private:
43 /**
44 * Constructor is private. The correct way to get this cache is through
45 * GetMacImageCache, so that all callers can get the single global.
46 */
47 SkMacImageCache();
48
49 struct Rec {
50 vm_address_t fAddr;
51 vm_size_t fSize;
52 #ifdef SK_DEBUG
53 bool fPinned;
54 #endif
55 };
56
57 #ifdef SK_DEBUG
58 SkTDArray<intptr_t> fRecs;
59 int findRec(intptr_t) const;
60 #endif
61 void removeRec(intptr_t);
62 };
63 #endif // SkMacImageCache_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698