Home | History | Annotate | Download | only in results
      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 "V8TestInterface2.h"
      9 
     10 #include "bindings/tests/v8/V8TestInterface.h"
     11 #include "bindings/tests/v8/V8TestInterfaceEmpty.h"
     12 #include "bindings/v8/ExceptionState.h"
     13 #include "bindings/v8/V8DOMConfiguration.h"
     14 #include "bindings/v8/V8GCController.h"
     15 #include "bindings/v8/V8HiddenValue.h"
     16 #include "bindings/v8/V8ObjectConstructor.h"
     17 #include "core/dom/ContextFeatures.h"
     18 #include "core/dom/Document.h"
     19 #include "core/dom/Element.h"
     20 #include "core/frame/LocalDOMWindow.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(TestInterface2* object)
     29 {
     30     if (ScriptWrappable::wrapperCanBeStoredInObject(object))
     31         ScriptWrappable::fromObject(object)->setTypeInfo(&V8TestInterface2::wrapperTypeInfo);
     32     else
     33         ASSERT_NOT_REACHED();
     34 }
     35 
     36 } // namespace WebCore
     37 
     38 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterface2* object)
     39 {
     40     WebCore::initializeScriptWrappableForInterface(object);
     41 }
     42 
     43 namespace WebCore {
     44 const WrapperTypeInfo V8TestInterface2::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterface2::domTemplate, V8TestInterface2::derefObject, 0, 0, V8TestInterface2::visitDOMWrapper, V8TestInterface2::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype, RefCountedObject };
     45 
     46 namespace TestInterface2V8Internal {
     47 
     48 template <typename T> void V8_USE(T) { }
     49 
     50 static void itemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
     51 {
     52     ExceptionState exceptionState(ExceptionState::ExecutionContext, "item", "TestInterface2", info.Holder(), info.GetIsolate());
     53     if (UNLIKELY(info.Length() < 1)) {
     54         throwMinimumArityTypeError(exceptionState, 1, info.Length());
     55         return;
     56     }
     57     TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
     58     unsigned index;
     59     {
     60         v8::TryCatch block;
     61         V8RethrowTryCatchScope rethrow(block);
     62         TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(index, toUInt32(info[0], exceptionState), exceptionState);
     63     }
     64     RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState);
     65     if (exceptionState.hadException()) {
     66         exceptionState.throwIfNeeded();
     67         return;
     68     }
     69     v8SetReturnValue(info, result.release());
     70 }
     71 
     72 static void itemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
     73 {
     74     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
     75     TestInterface2V8Internal::itemMethod(info);
     76     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
     77 }
     78 
     79 static void setItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
     80 {
     81     ExceptionState exceptionState(ExceptionState::ExecutionContext, "setItem", "TestInterface2", info.Holder(), info.GetIsolate());
     82     if (UNLIKELY(info.Length() < 2)) {
     83         throwMinimumArityTypeError(exceptionState, 2, info.Length());
     84         return;
     85     }
     86     TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
     87     unsigned index;
     88     V8StringResource<> value;
     89     {
     90         v8::TryCatch block;
     91         V8RethrowTryCatchScope rethrow(block);
     92         TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(index, toUInt32(info[0], exceptionState), exceptionState);
     93         TOSTRING_VOID_INTERNAL(value, info[1]);
     94     }
     95     String result = impl->setItem(index, value, exceptionState);
     96     if (exceptionState.hadException()) {
     97         exceptionState.throwIfNeeded();
     98         return;
     99     }
    100     v8SetReturnValueString(info, result, info.GetIsolate());
    101 }
    102 
    103 static void setItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
    104 {
    105     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
    106     TestInterface2V8Internal::setItemMethod(info);
    107     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
    108 }
    109 
    110 static void deleteItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
    111 {
    112     ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteItem", "TestInterface2", info.Holder(), info.GetIsolate());
    113     if (UNLIKELY(info.Length() < 1)) {
    114         throwMinimumArityTypeError(exceptionState, 1, info.Length());
    115         return;
    116     }
    117     TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
    118     unsigned index;
    119     {
    120         v8::TryCatch block;
    121         V8RethrowTryCatchScope rethrow(block);
    122         TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(index, toUInt32(info[0], exceptionState), exceptionState);
    123     }
    124     bool result = impl->deleteItem(index, exceptionState);
    125     if (exceptionState.hadException()) {
    126         exceptionState.throwIfNeeded();
    127         return;
    128     }
    129     v8SetReturnValueBool(info, result);
    130 }
    131 
    132 static void deleteItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
    133 {
    134     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
    135     TestInterface2V8Internal::deleteItemMethod(info);
    136     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
    137 }
    138 
    139 static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
    140 {
    141     ExceptionState exceptionState(ExceptionState::ExecutionContext, "namedItem", "TestInterface2", info.Holder(), info.GetIsolate());
    142     if (UNLIKELY(info.Length() < 1)) {
    143         throwMinimumArityTypeError(exceptionState, 1, info.Length());
    144         return;
    145     }
    146     TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
    147     V8StringResource<> name;
    148     {
    149         TOSTRING_VOID_INTERNAL(name, info[0]);
    150     }
    151     RefPtr<TestInterfaceEmpty> result = impl->namedItem(name, exceptionState);
    152     if (exceptionState.hadException()) {
    153         exceptionState.throwIfNeeded();
    154         return;
    155     }
    156     v8SetReturnValue(info, result.release());
    157 }
    158 
    159 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
    160 {
    161     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
    162     TestInterface2V8Internal::namedItemMethod(info);
    163     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
    164 }
    165 
    166 static void setNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
    167 {
    168     ExceptionState exceptionState(ExceptionState::ExecutionContext, "setNamedItem", "TestInterface2", info.Holder(), info.GetIsolate());
    169     if (UNLIKELY(info.Length() < 2)) {
    170         throwMinimumArityTypeError(exceptionState, 2, info.Length());
    171         return;
    172     }
    173     TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
    174     V8StringResource<> name;
    175     V8StringResource<> value;
    176     {
    177         TOSTRING_VOID_INTERNAL(name, info[0]);
    178         TOSTRING_VOID_INTERNAL(value, info[1]);
    179     }
    180     String result = impl->setNamedItem(name, value, exceptionState);
    181     if (exceptionState.hadException()) {
    182         exceptionState.throwIfNeeded();
    183         return;
    184     }
    185     v8SetReturnValueString(info, result, info.GetIsolate());
    186 }
    187 
    188 static void setNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
    189 {
    190     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
    191     TestInterface2V8Internal::setNamedItemMethod(info);
    192     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
    193 }
    194 
    195 static void deleteNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
    196 {
    197     ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteNamedItem", "TestInterface2", info.Holder(), info.GetIsolate());
    198     if (UNLIKELY(info.Length() < 1)) {
    199         throwMinimumArityTypeError(exceptionState, 1, info.Length());
    200         return;
    201     }
    202     TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
    203     V8StringResource<> name;
    204     {
    205         TOSTRING_VOID_INTERNAL(name, info[0]);
    206     }
    207     bool result = impl->deleteNamedItem(name, exceptionState);
    208     if (exceptionState.hadException()) {
    209         exceptionState.throwIfNeeded();
    210         return;
    211     }
    212     v8SetReturnValueBool(info, result);
    213 }
    214 
    215 static void deleteNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
    216 {
    217     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
    218     TestInterface2V8Internal::deleteNamedItemMethod(info);
    219     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
    220 }
    221 
    222 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
    223 {
    224     v8::Isolate* isolate = info.GetIsolate();
    225     RefPtr<TestInterface2> impl = TestInterface2::create();
    226 
    227     v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), isolate);
    228     v8SetReturnValue(info, wrapper);
    229 }
    230 
    231 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
    232 {
    233     TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
    234     ExceptionState exceptionState(ExceptionState::IndexedGetterContext, "TestInterface2", info.Holder(), info.GetIsolate());
    235     RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState);
    236     if (exceptionState.throwIfNeeded())
    237         return;
    238     if (!result)
    239         return;
    240     v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl);
    241 }
    242 
    243 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
    244 {
    245     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
    246     TestInterface2V8Internal::indexedPropertyGetter(index, info);
    247     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
    248 }
    249 
    250 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
    251 {
    252     TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
    253     TOSTRING_VOID(V8StringResource<>, propertyValue, v8Value);
    254     ExceptionState exceptionState(ExceptionState::IndexedSetterContext, "TestInterface2", info.Holder(), info.GetIsolate());
    255     bool result = impl->setItem(index, propertyValue, exceptionState);
    256     if (exceptionState.throwIfNeeded())
    257         return;
    258     if (!result)
    259         return;
    260     v8SetReturnValue(info, v8Value);
    261 }
    262 
    263 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
    264 {
    265     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
    266     TestInterface2V8Internal::indexedPropertySetter(index, v8Value, info);
    267     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
    268 }
    269 
    270 static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info)
    271 {
    272     TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
    273     ExceptionState exceptionState(ExceptionState::IndexedDeletionContext, "TestInterface2", info.Holder(), info.GetIsolate());
    274     DeleteResult result = impl->deleteItem(index, exceptionState);
    275     if (exceptionState.throwIfNeeded())
    276         return;
    277     if (result != DeleteUnknownProperty)
    278         return v8SetReturnValueBool(info, result == DeleteSuccess);
    279 }
    280 
    281 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info)
    282 {
    283     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
    284     TestInterface2V8Internal::indexedPropertyDeleter(index, info);
    285     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
    286 }
    287 
    288 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
    289 {
    290     if (info.Holder()->HasRealNamedProperty(name))
    291         return;
    292     if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
    293         return;
    294 
    295     TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
    296     AtomicString propertyName = toCoreAtomicString(name);
    297     v8::String::Utf8Value namedProperty(name);
    298     ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestInterface2", info.Holder(), info.GetIsolate());
    299     RefPtr<TestInterfaceEmpty> result = impl->namedItem(propertyName, exceptionState);
    300     if (exceptionState.throwIfNeeded())
    301         return;
    302     if (!result)
    303         return;
    304     v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl);
    305 }
    306 
    307 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
    308 {
    309     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
    310     TestInterface2V8Internal::namedPropertyGetter(name, info);
    311     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
    312 }
    313 
    314 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
    315 {
    316     if (info.Holder()->HasRealNamedProperty(name))
    317         return;
    318     if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
    319         return;
    320 
    321     TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
    322     TOSTRING_VOID(V8StringResource<>, propertyName, name);
    323     TOSTRING_VOID(V8StringResource<>, propertyValue, v8Value);
    324     v8::String::Utf8Value namedProperty(name);
    325     ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty, "TestInterface2", info.Holder(), info.GetIsolate());
    326     bool result = impl->setNamedItem(propertyName, propertyValue, exceptionState);
    327     if (exceptionState.throwIfNeeded())
    328         return;
    329     if (!result)
    330         return;
    331     v8SetReturnValue(info, v8Value);
    332 }
    333 
    334 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
    335 {
    336     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
    337     TestInterface2V8Internal::namedPropertySetter(name, v8Value, info);
    338     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
    339 }
    340 
    341 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
    342 {
    343     TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
    344     AtomicString propertyName = toCoreAtomicString(name);
    345     v8::String::Utf8Value namedProperty(name);
    346     ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestInterface2", info.Holder(), info.GetIsolate());
    347     bool result = impl->namedPropertyQuery(propertyName, exceptionState);
    348     if (exceptionState.throwIfNeeded())
    349         return;
    350     if (!result)
    351         return;
    352     v8SetReturnValueInt(info, v8::None);
    353 }
    354 
    355 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
    356 {
    357     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
    358     TestInterface2V8Internal::namedPropertyQuery(name, info);
    359     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
    360 }
    361 
    362 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
    363 {
    364     TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
    365     AtomicString propertyName = toCoreAtomicString(name);
    366     v8::String::Utf8Value namedProperty(name);
    367     ExceptionState exceptionState(ExceptionState::DeletionContext, *namedProperty, "TestInterface2", info.Holder(), info.GetIsolate());
    368     DeleteResult result = impl->deleteNamedItem(propertyName, exceptionState);
    369     if (exceptionState.throwIfNeeded())
    370         return;
    371     if (result != DeleteUnknownProperty)
    372         return v8SetReturnValueBool(info, result == DeleteSuccess);
    373 }
    374 
    375 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
    376 {
    377     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
    378     TestInterface2V8Internal::namedPropertyDeleter(name, info);
    379     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
    380 }
    381 
    382 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info)
    383 {
    384     TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
    385     v8::Isolate* isolate = info.GetIsolate();
    386     Vector<String> names;
    387     ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestInterface2", info.Holder(), isolate);
    388     impl->namedPropertyEnumerator(names, exceptionState);
    389     if (exceptionState.throwIfNeeded())
    390         return;
    391     v8::Handle<v8::Array> v8names = v8::Array::New(isolate, names.size());
    392     for (size_t i = 0; i < names.size(); ++i)
    393         v8names->Set(v8::Integer::New(isolate, i), v8String(isolate, names[i]));
    394     v8SetReturnValue(info, v8names);
    395 }
    396 
    397 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::Array>& info)
    398 {
    399     TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
    400     TestInterface2V8Internal::namedPropertyEnumerator(info);
    401     TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
    402 }
    403 
    404 } // namespace TestInterface2V8Internal
    405 
    406 void V8TestInterface2::visitDOMWrapper(void* object, const v8::Persistent<v8::Object>& wrapper, v8::Isolate* isolate)
    407 {
    408     TestInterface2* impl = fromInternalPointer(object);
    409     // The ownerNode() method may return a reference or a pointer.
    410     if (Node* owner = WTF::getPtr(impl->ownerNode())) {
    411         Node* root = V8GCController::opaqueRootForGC(owner, isolate);
    412         isolate->SetReferenceFromGroup(v8::UniqueId(reinterpret_cast<intptr_t>(root)), wrapper);
    413         return;
    414     }
    415     setObjectGroup(object, wrapper, isolate);
    416 }
    417 
    418 static const V8DOMConfiguration::MethodConfiguration V8TestInterface2Methods[] = {
    419     {"item", TestInterface2V8Internal::itemMethodCallback, 0, 1},
    420     {"setItem", TestInterface2V8Internal::setItemMethodCallback, 0, 2},
    421     {"deleteItem", TestInterface2V8Internal::deleteItemMethodCallback, 0, 1},
    422     {"namedItem", TestInterface2V8Internal::namedItemMethodCallback, 0, 1},
    423     {"setNamedItem", TestInterface2V8Internal::setNamedItemMethodCallback, 0, 2},
    424     {"deleteNamedItem", TestInterface2V8Internal::deleteNamedItemMethodCallback, 0, 1},
    425 };
    426 
    427 void V8TestInterface2::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
    428 {
    429     TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor");
    430     if (!info.IsConstructCall()) {
    431         throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("TestInterface2"), info.GetIsolate());
    432         return;
    433     }
    434 
    435     if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExistingObject) {
    436         v8SetReturnValue(info, info.Holder());
    437         return;
    438     }
    439 
    440     TestInterface2V8Internal::constructor(info);
    441 }
    442 
    443 static void configureV8TestInterface2Template(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
    444 {
    445     functionTemplate->ReadOnlyPrototype();
    446 
    447     v8::Local<v8::Signature> defaultSignature;
    448     defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterface2", v8::Local<v8::FunctionTemplate>(), V8TestInterface2::internalFieldCount,
    449         0, 0,
    450         0, 0,
    451         V8TestInterface2Methods, WTF_ARRAY_LENGTH(V8TestInterface2Methods),
    452         isolate);
    453     functionTemplate->SetCallHandler(V8TestInterface2::constructorCallback);
    454     functionTemplate->SetLength(0);
    455     v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTemplate->InstanceTemplate();
    456     v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTemplate->PrototypeTemplate();
    457     functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestInterface2V8Internal::indexedPropertyGetterCallback, TestInterface2V8Internal::indexedPropertySetterCallback, 0, TestInterface2V8Internal::indexedPropertyDeleterCallback, indexedPropertyEnumerator<TestInterface2>);
    458     functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestInterface2V8Internal::namedPropertyGetterCallback, TestInterface2V8Internal::namedPropertySetterCallback, TestInterface2V8Internal::namedPropertyQueryCallback, TestInterface2V8Internal::namedPropertyDeleterCallback, TestInterface2V8Internal::namedPropertyEnumeratorCallback);
    459 
    460     // Custom toString template
    461     functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
    462 }
    463 
    464 v8::Handle<v8::FunctionTemplate> V8TestInterface2::domTemplate(v8::Isolate* isolate)
    465 {
    466     return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), configureV8TestInterface2Template);
    467 }
    468 
    469 bool V8TestInterface2::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
    470 {
    471     return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
    472 }
    473 
    474 v8::Handle<v8::Object> V8TestInterface2::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
    475 {
    476     return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
    477 }
    478 
    479 TestInterface2* V8TestInterface2::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
    480 {
    481     return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Object>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0;
    482 }
    483 
    484 v8::Handle<v8::Object> wrap(TestInterface2* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
    485 {
    486     ASSERT(impl);
    487     if (impl->isTestInterface())
    488         return wrap(toTestInterface(impl), creationContext, isolate);
    489     if (impl->isTestInterfaceEmpty())
    490         return wrap(toTestInterfaceEmpty(impl), creationContext, isolate);
    491     v8::Handle<v8::Object> wrapper = V8TestInterface2::createWrapper(impl, creationContext, isolate);
    492     return wrapper;
    493 }
    494 
    495 v8::Handle<v8::Object> V8TestInterface2::createWrapper(PassRefPtr<TestInterface2> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
    496 {
    497     ASSERT(impl);
    498     ASSERT(!DOMDataStore::containsWrapper<V8TestInterface2>(impl.get(), isolate));
    499     if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
    500         const WrapperTypeInfo* actualInfo = ScriptWrappable::fromObject(impl.get())->typeInfo();
    501         // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapperTypeInfo. These will both have
    502         // the same object de-ref functions, though, so use that as the basis of the check.
    503         RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
    504     }
    505 
    506     v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate);
    507     if (UNLIKELY(wrapper.IsEmpty()))
    508         return wrapper;
    509 
    510     installPerContextEnabledProperties(wrapper, impl.get(), isolate);
    511     V8DOMWrapper::associateObjectWithWrapper<V8TestInterface2>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent);
    512     return wrapper;
    513 }
    514 
    515 void V8TestInterface2::derefObject(void* object)
    516 {
    517     fromInternalPointer(object)->deref();
    518 }
    519 
    520 template<>
    521 v8::Handle<v8::Value> toV8NoInline(TestInterface2* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
    522 {
    523     return toV8(impl, creationContext, isolate);
    524 }
    525 
    526 } // namespace WebCore
    527