OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 | 9 |
10 | 10 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 static SkData* NewWithProc(const void* data, size_t length, | 82 static SkData* NewWithProc(const void* data, size_t length, |
83 ReleaseProc proc, void* context); | 83 ReleaseProc proc, void* context); |
84 | 84 |
85 /** | 85 /** |
86 * Create a new dataref from a pointer allocated by malloc. The Data object | 86 * Create a new dataref from a pointer allocated by malloc. The Data object |
87 * takes ownership of that allocation, and will handling calling sk_free. | 87 * takes ownership of that allocation, and will handling calling sk_free. |
88 */ | 88 */ |
89 static SkData* NewFromMalloc(const void* data, size_t length); | 89 static SkData* NewFromMalloc(const void* data, size_t length); |
90 | 90 |
91 /** | 91 /** |
| 92 * Create a new dataref from a pointer allocated by mmap. The Data object |
| 93 * will handle calling munmap(). |
| 94 */ |
| 95 static SkData* NewFromMMap(const void* data, size_t length); |
| 96 |
| 97 /** |
92 * Create a new dataref using a subset of the data in the specified | 98 * Create a new dataref using a subset of the data in the specified |
93 * src dataref. | 99 * src dataref. |
94 */ | 100 */ |
95 static SkData* NewSubset(const SkData* src, size_t offset, size_t length); | 101 static SkData* NewSubset(const SkData* src, size_t offset, size_t length); |
96 | 102 |
97 /** | 103 /** |
98 * Returns a new empty dataref (or a reference to a shared empty dataref). | 104 * Returns a new empty dataref (or a reference to a shared empty dataref). |
99 * New or shared, the caller must see that unref() is eventually called. | 105 * New or shared, the caller must see that unref() is eventually called. |
100 */ | 106 */ |
101 static SkData* NewEmpty(); | 107 static SkData* NewEmpty(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 } | 153 } |
148 | 154 |
149 SkData *operator->() const { return fRef; } | 155 SkData *operator->() const { return fRef; } |
150 operator SkData*() { return fRef; } | 156 operator SkData*() { return fRef; } |
151 | 157 |
152 private: | 158 private: |
153 SkData* fRef; | 159 SkData* fRef; |
154 }; | 160 }; |
155 | 161 |
156 #endif | 162 #endif |
OLD | NEW |