X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2FWebKit%2FSource%2Fbindings%2Ftests%2Fresults%2FV8TestNode.cpp;h=ecde22296db240ceb4c19cc9509d1925caa4a4ae;hb=4a1a0bdd01eef90b0826a0e761d3379d3715c10f;hp=7343dc3cb8c5455ec64a95a39f146a7f6af399b4;hpb=b1be5ca53587d23e7aeb77b26861fdc0a181ffd8;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/WebKit/Source/bindings/tests/results/V8TestNode.cpp b/src/third_party/WebKit/Source/bindings/tests/results/V8TestNode.cpp index 7343dc3..ecde222 100644 --- a/src/third_party/WebKit/Source/bindings/tests/results/V8TestNode.cpp +++ b/src/third_party/WebKit/Source/bindings/tests/results/V8TestNode.cpp @@ -7,10 +7,10 @@ #include "config.h" #include "V8TestNode.h" -#include "bindings/v8/ExceptionState.h" -#include "bindings/v8/V8DOMConfiguration.h" -#include "bindings/v8/V8HiddenValue.h" -#include "bindings/v8/V8ObjectConstructor.h" +#include "bindings/core/v8/ExceptionState.h" +#include "bindings/core/v8/V8DOMConfiguration.h" +#include "bindings/core/v8/V8HiddenValue.h" +#include "bindings/core/v8/V8ObjectConstructor.h" #include "core/dom/ContextFeatures.h" #include "core/dom/Document.h" #include "core/frame/LocalDOMWindow.h" @@ -19,7 +19,7 @@ #include "wtf/GetPtr.h" #include "wtf/RefPtr.h" -namespace WebCore { +namespace blink { static void initializeScriptWrappableForInterface(TestNode* object) { @@ -29,15 +29,15 @@ static void initializeScriptWrappableForInterface(TestNode* object) ASSERT_NOT_REACHED(); } -} // namespace WebCore +} // namespace blink -void webCoreInitializeScriptWrappableForInterface(WebCore::TestNode* object) +void webCoreInitializeScriptWrappableForInterface(blink::TestNode* object) { - WebCore::initializeScriptWrappableForInterface(object); + blink::initializeScriptWrappableForInterface(object); } -namespace WebCore { -const WrapperTypeInfo V8TestNode::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestNode::domTemplate, V8TestNode::derefObject, 0, V8TestNode::toEventTarget, 0, V8TestNode::installPerContextEnabledMethods, &V8Node::wrapperTypeInfo, WrapperTypeObjectPrototype, WillBeGarbageCollectedObject }; +namespace blink { +const WrapperTypeInfo V8TestNode::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestNode::domTemplate, V8TestNode::derefObject, 0, V8TestNode::toEventTarget, 0, V8TestNode::installConditionallyEnabledMethods, &V8Node::wrapperTypeInfo, WrapperTypeObjectPrototype, WillBeGarbageCollectedObject }; namespace TestNodeV8Internal { @@ -52,9 +52,9 @@ static void hrefAttributeGetter(const v8::PropertyCallbackInfo& info) static void hrefAttributeGetterCallback(v8::Local, const v8::PropertyCallbackInfo& info) { - TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); + TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); TestNodeV8Internal::hrefAttributeGetter(info); - TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); + TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); } static void hrefAttributeSetter(v8::Local v8Value, const v8::PropertyCallbackInfo& info) @@ -67,9 +67,9 @@ static void hrefAttributeSetter(v8::Local v8Value, const v8::Property static void hrefAttributeSetterCallback(v8::Local, v8::Local v8Value, const v8::PropertyCallbackInfo& info) { - TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); + TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); TestNodeV8Internal::hrefAttributeSetter(v8Value, info); - TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); + TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); } static void hrefThrowsAttributeGetter(const v8::PropertyCallbackInfo& info) @@ -81,9 +81,9 @@ static void hrefThrowsAttributeGetter(const v8::PropertyCallbackInfo& static void hrefThrowsAttributeGetterCallback(v8::Local, const v8::PropertyCallbackInfo& info) { - TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); + TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); TestNodeV8Internal::hrefThrowsAttributeGetter(info); - TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); + TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); } static void hrefThrowsAttributeSetter(v8::Local v8Value, const v8::PropertyCallbackInfo& info) @@ -98,9 +98,9 @@ static void hrefThrowsAttributeSetter(v8::Local v8Value, const v8::Pr static void hrefThrowsAttributeSetterCallback(v8::Local, v8::Local v8Value, const v8::PropertyCallbackInfo& info) { - TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); + TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); TestNodeV8Internal::hrefThrowsAttributeSetter(v8Value, info); - TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); + TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); } static void hrefCallWithAttributeGetter(const v8::PropertyCallbackInfo& info) @@ -112,9 +112,9 @@ static void hrefCallWithAttributeGetter(const v8::PropertyCallbackInfo, const v8::PropertyCallbackInfo& info) { - TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); + TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); TestNodeV8Internal::hrefCallWithAttributeGetter(info); - TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); + TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); } static void hrefCallWithAttributeSetter(v8::Local v8Value, const v8::PropertyCallbackInfo& info) @@ -122,39 +122,69 @@ static void hrefCallWithAttributeSetter(v8::Local v8Value, const v8:: v8::Handle holder = info.Holder(); TestNode* impl = V8TestNode::toNative(holder); TOSTRING_VOID(V8StringResource<>, cppValue, v8Value); - impl->setHrefCallWith(callingDOMWindow(info.GetIsolate()), enteredDOMWindow(info.GetIsolate()), cppValue); + ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); + impl->setHrefCallWith(executionContext, callingDOMWindow(info.GetIsolate()), enteredDOMWindow(info.GetIsolate()), cppValue); } static void hrefCallWithAttributeSetterCallback(v8::Local, v8::Local v8Value, const v8::PropertyCallbackInfo& info) { - TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); + TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); TestNodeV8Internal::hrefCallWithAttributeSetter(v8Value, info); - TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); + TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); +} + +static void hrefByteStringAttributeGetter(const v8::PropertyCallbackInfo& info) +{ + v8::Handle holder = info.Holder(); + TestNode* impl = V8TestNode::toNative(holder); + v8SetReturnValueString(info, impl->hrefByteString(), info.GetIsolate()); +} + +static void hrefByteStringAttributeGetterCallback(v8::Local, const v8::PropertyCallbackInfo& info) +{ + TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); + TestNodeV8Internal::hrefByteStringAttributeGetter(info); + TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); +} + +static void hrefByteStringAttributeSetter(v8::Local v8Value, const v8::PropertyCallbackInfo& info) +{ + v8::Handle holder = info.Holder(); + ExceptionState exceptionState(ExceptionState::SetterContext, "hrefByteString", "TestNode", holder, info.GetIsolate()); + TestNode* impl = V8TestNode::toNative(holder); + TONATIVE_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, toByteString(v8Value, exceptionState), exceptionState); + impl->setHrefByteString(cppValue); +} + +static void hrefByteStringAttributeSetterCallback(v8::Local, v8::Local v8Value, const v8::PropertyCallbackInfo& info) +{ + TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); + TestNodeV8Internal::hrefByteStringAttributeSetter(v8Value, info); + TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); } static void constructor(const v8::FunctionCallbackInfo& info) { - v8::Isolate* isolate = info.GetIsolate(); RefPtrWillBeRawPtr impl = TestNode::create(); - v8::Handle wrapper = info.Holder(); - V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestNode::wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent); + V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestNode::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Dependent); v8SetReturnValue(info, wrapper); } } // namespace TestNodeV8Internal static const V8DOMConfiguration::AttributeConfiguration V8TestNodeAttributes[] = { - {"href", TestNodeV8Internal::hrefAttributeGetterCallback, TestNodeV8Internal::hrefAttributeSetterCallback, 0, 0, 0, static_cast(v8::DEFAULT), static_cast(v8::None), 0 /* on instance */}, - {"hrefThrows", TestNodeV8Internal::hrefThrowsAttributeGetterCallback, TestNodeV8Internal::hrefThrowsAttributeSetterCallback, 0, 0, 0, static_cast(v8::DEFAULT), static_cast(v8::None), 0 /* on instance */}, - {"hrefCallWith", TestNodeV8Internal::hrefCallWithAttributeGetterCallback, TestNodeV8Internal::hrefCallWithAttributeSetterCallback, 0, 0, 0, static_cast(v8::DEFAULT), static_cast(v8::None), 0 /* on instance */}, + {"href", TestNodeV8Internal::hrefAttributeGetterCallback, TestNodeV8Internal::hrefAttributeSetterCallback, 0, 0, 0, static_cast(v8::DEFAULT), static_cast(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, + {"hrefThrows", TestNodeV8Internal::hrefThrowsAttributeGetterCallback, TestNodeV8Internal::hrefThrowsAttributeSetterCallback, 0, 0, 0, static_cast(v8::DEFAULT), static_cast(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, + {"hrefCallWith", TestNodeV8Internal::hrefCallWithAttributeGetterCallback, TestNodeV8Internal::hrefCallWithAttributeSetterCallback, 0, 0, 0, static_cast(v8::DEFAULT), static_cast(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, + {"hrefByteString", TestNodeV8Internal::hrefByteStringAttributeGetterCallback, TestNodeV8Internal::hrefByteStringAttributeSetterCallback, 0, 0, 0, static_cast(v8::DEFAULT), static_cast(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, }; void V8TestNode::constructorCallback(const v8::FunctionCallbackInfo& info) { - TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor"); + TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMConstructor"); if (!info.IsConstructCall()) { - throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("TestNode"), info.GetIsolate()); + V8ThrowException::throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("TestNode"), info.GetIsolate()); return; } @@ -166,7 +196,7 @@ void V8TestNode::constructorCallback(const v8::FunctionCallbackInfo& TestNodeV8Internal::constructor(info); } -static void configureV8TestNodeTemplate(v8::Handle functionTemplate, v8::Isolate* isolate) +static void installV8TestNodeTemplate(v8::Handle functionTemplate, v8::Isolate* isolate) { functionTemplate->ReadOnlyPrototype(); @@ -187,7 +217,7 @@ static void configureV8TestNodeTemplate(v8::Handle functio v8::Handle V8TestNode::domTemplate(v8::Isolate* isolate) { - return V8DOMConfiguration::domClassTemplate(isolate, const_cast(&wrapperTypeInfo), configureV8TestNodeTemplate); + return V8DOMConfiguration::domClassTemplate(isolate, const_cast(&wrapperTypeInfo), installV8TestNodeTemplate); } bool V8TestNode::hasInstance(v8::Handle v8Value, v8::Isolate* isolate) @@ -202,7 +232,7 @@ v8::Handle V8TestNode::findInstanceInPrototypeChain(v8::Handle value) { - return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0; + return hasInstance(value, isolate) ? fromInternalPointer(blink::toInternalPointer(v8::Handle::Cast(value))) : 0; } EventTarget* V8TestNode::toEventTarget(v8::Handle object) @@ -232,15 +262,15 @@ v8::Handle V8TestNode::createWrapper(PassRefPtrWillBeRawPtr(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent); return wrapper; } -void V8TestNode::derefObject(void* object) +void V8TestNode::derefObject(ScriptWrappableBase* internalPointer) { #if !ENABLE(OILPAN) - fromInternalPointer(object)->deref(); + fromInternalPointer(internalPointer)->deref(); #endif // !ENABLE(OILPAN) } @@ -250,4 +280,4 @@ v8::Handle toV8NoInline(TestNode* impl, v8::Handle creati return toV8(impl, creationContext, isolate); } -} // namespace WebCore +} // namespace blink