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

Side by Side Diff: Source/wtf/TypedArrayBase.h

Issue 606653006: bindings: Adds DOMArrayBuffer, etc. as thin wrappers for ArrayBuffer, etc. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Synced. Created 6 years, 2 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 | « Source/wtf/ArrayBufferContents.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « Source/wtf/ArrayBufferContents.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698