| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (c) 2010, Google Inc. All rights reserved. | 3 * Copyright (c) 2010, Google Inc. 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 16 matching lines...) Expand all Loading... |
| 27 #ifndef TypedArrayBase_h | 27 #ifndef TypedArrayBase_h |
| 28 #define TypedArrayBase_h | 28 #define TypedArrayBase_h |
| 29 | 29 |
| 30 #include "wtf/ArrayBuffer.h" | 30 #include "wtf/ArrayBuffer.h" |
| 31 #include "wtf/ArrayBufferView.h" | 31 #include "wtf/ArrayBufferView.h" |
| 32 | 32 |
| 33 namespace WTF { | 33 namespace WTF { |
| 34 | 34 |
| 35 template <typename T> | 35 template <typename T> |
| 36 class TypedArrayBase : public ArrayBufferView { | 36 class TypedArrayBase : public ArrayBufferView { |
| 37 public: | 37 public: |
| 38 typedef T ValueType; |
| 39 |
| 38 T* data() const { return static_cast<T*>(baseAddress()); } | 40 T* data() const { return static_cast<T*>(baseAddress()); } |
| 39 | 41 |
| 40 bool set(TypedArrayBase<T>* array, unsigned offset) | 42 bool set(TypedArrayBase<T>* array, unsigned offset) |
| 41 { | 43 { |
| 42 return setImpl(array, offset * sizeof(T)); | 44 return setImpl(array, offset * sizeof(T)); |
| 43 } | 45 } |
| 44 | 46 |
| 45 bool setRange(const T* data, size_t dataLength, unsigned offset) | 47 bool setRange(const T* data, size_t dataLength, unsigned offset) |
| 46 { | 48 { |
| 47 return setRangeImpl(reinterpret_cast<const char*>(data), dataLength * si
zeof(T), offset * sizeof(T)); | 49 return setRangeImpl(reinterpret_cast<const char*>(data), dataLength * si
zeof(T), offset * sizeof(T)); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // We do not want to have to access this via a virtual function in subclasse
s, | 148 // We do not want to have to access this via a virtual function in subclasse
s, |
| 147 // which is why it is protected rather than private. | 149 // which is why it is protected rather than private. |
| 148 unsigned m_length; | 150 unsigned m_length; |
| 149 }; | 151 }; |
| 150 | 152 |
| 151 } // namespace WTF | 153 } // namespace WTF |
| 152 | 154 |
| 153 using WTF::TypedArrayBase; | 155 using WTF::TypedArrayBase; |
| 154 | 156 |
| 155 #endif // TypedArrayBase_h | 157 #endif // TypedArrayBase_h |
| OLD | NEW |