OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 // of "dest" is not guaranteed. | 117 // of "dest" is not guaranteed. |
118 HAS_STRICTLY_TYPED_ARG | 118 HAS_STRICTLY_TYPED_ARG |
119 bool getAsBytes(void* dest, STRICTLY_TYPED_ARG(byteLength)) const { | 119 bool getAsBytes(void* dest, STRICTLY_TYPED_ARG(byteLength)) const { |
120 STRICT_ARG_TYPE(size_t); | 120 STRICT_ARG_TYPE(size_t); |
121 if (byteLength != size()) | 121 if (byteLength != size()) |
122 return false; | 122 return false; |
123 | 123 |
124 return getAsBytesInternal(dest, 0, byteLength); | 124 return getAsBytesInternal(dest, 0, byteLength); |
125 } | 125 } |
126 | 126 |
127 // Copies "byteLength" bytes from "position"-th bytes (0 origin) of the conten
t | 127 // Copies "byteLength" bytes from "position"-th bytes (0 origin) of the |
128 // data into "dest" as a flat buffer, | 128 // content data into "dest" as a flat buffer, Returns true on success, |
129 // Returns true on success, otherwise the content of "dest" is not guaranteed. | 129 // otherwise the content of "dest" is not guaranteed. |
130 HAS_STRICTLY_TYPED_ARG | 130 HAS_STRICTLY_TYPED_ARG |
131 bool getPartAsBytes(void* dest, | 131 bool getPartAsBytes(void* dest, |
132 STRICTLY_TYPED_ARG(position), | 132 STRICTLY_TYPED_ARG(position), |
133 STRICTLY_TYPED_ARG(byteLength)) const { | 133 STRICTLY_TYPED_ARG(byteLength)) const { |
134 STRICT_ARG_TYPE(size_t); | 134 STRICT_ARG_TYPE(size_t); |
135 return getAsBytesInternal(dest, position, byteLength); | 135 return getAsBytesInternal(dest, position, byteLength); |
136 } | 136 } |
137 | 137 |
138 // Creates an SkData and copies this SharedBuffer's contents to that | 138 // Creates an SkData and copies this SharedBuffer's contents to that |
139 // SkData without merging segmented buffers into a flat buffer. | 139 // SkData without merging segmented buffers into a flat buffer. |
(...skipping 15 matching lines...) Expand all Loading... |
155 size_t getSomeDataInternal(const char*& data, size_t position) const; | 155 size_t getSomeDataInternal(const char*& data, size_t position) const; |
156 | 156 |
157 size_t m_size; | 157 size_t m_size; |
158 mutable Vector<char> m_buffer; | 158 mutable Vector<char> m_buffer; |
159 mutable Vector<char*> m_segments; | 159 mutable Vector<char*> m_segments; |
160 }; | 160 }; |
161 | 161 |
162 } // namespace blink | 162 } // namespace blink |
163 | 163 |
164 #endif // SharedBuffer_h | 164 #endif // SharedBuffer_h |
OLD | NEW |