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

Side by Side Diff: src/core/SkDiscardableMemory.h

Issue 22956004: skia: Added SkDiscardableMemory interface. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Rebase Created 7 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 | Annotate | Revision Log
« no previous file with comments | « gyp/ports.gyp ('k') | src/ports/SkDiscardableMemory_none.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 SkDiscardableMemory_DEFINED
9 #define SkDiscardableMemory_DEFINED
10
11 #include "SkTypes.h"
12
13 /**
14 * Interface for discardable memory. Implementation is provided by the
15 * embedder.
16 */
17 class SkDiscardableMemory {
18
19 public:
20 /**
21 * Factory method that creates, initializes and locks an SkDiscardableMemor y
22 * object. If either of these steps fails, a NULL pointer will be returned.
23 */
24 static SkDiscardableMemory* Create(size_t bytes);
25
26 /** Must not be called while locked.
27 */
28 virtual ~SkDiscardableMemory() {}
29
30 /**
31 * Locks the memory, prevent it from being discarded. Once locked. you may
32 * obtain a pointer to that memory using the data() method.
33 *
34 * lock() may return false, indicating that the underlying memory was
35 * discarded and that the lock failed.
36 *
37 * Nested calls to lock are not allowed.
38 */
39 virtual bool lock() = 0;
40
41 /**
42 * Returns the current pointer for the discardable memory. This call is ONLY
43 * valid when the discardable memory object is locked.
44 */
45 virtual void* data() = 0;
46
47 /**
48 * Unlock the memory so that it can be purged by the system. Must be called
49 * after every successful lock call.
50 */
51 virtual void unlock() = 0;
52 };
53
54 #endif
OLDNEW
« no previous file with comments | « gyp/ports.gyp ('k') | src/ports/SkDiscardableMemory_none.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698