Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / bindings / tests / results / core / V8TestSpecialOperations.cpp
index 9beb001..ddb04a4 100644 (file)
@@ -8,6 +8,7 @@
 #include "V8TestSpecialOperations.h"
 
 #include "bindings/core/v8/ExceptionState.h"
+#include "bindings/core/v8/UnionTypesCore.h"
 #include "bindings/core/v8/V8DOMConfiguration.h"
 #include "bindings/core/v8/V8HiddenValue.h"
 #include "bindings/core/v8/V8Node.h"
@@ -26,7 +27,7 @@
 
 namespace blink {
 
-const WrapperTypeInfo V8TestSpecialOperations::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestSpecialOperations::domTemplate, V8TestSpecialOperations::refObject, V8TestSpecialOperations::derefObject, V8TestSpecialOperations::createPersistentHandle, 0, 0, 0, V8TestSpecialOperations::installConditionallyEnabledMethods, V8TestSpecialOperations::installConditionallyEnabledProperties, 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::Independent, WrapperTypeInfo::RefCountedObject };
+const WrapperTypeInfo V8TestSpecialOperations::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestSpecialOperations::domTemplate, V8TestSpecialOperations::refObject, V8TestSpecialOperations::derefObject, V8TestSpecialOperations::trace, 0, 0, 0, V8TestSpecialOperations::installConditionallyEnabledMethods, V8TestSpecialOperations::installConditionallyEnabledProperties, 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::Independent, WrapperTypeInfo::RefCountedObject };
 
 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestSpecialOperations.h.
 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
@@ -35,12 +36,10 @@ const WrapperTypeInfo& TestSpecialOperations::s_wrapperTypeInfo = V8TestSpecialO
 
 namespace TestSpecialOperationsV8Internal {
 
-template <typename T> void V8_USE(T) { }
-
 static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
 {
     if (UNLIKELY(info.Length() < 1)) {
-        V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("namedItem", "TestSpecialOperations", 1, info.Length(), info.GetIsolate()), info.GetIsolate());
+        V8ThrowException::throwException(createMinimumArityTypeErrorForMethod(info.GetIsolate(), "namedItem", "TestSpecialOperations", 1, info.Length()), info.GetIsolate());
         return;
     }
     TestSpecialOperations* impl = V8TestSpecialOperations::toImpl(info.Holder());
@@ -48,18 +47,9 @@ static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
     {
         TOSTRING_VOID_INTERNAL(name, info[0]);
     }
-    RefPtrWillBeRawPtr<Node> result0 = nullptr;
-    RefPtrWillBeRawPtr<NodeList> result1 = nullptr;
-    impl->getItem(name, result0, result1);
-    if (result0) {
-        v8SetReturnValue(info, result0.release());
-        return;
-    }
-    if (result1) {
-        v8SetReturnValue(info, result1.release());
-        return;
-    }
-    v8SetReturnValueNull(info);
+    NodeOrNodeList result;
+    impl->getItem(name, result);
+    v8SetReturnValue(info, result);
 }
 
 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
@@ -73,20 +63,11 @@ static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa
 {
     TestSpecialOperations* impl = V8TestSpecialOperations::toImpl(info.Holder());
     AtomicString propertyName = toCoreAtomicString(name);
-    RefPtrWillBeRawPtr<Node> result0 = nullptr;
-    RefPtrWillBeRawPtr<NodeList> result1 = nullptr;
-    impl->getItem(propertyName, result0, result1);
-    if (!(result0 || result1))
-        return;
-    if (result0) {
-        v8SetReturnValue(info, result0.release());
+    NodeOrNodeList result;
+    impl->getItem(propertyName, result);
+    if (result.isNull())
         return;
-    }
-    if (result1) {
-        v8SetReturnValue(info, result1.release());
-        return;
-    }
-    ASSERT_NOT_REACHED();
+    v8SetReturnValue(info, result);
 }
 
 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
@@ -172,8 +153,10 @@ static void installV8TestSpecialOperationsTemplate(v8::Handle<v8::FunctionTempla
         0, 0,
         V8TestSpecialOperationsMethods, WTF_ARRAY_LENGTH(V8TestSpecialOperationsMethods),
         isolate);
-    v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTemplate->InstanceTemplate();
-    v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTemplate->PrototypeTemplate();
+    v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate();
+    ALLOW_UNUSED_LOCAL(instanceTemplate);
+    v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate();
+    ALLOW_UNUSED_LOCAL(prototypeTemplate);
     functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestSpecialOperationsV8Internal::namedPropertyGetterCallback, TestSpecialOperationsV8Internal::namedPropertySetterCallback, TestSpecialOperationsV8Internal::namedPropertyQueryCallback, 0, TestSpecialOperationsV8Internal::namedPropertyEnumeratorCallback);
 
     // Custom toString template
@@ -200,21 +183,14 @@ TestSpecialOperations* V8TestSpecialOperations::toImplWithTypeCheck(v8::Isolate*
     return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestSpecialOperations>() : 0;
 }
 
-
-void V8TestSpecialOperations::refObject(ScriptWrappableBase* internalPointer)
-{
-    internalPointer->toImpl<TestSpecialOperations>()->ref();
-}
-
-void V8TestSpecialOperations::derefObject(ScriptWrappableBase* internalPointer)
+void V8TestSpecialOperations::refObject(ScriptWrappableBase* scriptWrappableBase)
 {
-    internalPointer->toImpl<TestSpecialOperations>()->deref();
+    scriptWrappableBase->toImpl<TestSpecialOperations>()->ref();
 }
 
-WrapperPersistentNode* V8TestSpecialOperations::createPersistentHandle(ScriptWrappableBase* internalPointer)
+void V8TestSpecialOperations::derefObject(ScriptWrappableBase* scriptWrappableBase)
 {
-    ASSERT_NOT_REACHED();
-    return 0;
+    scriptWrappableBase->toImpl<TestSpecialOperations>()->deref();
 }
 
 template<>