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

Unified Diff: Source/core/dom/DOMTypedArray.cpp

Issue 1017183003: Make DOMTypedArray exported. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/DOMTypedArray.h ('k') | Source/modules/webaudio/AudioBuffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/DOMTypedArray.cpp
diff --git a/Source/core/dom/DOMTypedArray.cpp b/Source/core/dom/DOMTypedArray.cpp
index ec4d1c7a9aabae4552bc3c47b7fbc9d6194f432c..7f4c52dfac3626f406e8899ab41a2f5bd49bf43b 100644
--- a/Source/core/dom/DOMTypedArray.cpp
+++ b/Source/core/dom/DOMTypedArray.cpp
@@ -8,6 +8,15 @@
#include "bindings/core/v8/DOMDataStore.h"
#include "bindings/core/v8/V8ArrayBuffer.h"
#include "bindings/core/v8/V8DOMWrapper.h"
+#include "bindings/core/v8/V8Float32Array.h"
+#include "bindings/core/v8/V8Float64Array.h"
+#include "bindings/core/v8/V8Int16Array.h"
+#include "bindings/core/v8/V8Int32Array.h"
+#include "bindings/core/v8/V8Int8Array.h"
+#include "bindings/core/v8/V8Uint16Array.h"
+#include "bindings/core/v8/V8Uint32Array.h"
+#include "bindings/core/v8/V8Uint8Array.h"
+#include "bindings/core/v8/V8Uint8ClampedArray.h"
namespace blink {
@@ -37,24 +46,40 @@ v8::Handle<v8::Object> DOMTypedArray<WTFTypedArray, V8TypedArray>::associateWith
return V8DOMWrapper::associateObjectWithWrapper(isolate, this, wrapperTypeInfo, wrapper);
}
-// Instantiation of the non-inline functions of the template classes.
-#define INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS(Type) \
- INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS_IMPL(WTF::Type##Array, v8::Type##Array)
-#define INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS_IMPL(WTFTypedArray, V8TypedArray) \
-template v8::Handle<v8::Object> DOMTypedArray<WTFTypedArray, V8TypedArray>::wrap(v8::Handle<v8::Object> creationContext, v8::Isolate*); \
-template v8::Handle<v8::Object> DOMTypedArray<WTFTypedArray, V8TypedArray>::associateWithWrapper(v8::Isolate*, const WrapperTypeInfo*, v8::Handle<v8::Object> wrapper)
-
-INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS(Int8);
-INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS(Int16);
-INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS(Int32);
-INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS(Uint8);
-INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS(Uint8Clamped);
-INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS(Uint16);
-INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS(Uint32);
-INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS(Float32);
-INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS(Float64);
-
-#undef INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS
-#undef INSTANTIATE_DOMTYPEDARRAY_MEMBER_FUNCTIONS_IMPL
+// TODO(tasak): The following traits should be auto-generated by binding
+// script and should be placed in bindings/core/v8/V8*Array.h.
+template <typename ArrayType> struct DOMTypedArrayTraits { };
+
+#define DEFINE_DOMTYPEDARRAY_TRAITS(ArrayType, V8BindingType) \
+ template <> \
+ struct DOMTypedArrayTraits<ArrayType> { \
+ typedef V8BindingType Type; \
+ }
+
+DEFINE_DOMTYPEDARRAY_TRAITS(DOMInt8Array, V8Int8Array);
+DEFINE_DOMTYPEDARRAY_TRAITS(DOMInt16Array, V8Int16Array);
+DEFINE_DOMTYPEDARRAY_TRAITS(DOMInt32Array, V8Int32Array);
+DEFINE_DOMTYPEDARRAY_TRAITS(DOMUint8Array, V8Uint8Array);
+DEFINE_DOMTYPEDARRAY_TRAITS(DOMUint8ClampedArray, V8Uint8ClampedArray);
+DEFINE_DOMTYPEDARRAY_TRAITS(DOMUint16Array, V8Uint16Array);
+DEFINE_DOMTYPEDARRAY_TRAITS(DOMUint32Array, V8Uint32Array);
+DEFINE_DOMTYPEDARRAY_TRAITS(DOMFloat32Array, V8Float32Array);
+DEFINE_DOMTYPEDARRAY_TRAITS(DOMFloat64Array, V8Float64Array);
+
+template <typename WTFTypedArray, typename V8TypedArray>
+const WrapperTypeInfo* DOMTypedArray<WTFTypedArray, V8TypedArray>::wrapperTypeInfo() const
+{
+ return &DOMTypedArrayTraits<DOMTypedArray<WTFTypedArray, V8TypedArray>>::Type::wrapperTypeInfo;
+}
+
+template class CORE_EXPORT DOMTypedArray<WTF::Int8Array, v8::Int8Array>;
+template class CORE_EXPORT DOMTypedArray<WTF::Int16Array, v8::Int16Array>;
+template class CORE_EXPORT DOMTypedArray<WTF::Int32Array, v8::Int32Array>;
+template class CORE_EXPORT DOMTypedArray<WTF::Uint8Array, v8::Uint8Array>;
+template class CORE_EXPORT DOMTypedArray<WTF::Uint8ClampedArray, v8::Uint8ClampedArray>;
+template class CORE_EXPORT DOMTypedArray<WTF::Uint16Array, v8::Uint16Array>;
+template class CORE_EXPORT DOMTypedArray<WTF::Uint32Array, v8::Uint32Array>;
+template class CORE_EXPORT DOMTypedArray<WTF::Float32Array, v8::Float32Array>;
+template class CORE_EXPORT DOMTypedArray<WTF::Float64Array, v8::Float64Array>;
} // namespace blink
« no previous file with comments | « Source/core/dom/DOMTypedArray.h ('k') | Source/modules/webaudio/AudioBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698