| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY! | 31 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY! |
| 32 | 32 |
| 33 #include "config.h" | 33 #include "config.h" |
| 34 #include "V8TestNode.h" | 34 #include "V8TestInterfaceNode.h" |
| 35 | 35 |
| 36 #include "RuntimeEnabledFeatures.h" | 36 #include "RuntimeEnabledFeatures.h" |
| 37 #include "bindings/v8/ExceptionState.h" | 37 #include "bindings/v8/ExceptionState.h" |
| 38 #include "bindings/v8/V8AbstractEventListener.h" |
| 38 #include "bindings/v8/V8DOMConfiguration.h" | 39 #include "bindings/v8/V8DOMConfiguration.h" |
| 40 #include "bindings/v8/V8EventListenerList.h" |
| 39 #include "bindings/v8/V8ObjectConstructor.h" | 41 #include "bindings/v8/V8ObjectConstructor.h" |
| 40 #include "core/dom/ContextFeatures.h" | 42 #include "core/dom/ContextFeatures.h" |
| 41 #include "core/dom/Document.h" | 43 #include "core/dom/Document.h" |
| 42 #include "platform/TraceEvent.h" | 44 #include "platform/TraceEvent.h" |
| 43 | 45 |
| 44 namespace WebCore { | 46 namespace WebCore { |
| 45 | 47 |
| 46 static void initializeScriptWrappableForInterface(TestNode* object) | 48 static void initializeScriptWrappableForInterface(TestInterfaceNode* object) |
| 47 { | 49 { |
| 48 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 50 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
| 49 ScriptWrappable::setTypeInfoInObject(object, &V8TestNode::wrapperTypeInf
o); | 51 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceNode::wrapp
erTypeInfo); |
| 50 else | 52 else |
| 51 ASSERT_NOT_REACHED(); | 53 ASSERT_NOT_REACHED(); |
| 52 } | 54 } |
| 53 | 55 |
| 54 } // namespace WebCore | 56 } // namespace WebCore |
| 55 | 57 |
| 56 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: | 58 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: |
| 57 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function | 59 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function |
| 58 // in the global namespace. | 60 // in the global namespace. |
| 59 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
edback/details/664619/the-namespace-of-local-function-declarations-in-c) | 61 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
edback/details/664619/the-namespace-of-local-function-declarations-in-c) |
| 60 void webCoreInitializeScriptWrappableForInterface(WebCore::TestNode* object) | 62 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceNode* ob
ject) |
| 61 { | 63 { |
| 62 WebCore::initializeScriptWrappableForInterface(object); | 64 WebCore::initializeScriptWrappableForInterface(object); |
| 63 } | 65 } |
| 64 | 66 |
| 65 namespace WebCore { | 67 namespace WebCore { |
| 66 const WrapperTypeInfo V8TestNode::wrapperTypeInfo = { gin::kEmbedderBlink, V8Tes
tNode::domTemplate, V8TestNode::derefObject, 0, V8TestNode::toEventTarget, 0, V8
TestNode::installPerContextEnabledMethods, &V8Node::wrapperTypeInfo, WrapperType
ObjectPrototype }; | 68 const WrapperTypeInfo V8TestInterfaceNode::wrapperTypeInfo = { gin::kEmbedderBli
nk, V8TestInterfaceNode::domTemplate, V8TestInterfaceNode::derefObject, 0, V8Tes
tInterfaceNode::toEventTarget, 0, V8TestInterfaceNode::installPerContextEnabledM
ethods, &V8Node::wrapperTypeInfo, WrapperTypeObjectPrototype }; |
| 67 | 69 |
| 68 namespace TestNodeV8Internal { | 70 namespace TestInterfaceNodeV8Internal { |
| 69 | 71 |
| 70 template <typename T> void V8_USE(T) { } | 72 template <typename T> void V8_USE(T) { } |
| 71 | 73 |
| 72 static void hrefAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) | 74 static void stringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Va
lue>& info) |
| 73 { | 75 { |
| 74 TestNode* imp = V8TestNode::toNative(info.Holder()); | 76 TestInterfaceNode* imp = V8TestInterfaceNode::toNative(info.Holder()); |
| 75 v8SetReturnValueString(info, imp->href(), info.GetIsolate()); | 77 v8SetReturnValueString(info, imp->stringAttribute(), info.GetIsolate()); |
| 76 } | 78 } |
| 77 | 79 |
| 78 static void hrefAttributeGetterCallback(v8::Local<v8::String>, const v8::Propert
yCallbackInfo<v8::Value>& info) | 80 static void stringAttributeAttributeGetterCallback(v8::Local<v8::String>, const
v8::PropertyCallbackInfo<v8::Value>& info) |
| 79 { | 81 { |
| 80 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 82 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 81 TestNodeV8Internal::hrefAttributeGetter(info); | 83 TestInterfaceNodeV8Internal::stringAttributeAttributeGetter(info); |
| 82 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 84 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 83 } | 85 } |
| 84 | 86 |
| 85 static void hrefAttributeSetter(v8::Local<v8::Value> jsValue, const v8::Property
CallbackInfo<void>& info) | 87 static void stringAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v
8::PropertyCallbackInfo<void>& info) |
| 86 { | 88 { |
| 87 TestNode* imp = V8TestNode::toNative(info.Holder()); | 89 TestInterfaceNode* imp = V8TestInterfaceNode::toNative(info.Holder()); |
| 88 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); | 90 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); |
| 89 imp->setHref(cppValue); | 91 imp->setStringAttribute(cppValue); |
| 90 } | 92 } |
| 91 | 93 |
| 92 static void hrefAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Val
ue> jsValue, const v8::PropertyCallbackInfo<void>& info) | 94 static void stringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Lo
cal<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
| 93 { | 95 { |
| 94 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 96 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 95 TestNodeV8Internal::hrefAttributeSetter(jsValue, info); | 97 TestInterfaceNodeV8Internal::stringAttributeAttributeSetter(jsValue, info); |
| 96 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 98 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 97 } | 99 } |
| 98 | 100 |
| 99 static void hrefThrowsAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>&
info) | 101 static void eventHandlerAttributeAttributeGetter(const v8::PropertyCallbackInfo<
v8::Value>& info) |
| 100 { | 102 { |
| 101 TestNode* imp = V8TestNode::toNative(info.Holder()); | 103 TestInterfaceNode* imp = V8TestInterfaceNode::toNative(info.Holder()); |
| 102 v8SetReturnValueString(info, imp->hrefThrows(), info.GetIsolate()); | 104 EventListener* jsValue = imp->eventHandlerAttribute(isolatedWorldForIsolate(
info.GetIsolate())); |
| 105 v8SetReturnValue(info, jsValue ? v8::Handle<v8::Value>(V8AbstractEventListen
er::cast(jsValue)->getListenerObject(imp->executionContext())) : v8::Handle<v8::
Value>(v8::Null(info.GetIsolate()))); |
| 103 } | 106 } |
| 104 | 107 |
| 105 static void hrefThrowsAttributeGetterCallback(v8::Local<v8::String>, const v8::P
ropertyCallbackInfo<v8::Value>& info) | 108 static void eventHandlerAttributeAttributeGetterCallback(v8::Local<v8::String>,
const v8::PropertyCallbackInfo<v8::Value>& info) |
| 106 { | 109 { |
| 107 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 110 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 108 TestNodeV8Internal::hrefThrowsAttributeGetter(info); | 111 TestInterfaceNodeV8Internal::eventHandlerAttributeAttributeGetter(info); |
| 109 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 112 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 110 } | 113 } |
| 111 | 114 |
| 112 static void hrefThrowsAttributeSetter(v8::Local<v8::Value> jsValue, const v8::Pr
opertyCallbackInfo<void>& info) | 115 static void eventHandlerAttributeAttributeSetter(v8::Local<v8::Value> jsValue, c
onst v8::PropertyCallbackInfo<void>& info) |
| 113 { | 116 { |
| 114 ExceptionState exceptionState(ExceptionState::SetterContext, "hrefThrows", "
TestNode", info.Holder(), info.GetIsolate()); | 117 TestInterfaceNode* imp = V8TestInterfaceNode::toNative(info.Holder()); |
| 115 TestNode* imp = V8TestNode::toNative(info.Holder()); | 118 imp->setEventHandlerAttribute(V8EventListenerList::getEventListener(jsValue,
true, ListenerFindOrCreate), isolatedWorldForIsolate(info.GetIsolate())); |
| 116 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); | |
| 117 imp->setHrefThrows(cppValue, exceptionState); | |
| 118 exceptionState.throwIfNeeded(); | |
| 119 } | 119 } |
| 120 | 120 |
| 121 static void hrefThrowsAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v
8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 121 static void eventHandlerAttributeAttributeSetterCallback(v8::Local<v8::String>,
v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
| 122 { | 122 { |
| 123 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 123 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 124 TestNodeV8Internal::hrefThrowsAttributeSetter(jsValue, info); | 124 TestInterfaceNodeV8Internal::eventHandlerAttributeAttributeSetter(jsValue, i
nfo); |
| 125 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 125 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 126 } | 126 } |
| 127 | 127 |
| 128 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) | 128 } // namespace TestInterfaceNodeV8Internal |
| 129 { | |
| 130 RefPtr<TestNode> impl = TestNode::create(); | |
| 131 v8::Handle<v8::Object> wrapper = info.Holder(); | |
| 132 | 129 |
| 133 V8DOMWrapper::associateObjectWithWrapper<V8TestNode>(impl.release(), &V8Test
Node::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Depende
nt); | 130 static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceNodeAttri
butes[] = { |
| 134 v8SetReturnValue(info, wrapper); | 131 {"stringAttribute", TestInterfaceNodeV8Internal::stringAttributeAttributeGet
terCallback, TestInterfaceNodeV8Internal::stringAttributeAttributeSetterCallback
, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::Property
Attribute>(v8::None), 0 /* on instance */}, |
| 135 } | 132 {"eventHandlerAttribute", TestInterfaceNodeV8Internal::eventHandlerAttribute
AttributeGetterCallback, TestInterfaceNodeV8Internal::eventHandlerAttributeAttri
buteSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static
_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, |
| 136 | |
| 137 } // namespace TestNodeV8Internal | |
| 138 | |
| 139 static const V8DOMConfiguration::AttributeConfiguration V8TestNodeAttributes[] =
{ | |
| 140 {"href", TestNodeV8Internal::hrefAttributeGetterCallback, TestNodeV8Internal
::hrefAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAU
LT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, | |
| 141 {"hrefThrows", TestNodeV8Internal::hrefThrowsAttributeGetterCallback, TestNo
deV8Internal::hrefThrowsAttributeSetterCallback, 0, 0, 0, static_cast<v8::Access
Control>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on ins
tance */}, | |
| 142 }; | 133 }; |
| 143 | 134 |
| 144 void V8TestNode::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>&
info) | 135 static void configureV8TestInterfaceNodeTemplate(v8::Handle<v8::FunctionTemplate
> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType) |
| 145 { | |
| 146 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor"); | |
| 147 if (!info.IsConstructCall()) { | |
| 148 throwTypeError(ExceptionMessages::failedToConstruct("TestNode", "Please
use the 'new' operator, this DOM object constructor cannot be called as a functi
on."), info.GetIsolate()); | |
| 149 return; | |
| 150 } | |
| 151 | |
| 152 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { | |
| 153 v8SetReturnValue(info, info.Holder()); | |
| 154 return; | |
| 155 } | |
| 156 | |
| 157 TestNodeV8Internal::constructor(info); | |
| 158 } | |
| 159 | |
| 160 static void configureV8TestNodeTemplate(v8::Handle<v8::FunctionTemplate> functio
nTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType) | |
| 161 { | 136 { |
| 162 functionTemplate->ReadOnlyPrototype(); | 137 functionTemplate->ReadOnlyPrototype(); |
| 163 | 138 |
| 164 v8::Local<v8::Signature> defaultSignature; | 139 v8::Local<v8::Signature> defaultSignature; |
| 165 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestNode", V8Node::domTemplate(isolate, currentWorldType), V8TestNode::int
ernalFieldCount, | 140 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceNode", V8Node::domTemplate(isolate, currentWorldType), V8Test
InterfaceNode::internalFieldCount, |
| 166 V8TestNodeAttributes, WTF_ARRAY_LENGTH(V8TestNodeAttributes), | 141 V8TestInterfaceNodeAttributes, WTF_ARRAY_LENGTH(V8TestInterfaceNodeAttri
butes), |
| 167 0, 0, | 142 0, 0, |
| 168 0, 0, | 143 0, 0, |
| 169 isolate, currentWorldType); | 144 isolate, currentWorldType); |
| 170 functionTemplate->SetCallHandler(V8TestNode::constructorCallback); | |
| 171 functionTemplate->SetLength(0); | |
| 172 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 145 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
| 173 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 146 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
| 174 | 147 |
| 175 // Custom toString template | 148 // Custom toString template |
| 176 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | 149 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); |
| 177 } | 150 } |
| 178 | 151 |
| 179 v8::Handle<v8::FunctionTemplate> V8TestNode::domTemplate(v8::Isolate* isolate, W
rapperWorldType currentWorldType) | 152 v8::Handle<v8::FunctionTemplate> V8TestInterfaceNode::domTemplate(v8::Isolate* i
solate, WrapperWorldType currentWorldType) |
| 180 { | 153 { |
| 181 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 154 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 182 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 155 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 183 if (result != data->templateMap(currentWorldType).end()) | 156 if (result != data->templateMap(currentWorldType).end()) |
| 184 return result->value.newLocal(isolate); | 157 return result->value.newLocal(isolate); |
| 185 | 158 |
| 186 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 159 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 187 v8::EscapableHandleScope handleScope(isolate); | 160 v8::EscapableHandleScope handleScope(isolate); |
| 188 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | 161 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
| 189 configureV8TestNodeTemplate(templ, isolate, currentWorldType); | 162 configureV8TestInterfaceNodeTemplate(templ, isolate, currentWorldType); |
| 190 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 163 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 191 return handleScope.Escape(templ); | 164 return handleScope.Escape(templ); |
| 192 } | 165 } |
| 193 | 166 |
| 194 bool V8TestNode::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate
, WrapperWorldType currentWorldType) | 167 bool V8TestInterfaceNode::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate
* isolate, WrapperWorldType currentWorldType) |
| 195 { | 168 { |
| 196 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 169 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 197 } | 170 } |
| 198 | 171 |
| 199 bool V8TestNode::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::Isolat
e* isolate) | 172 bool V8TestInterfaceNode::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v
8::Isolate* isolate) |
| 200 { | 173 { |
| 201 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | 174 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
| 202 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) | 175 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) |
| 203 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); | 176 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); |
| 204 } | 177 } |
| 205 | 178 |
| 206 EventTarget* V8TestNode::toEventTarget(v8::Handle<v8::Object> object) | 179 EventTarget* V8TestInterfaceNode::toEventTarget(v8::Handle<v8::Object> object) |
| 207 { | 180 { |
| 208 return toNative(object); | 181 return toNative(object); |
| 209 } | 182 } |
| 210 | 183 |
| 211 v8::Handle<v8::Object> V8TestNode::createWrapper(PassRefPtr<TestNode> impl, v8::
Handle<v8::Object> creationContext, v8::Isolate* isolate) | 184 v8::Handle<v8::Object> V8TestInterfaceNode::createWrapper(PassRefPtr<TestInterfa
ceNode> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 212 { | 185 { |
| 213 ASSERT(impl); | 186 ASSERT(impl); |
| 214 ASSERT(!DOMDataStore::containsWrapper<V8TestNode>(impl.get(), isolate)); | 187 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceNode>(impl.get(), isola
te)); |
| 215 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 188 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 216 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 189 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 217 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 190 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 218 // the same object de-ref functions, though, so use that as the basis of
the check. | 191 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 219 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | 192 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 220 } | 193 } |
| 221 | 194 |
| 222 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); | 195 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |
| 223 if (UNLIKELY(wrapper.IsEmpty())) | 196 if (UNLIKELY(wrapper.IsEmpty())) |
| 224 return wrapper; | 197 return wrapper; |
| 225 | 198 |
| 226 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | 199 installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
| 227 V8DOMWrapper::associateObjectWithWrapper<V8TestNode>(impl, &wrapperTypeInfo,
wrapper, isolate, WrapperConfiguration::Dependent); | 200 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceNode>(impl, &wrapper
TypeInfo, wrapper, isolate, WrapperConfiguration::Dependent); |
| 228 return wrapper; | 201 return wrapper; |
| 229 } | 202 } |
| 230 | 203 |
| 231 void V8TestNode::derefObject(void* object) | 204 void V8TestInterfaceNode::derefObject(void* object) |
| 232 { | 205 { |
| 233 fromInternalPointer(object)->deref(); | 206 fromInternalPointer(object)->deref(); |
| 234 } | 207 } |
| 235 | 208 |
| 236 template<> | 209 template<> |
| 237 v8::Handle<v8::Value> toV8NoInline(TestNode* impl, v8::Handle<v8::Object> creati
onContext, v8::Isolate* isolate) | 210 v8::Handle<v8::Value> toV8NoInline(TestInterfaceNode* impl, v8::Handle<v8::Objec
t> creationContext, v8::Isolate* isolate) |
| 238 { | 211 { |
| 239 return toV8(impl, creationContext, isolate); | 212 return toV8(impl, creationContext, isolate); |
| 240 } | 213 } |
| 241 | 214 |
| 242 } // namespace WebCore | 215 } // namespace WebCore |
| OLD | NEW |