Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / bindings / core / v8 / custom / V8TypedArrayCustom.h
index eeb35ee..c38087a 100644 (file)
@@ -52,9 +52,11 @@ public:
         return TypedArrayTraits<TypedArray>::IsInstance(value);
     }
 
-    static TypedArray* toNative(v8::Handle<v8::Object>);
-    static TypedArray* toNativeWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>);
+    static TypedArray* toImpl(v8::Handle<v8::Object>);
+    static TypedArray* toImplWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>);
+    static void refObject(ScriptWrappableBase* internalPointer);
     static void derefObject(ScriptWrappableBase* internalPointer);
+    static WrapperPersistentNode* createPersistentHandle(ScriptWrappableBase* internalPointer);
     static const WrapperTypeInfo wrapperTypeInfo;
     static const int internalFieldCount = v8DefaultWrapperInternalFieldCount;
 
@@ -115,12 +117,12 @@ public:
         info.GetReturnValue().Set(wrapper);
     }
 
-    static inline ScriptWrappableBase* toInternalPointer(TypedArray* impl)
+    static inline ScriptWrappableBase* toScriptWrappableBase(TypedArray* impl)
     {
         return reinterpret_cast<ScriptWrappableBase*>(static_cast<void*>(impl));
     }
 
-    static inline TypedArray* fromInternalPointer(ScriptWrappableBase* internalPointer)
+    static inline TypedArray* toImpl(ScriptWrappableBase* internalPointer)
     {
         return reinterpret_cast<TypedArray*>(static_cast<void*>(internalPointer));
     }
@@ -152,12 +154,12 @@ v8::Handle<v8::Object> V8TypedArray<TypedArray>::createWrapper(PassRefPtr<TypedA
 
     v8::Local<v8::Object> wrapper = V8Type::New(v8Buffer.As<v8::ArrayBuffer>(), impl->byteOffset(), Traits::length(impl.get()));
 
-    V8DOMWrapper::associateObjectWithWrapper<Binding>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent);
+    V8DOMWrapper::associateObjectWithWrapper<Binding>(impl, &wrapperTypeInfo, wrapper, isolate);
     return wrapper;
 }
 
 template <typename TypedArray>
-TypedArray* V8TypedArray<TypedArray>::toNative(v8::Handle<v8::Object> object)
+TypedArray* V8TypedArray<TypedArray>::toImpl(v8::Handle<v8::Object> object)
 {
     ASSERT(Traits::IsInstance(object));
     void* typedarrayPtr = object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex);
@@ -165,10 +167,10 @@ TypedArray* V8TypedArray<TypedArray>::toNative(v8::Handle<v8::Object> object)
         return reinterpret_cast<TypedArray*>(typedarrayPtr);
 
     v8::Handle<V8Type> view = object.As<V8Type>();
-    RefPtr<ArrayBuffer> arrayBuffer = V8ArrayBuffer::toNative(view->Buffer());
+    RefPtr<ArrayBuffer> arrayBuffer = V8ArrayBuffer::toImpl(view->Buffer());
     RefPtr<TypedArray> typedArray = TypedArray::create(arrayBuffer, view->ByteOffset(), Traits::length(view));
     ASSERT(typedArray.get());
-    V8DOMWrapper::associateObjectWithWrapper<Binding>(typedArray.release(), &wrapperTypeInfo, object, v8::Isolate::GetCurrent(), WrapperConfiguration::Independent);
+    V8DOMWrapper::associateObjectWithWrapper<Binding>(typedArray.release(), &wrapperTypeInfo, object, v8::Isolate::GetCurrent());
 
     typedarrayPtr = object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex);
     ASSERT(typedarrayPtr);
@@ -176,25 +178,44 @@ TypedArray* V8TypedArray<TypedArray>::toNative(v8::Handle<v8::Object> object)
 }
 
 template <typename TypedArray>
-TypedArray* V8TypedArray<TypedArray>::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
+TypedArray* V8TypedArray<TypedArray>::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
 {
-    return V8TypedArray<TypedArray>::hasInstance(value, isolate) ? V8TypedArray<TypedArray>::toNative(v8::Handle<v8::Object>::Cast(value)) : 0;
+    return V8TypedArray<TypedArray>::hasInstance(value, isolate) ? V8TypedArray<TypedArray>::toImpl(v8::Handle<v8::Object>::Cast(value)) : 0;
 }
 
 template <typename TypedArray>
 const WrapperTypeInfo V8TypedArray<TypedArray>::wrapperTypeInfo = {
     gin::kEmbedderBlink,
-    0, V8TypedArray<TypedArray>::derefObject,
-    0, 0, 0, 0, 0, WrapperTypeObjectPrototype, RefCountedObject
+    0,
+    V8TypedArray<TypedArray>::refObject,
+    V8TypedArray<TypedArray>::derefObject,
+    V8TypedArray<TypedArray>::createPersistentHandle,
+    0, 0, 0, 0, 0, 0,
+    WrapperTypeInfo::WrapperTypeObjectPrototype,
+    WrapperTypeInfo::ObjectClassId,
+    WrapperTypeInfo::Independent,
+    WrapperTypeInfo::RefCountedObject
 };
 
 template <typename TypedArray>
+void V8TypedArray<TypedArray>::refObject(ScriptWrappableBase* internalPointer)
+{
+    toImpl(internalPointer)->ref();
+}
+
+template <typename TypedArray>
 void V8TypedArray<TypedArray>::derefObject(ScriptWrappableBase* internalPointer)
 {
-    fromInternalPointer(internalPointer)->deref();
+    toImpl(internalPointer)->deref();
 }
 
+template <typename TypedArray>
+WrapperPersistentNode* V8TypedArray<TypedArray>::createPersistentHandle(ScriptWrappableBase* internalPointer)
+{
+    ASSERT_NOT_REACHED();
+    return 0;
+}
 
-} // namespace WebCode
+} // namespace blink
 
 #endif // V8TypedArrayCustom_h