| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 return m_baseAddress; | 63 return m_baseAddress; |
| 64 } | 64 } |
| 65 | 65 |
| 66 unsigned byteOffset() const | 66 unsigned byteOffset() const |
| 67 { | 67 { |
| 68 return m_byteOffset; | 68 return m_byteOffset; |
| 69 } | 69 } |
| 70 | 70 |
| 71 virtual unsigned byteLength() const = 0; | 71 virtual unsigned byteLength() const = 0; |
| 72 | 72 |
| 73 void setNeuterable(bool flag) { m_isNeuterable = flag; } |
| 74 bool isNeuterable() const { return m_isNeuterable; } |
| 75 |
| 73 virtual ~ArrayBufferView(); | 76 virtual ~ArrayBufferView(); |
| 74 | 77 |
| 75 protected: | 78 protected: |
| 76 ArrayBufferView(PassRefPtr<ArrayBuffer>, unsigned byteOffset); | 79 ArrayBufferView(PassRefPtr<ArrayBuffer>, unsigned byteOffset); |
| 77 | 80 |
| 78 inline bool setImpl(ArrayBufferView*, unsigned byteOffset); | 81 inline bool setImpl(ArrayBufferView*, unsigned byteOffset); |
| 79 | 82 |
| 80 inline bool setRangeImpl(const char* data, size_t dataByteLength, unsigned b
yteOffset); | 83 inline bool setRangeImpl(const char* data, size_t dataByteLength, unsigned b
yteOffset); |
| 81 | 84 |
| 82 inline bool zeroRangeImpl(unsigned byteOffset, size_t rangeByteLength); | 85 inline bool zeroRangeImpl(unsigned byteOffset, size_t rangeByteLength); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 *offset = std::min(buffer->byteLength(), *offset); | 124 *offset = std::min(buffer->byteLength(), *offset); |
| 122 unsigned remainingElements = (buffer->byteLength() - *offset) / sizeof(T
); | 125 unsigned remainingElements = (buffer->byteLength() - *offset) / sizeof(T
); |
| 123 *numElements = std::min(remainingElements, *numElements); | 126 *numElements = std::min(remainingElements, *numElements); |
| 124 } | 127 } |
| 125 | 128 |
| 126 virtual void neuter(); | 129 virtual void neuter(); |
| 127 | 130 |
| 128 // This is the address of the ArrayBuffer's storage, plus the byte offset. | 131 // This is the address of the ArrayBuffer's storage, plus the byte offset. |
| 129 void* m_baseAddress; | 132 void* m_baseAddress; |
| 130 | 133 |
| 131 unsigned m_byteOffset; | 134 unsigned m_byteOffset : 31; |
| 135 bool m_isNeuterable : 1; |
| 132 | 136 |
| 133 private: | 137 private: |
| 134 friend class ArrayBuffer; | 138 friend class ArrayBuffer; |
| 135 RefPtr<ArrayBuffer> m_buffer; | 139 RefPtr<ArrayBuffer> m_buffer; |
| 136 ArrayBufferView* m_prevView; | 140 ArrayBufferView* m_prevView; |
| 137 ArrayBufferView* m_nextView; | 141 ArrayBufferView* m_nextView; |
| 138 }; | 142 }; |
| 139 | 143 |
| 140 bool ArrayBufferView::setImpl(ArrayBufferView* array, unsigned byteOffset) | 144 bool ArrayBufferView::setImpl(ArrayBufferView* array, unsigned byteOffset) |
| 141 { | 145 { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 end = start; | 200 end = start; |
| 197 *offset = static_cast<unsigned>(start); | 201 *offset = static_cast<unsigned>(start); |
| 198 *length = static_cast<unsigned>(end - start); | 202 *length = static_cast<unsigned>(end - start); |
| 199 } | 203 } |
| 200 | 204 |
| 201 } // namespace WTF | 205 } // namespace WTF |
| 202 | 206 |
| 203 using WTF::ArrayBufferView; | 207 using WTF::ArrayBufferView; |
| 204 | 208 |
| 205 #endif // ArrayBufferView_h | 209 #endif // ArrayBufferView_h |
| OLD | NEW |