1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! 6 7 #include "config.h" 8 #include "V8TestInterfaceNode.h" 9 10 #include "HTMLNames.h" 11 #include "bindings/tests/v8/V8TestInterfaceEmpty.h" 12 #include "bindings/v8/ExceptionState.h" 13 #include "bindings/v8/V8AbstractEventListener.h" 14 #include "bindings/v8/V8DOMConfiguration.h" 15 #include "bindings/v8/V8EventListenerList.h" 16 #include "bindings/v8/V8HiddenValue.h" 17 #include "bindings/v8/V8ObjectConstructor.h" 18 #include "core/dom/ContextFeatures.h" 19 #include "core/dom/Document.h" 20 #include "core/dom/custom/CustomElementCallbackDispatcher.h" 21 #include "platform/RuntimeEnabledFeatures.h" 22 #include "platform/TraceEvent.h" 23 #include "wtf/GetPtr.h" 24 #include "wtf/RefPtr.h" 25 26 namespace WebCore { 27 28 static void initializeScriptWrappableForInterface(TestInterfaceNode* object) 29 { 30 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) 31 ScriptWrappable::fromObject(object)->setTypeInfo(&V8TestInterfaceNode::wrapperTypeInfo); 32 else 33 ASSERT_NOT_REACHED(); 34 } 35 36 } // namespace WebCore 37 38 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceNode* object) 39 { 40 WebCore::initializeScriptWrappableForInterface(object); 41 } 42 43 namespace WebCore { 44 const WrapperTypeInfo V8TestInterfaceNode::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceNode::domTemplate, V8TestInterfaceNode::derefObject, 0, V8TestInterfaceNode::toEventTarget, 0, V8TestInterfaceNode::installPerContextEnabledMethods, &V8Node::wrapperTypeInfo, WrapperTypeObjectPrototype, WillBeGarbageCollectedObject }; 45 46 namespace TestInterfaceNodeV8Internal { 47 48 template <typename T> void V8_USE(T) { } 49 50 static void stringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) 51 { 52 v8::Handle<v8::Object> holder = info.Holder(); 53 TestInterfaceNode* impl = V8TestInterfaceNode::toNative(holder); 54 v8SetReturnValueString(info, impl->stringAttribute(), info.GetIsolate()); 55 } 56 57 static void stringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 58 { 59 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 60 TestInterfaceNodeV8Internal::stringAttributeAttributeGetter(info); 61 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 62 } 63 64 static void stringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 65 { 66 v8::Handle<v8::Object> holder = info.Holder(); 67 TestInterfaceNode* impl = V8TestInterfaceNode::toNative(holder); 68 TOSTRING_VOID(V8StringResource<>, cppValue, v8Value); 69 impl->setStringAttribute(cppValue); 70 } 71 72 static void stringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 73 { 74 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 75 TestInterfaceNodeV8Internal::stringAttributeAttributeSetter(v8Value, info); 76 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 77 } 78 79 static void readonlyTestInterfaceEmptyAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) 80 { 81 v8::Handle<v8::Object> holder = info.Holder(); 82 TestInterfaceNode* impl = V8TestInterfaceNode::toNative(holder); 83 v8SetReturnValueFast(info, WTF::getPtr(impl->readonlyTestInterfaceEmptyAttribute()), impl); 84 } 85 86 static void readonlyTestInterfaceEmptyAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 87 { 88 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 89 TestInterfaceNodeV8Internal::readonlyTestInterfaceEmptyAttributeAttributeGetter(info); 90 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 91 } 92 93 static void eventHandlerAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) 94 { 95 v8::Handle<v8::Object> holder = info.Holder(); 96 TestInterfaceNode* impl = V8TestInterfaceNode::toNative(holder); 97 EventListener* v8Value = impl->eventHandlerAttribute(); 98 v8SetReturnValue(info, v8Value ? v8::Handle<v8::Value>(V8AbstractEventListener::cast(v8Value)->getListenerObject(impl->executionContext())) : v8::Handle<v8::Value>(v8::Null(info.GetIsolate()))); 99 } 100 101 static void eventHandlerAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 102 { 103 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 104 TestInterfaceNodeV8Internal::eventHandlerAttributeAttributeGetter(info); 105 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 106 } 107 108 static void eventHandlerAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 109 { 110 v8::Handle<v8::Object> holder = info.Holder(); 111 TestInterfaceNode* impl = V8TestInterfaceNode::toNative(holder); 112 impl->setEventHandlerAttribute(V8EventListenerList::getEventListener(ScriptState::current(info.GetIsolate()), v8Value, true, ListenerFindOrCreate)); 113 } 114 115 static void eventHandlerAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 116 { 117 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 118 TestInterfaceNodeV8Internal::eventHandlerAttributeAttributeSetter(v8Value, info); 119 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 120 } 121 122 static void perWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) 123 { 124 v8::Handle<v8::Object> holder = info.Holder(); 125 TestInterfaceNode* impl = V8TestInterfaceNode::toNative(holder); 126 v8SetReturnValueFast(info, WTF::getPtr(impl->perWorldBindingsReadonlyTestInterfaceEmptyAttribute()), impl); 127 } 128 129 static void perWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 130 { 131 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 132 TestInterfaceNodeV8Internal::perWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetter(info); 133 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 134 } 135 136 static void perWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetterForMainWorld(const v8::PropertyCallbackInfo<v8::Value>& info) 137 { 138 v8::Handle<v8::Object> holder = info.Holder(); 139 TestInterfaceNode* impl = V8TestInterfaceNode::toNative(holder); 140 v8SetReturnValueForMainWorld(info, WTF::getPtr(impl->perWorldBindingsReadonlyTestInterfaceEmptyAttribute())); 141 } 142 143 static void perWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 144 { 145 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 146 TestInterfaceNodeV8Internal::perWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetterForMainWorld(info); 147 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 148 } 149 150 static void reflectStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) 151 { 152 v8::Handle<v8::Object> holder = info.Holder(); 153 Element* impl = V8Element::toNative(holder); 154 v8SetReturnValueString(info, impl->fastGetAttribute(HTMLNames::reflectstringattributeAttr), info.GetIsolate()); 155 } 156 157 static void reflectStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 158 { 159 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 160 TestInterfaceNodeV8Internal::reflectStringAttributeAttributeGetter(info); 161 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 162 } 163 164 static void reflectStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 165 { 166 v8::Handle<v8::Object> holder = info.Holder(); 167 Element* impl = V8Element::toNative(holder); 168 TOSTRING_VOID(V8StringResource<>, cppValue, v8Value); 169 impl->setAttribute(HTMLNames::reflectstringattributeAttr, cppValue); 170 } 171 172 static void reflectStringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 173 { 174 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 175 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 176 TestInterfaceNodeV8Internal::reflectStringAttributeAttributeSetter(v8Value, info); 177 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 178 } 179 180 static void reflectUrlStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) 181 { 182 v8::Handle<v8::Object> holder = info.Holder(); 183 TestInterfaceNode* impl = V8TestInterfaceNode::toNative(holder); 184 v8SetReturnValueString(info, impl->getURLAttribute(HTMLNames::reflecturlstringattributeAttr), info.GetIsolate()); 185 } 186 187 static void reflectUrlStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 188 { 189 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 190 TestInterfaceNodeV8Internal::reflectUrlStringAttributeAttributeGetter(info); 191 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 192 } 193 194 static void reflectUrlStringAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 195 { 196 v8::Handle<v8::Object> holder = info.Holder(); 197 Element* impl = V8Element::toNative(holder); 198 TOSTRING_VOID(V8StringResource<>, cppValue, v8Value); 199 impl->setAttribute(HTMLNames::reflecturlstringattributeAttr, cppValue); 200 } 201 202 static void reflectUrlStringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 203 { 204 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 205 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 206 TestInterfaceNodeV8Internal::reflectUrlStringAttributeAttributeSetter(v8Value, info); 207 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 208 } 209 210 static void testInterfaceEmptyMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 211 { 212 TestInterfaceNode* impl = V8TestInterfaceNode::toNative(info.Holder()); 213 v8SetReturnValueFast(info, WTF::getPtr(impl->testInterfaceEmptyMethod()), impl); 214 } 215 216 static void testInterfaceEmptyMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 217 { 218 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 219 TestInterfaceNodeV8Internal::testInterfaceEmptyMethodMethod(info); 220 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 221 } 222 223 static void perWorldBindingsTestInterfaceEmptyMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 224 { 225 TestInterfaceNode* impl = V8TestInterfaceNode::toNative(info.Holder()); 226 v8SetReturnValueFast(info, WTF::getPtr(impl->perWorldBindingsTestInterfaceEmptyMethod()), impl); 227 } 228 229 static void perWorldBindingsTestInterfaceEmptyMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 230 { 231 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 232 TestInterfaceNodeV8Internal::perWorldBindingsTestInterfaceEmptyMethodMethod(info); 233 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 234 } 235 236 static void perWorldBindingsTestInterfaceEmptyMethodMethodForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info) 237 { 238 TestInterfaceNode* impl = V8TestInterfaceNode::toNative(info.Holder()); 239 v8SetReturnValueForMainWorld(info, WTF::getPtr(impl->perWorldBindingsTestInterfaceEmptyMethod())); 240 } 241 242 static void perWorldBindingsTestInterfaceEmptyMethodMethodCallbackForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info) 243 { 244 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 245 TestInterfaceNodeV8Internal::perWorldBindingsTestInterfaceEmptyMethodMethodForMainWorld(info); 246 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 247 } 248 249 static void perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 250 { 251 TestInterfaceNode* impl = V8TestInterfaceNode::toNative(info.Holder()); 252 bool optionalBooleanArgument; 253 { 254 v8::TryCatch block; 255 V8RethrowTryCatchScope rethrow(block); 256 if (UNLIKELY(info.Length() <= 0)) { 257 v8SetReturnValueFast(info, WTF::getPtr(impl->perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArg()), impl); 258 return; 259 } 260 TONATIVE_VOID_INTERNAL(optionalBooleanArgument, info[0]->BooleanValue()); 261 } 262 v8SetReturnValueFast(info, WTF::getPtr(impl->perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArg(optionalBooleanArgument)), impl); 263 } 264 265 static void perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 266 { 267 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 268 TestInterfaceNodeV8Internal::perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArgMethod(info); 269 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 270 } 271 272 static void perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArgMethodForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info) 273 { 274 TestInterfaceNode* impl = V8TestInterfaceNode::toNative(info.Holder()); 275 bool optionalBooleanArgument; 276 { 277 v8::TryCatch block; 278 V8RethrowTryCatchScope rethrow(block); 279 if (UNLIKELY(info.Length() <= 0)) { 280 v8SetReturnValueForMainWorld(info, WTF::getPtr(impl->perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArg())); 281 return; 282 } 283 TONATIVE_VOID_INTERNAL(optionalBooleanArgument, info[0]->BooleanValue()); 284 } 285 v8SetReturnValueForMainWorld(info, WTF::getPtr(impl->perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArg(optionalBooleanArgument))); 286 } 287 288 static void perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArgMethodCallbackForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info) 289 { 290 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 291 TestInterfaceNodeV8Internal::perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArgMethodForMainWorld(info); 292 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 293 } 294 295 } // namespace TestInterfaceNodeV8Internal 296 297 static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceNodeAttributes[] = { 298 {"stringAttribute", TestInterfaceNodeV8Internal::stringAttributeAttributeGetterCallback, TestInterfaceNodeV8Internal::stringAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 299 {"readonlyTestInterfaceEmptyAttribute", TestInterfaceNodeV8Internal::readonlyTestInterfaceEmptyAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 300 {"eventHandlerAttribute", TestInterfaceNodeV8Internal::eventHandlerAttributeAttributeGetterCallback, TestInterfaceNodeV8Internal::eventHandlerAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 301 {"perWorldBindingsReadonlyTestInterfaceEmptyAttribute", TestInterfaceNodeV8Internal::perWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetterCallback, 0, TestInterfaceNodeV8Internal::perWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetterCallbackForMainWorld, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 302 {"reflectStringAttribute", TestInterfaceNodeV8Internal::reflectStringAttributeAttributeGetterCallback, TestInterfaceNodeV8Internal::reflectStringAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 303 {"reflectUrlStringAttribute", TestInterfaceNodeV8Internal::reflectUrlStringAttributeAttributeGetterCallback, TestInterfaceNodeV8Internal::reflectUrlStringAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 304 }; 305 306 static const V8DOMConfiguration::MethodConfiguration V8TestInterfaceNodeMethods[] = { 307 {"testInterfaceEmptyMethod", TestInterfaceNodeV8Internal::testInterfaceEmptyMethodMethodCallback, 0, 0}, 308 {"perWorldBindingsTestInterfaceEmptyMethod", TestInterfaceNodeV8Internal::perWorldBindingsTestInterfaceEmptyMethodMethodCallback, TestInterfaceNodeV8Internal::perWorldBindingsTestInterfaceEmptyMethodMethodCallbackForMainWorld, 0}, 309 {"perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArg", TestInterfaceNodeV8Internal::perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArgMethodCallback, TestInterfaceNodeV8Internal::perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArgMethodCallbackForMainWorld, 0}, 310 }; 311 312 static void configureV8TestInterfaceNodeTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate) 313 { 314 functionTemplate->ReadOnlyPrototype(); 315 316 v8::Local<v8::Signature> defaultSignature; 317 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterfaceNode", V8Node::domTemplate(isolate), V8TestInterfaceNode::internalFieldCount, 318 V8TestInterfaceNodeAttributes, WTF_ARRAY_LENGTH(V8TestInterfaceNodeAttributes), 319 0, 0, 320 V8TestInterfaceNodeMethods, WTF_ARRAY_LENGTH(V8TestInterfaceNodeMethods), 321 isolate); 322 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTemplate->InstanceTemplate(); 323 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTemplate->PrototypeTemplate(); 324 325 // Custom toString template 326 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate()); 327 } 328 329 v8::Handle<v8::FunctionTemplate> V8TestInterfaceNode::domTemplate(v8::Isolate* isolate) 330 { 331 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), configureV8TestInterfaceNodeTemplate); 332 } 333 334 bool V8TestInterfaceNode::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) 335 { 336 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value); 337 } 338 339 v8::Handle<v8::Object> V8TestInterfaceNode::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) 340 { 341 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value); 342 } 343 344 TestInterfaceNode* V8TestInterfaceNode::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value) 345 { 346 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Object>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0; 347 } 348 349 EventTarget* V8TestInterfaceNode::toEventTarget(v8::Handle<v8::Object> object) 350 { 351 return toNative(object); 352 } 353 354 v8::Handle<v8::Object> wrap(TestInterfaceNode* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 355 { 356 ASSERT(impl); 357 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceNode>(impl, isolate)); 358 return V8TestInterfaceNode::createWrapper(impl, creationContext, isolate); 359 } 360 361 v8::Handle<v8::Object> V8TestInterfaceNode::createWrapper(PassRefPtrWillBeRawPtr<TestInterfaceNode> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 362 { 363 ASSERT(impl); 364 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceNode>(impl.get(), isolate)); 365 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 366 const WrapperTypeInfo* actualInfo = ScriptWrappable::fromObject(impl.get())->typeInfo(); 367 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapperTypeInfo. These will both have 368 // the same object de-ref functions, though, so use that as the basis of the check. 369 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction); 370 } 371 372 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); 373 if (UNLIKELY(wrapper.IsEmpty())) 374 return wrapper; 375 376 installPerContextEnabledProperties(wrapper, impl.get(), isolate); 377 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceNode>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent); 378 return wrapper; 379 } 380 381 void V8TestInterfaceNode::derefObject(void* object) 382 { 383 #if !ENABLE(OILPAN) 384 fromInternalPointer(object)->deref(); 385 #endif // !ENABLE(OILPAN) 386 } 387 388 template<> 389 v8::Handle<v8::Value> toV8NoInline(TestInterfaceNode* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 390 { 391 return toV8(impl, creationContext, isolate); 392 } 393 394 } // namespace WebCore 395