| OLD | NEW |
| (Empty) |
| 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 "V8TestInterfaceNamedConstructor2.h" | |
| 9 | |
| 10 #include "bindings/core/v8/ExceptionState.h" | |
| 11 #include "bindings/core/v8/V8DOMConfiguration.h" | |
| 12 #include "bindings/core/v8/V8HiddenValue.h" | |
| 13 #include "bindings/core/v8/V8ObjectConstructor.h" | |
| 14 #include "core/dom/ContextFeatures.h" | |
| 15 #include "core/dom/Document.h" | |
| 16 #include "core/frame/LocalDOMWindow.h" | |
| 17 #include "platform/RuntimeEnabledFeatures.h" | |
| 18 #include "platform/TraceEvent.h" | |
| 19 #include "wtf/GetPtr.h" | |
| 20 #include "wtf/RefPtr.h" | |
| 21 | |
| 22 namespace blink { | |
| 23 | |
| 24 const WrapperTypeInfo V8TestInterfaceNamedConstructor2::wrapperTypeInfo = { gin:
:kEmbedderBlink, V8TestInterfaceNamedConstructor2::domTemplate, V8TestInterfaceN
amedConstructor2::refObject, V8TestInterfaceNamedConstructor2::derefObject, V8Te
stInterfaceNamedConstructor2::createPersistentHandle, 0, 0, 0, V8TestInterfaceNa
medConstructor2::installConditionallyEnabledMethods, V8TestInterfaceNamedConstru
ctor2::installConditionallyEnabledProperties, 0, WrapperTypeInfo::WrapperTypeObj
ectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::Independent, Wrap
perTypeInfo::RefCountedObject }; | |
| 25 | |
| 26 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestInterfac
eNamedConstructor2.h. | |
| 27 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in | |
| 28 // bindings/core/v8/ScriptWrappable.h. | |
| 29 const WrapperTypeInfo& TestInterfaceNamedConstructor2::s_wrapperTypeInfo = V8Tes
tInterfaceNamedConstructor2::wrapperTypeInfo; | |
| 30 | |
| 31 namespace TestInterfaceNamedConstructor2V8Internal { | |
| 32 | |
| 33 template <typename T> void V8_USE(T) { } | |
| 34 | |
| 35 } // namespace TestInterfaceNamedConstructor2V8Internal | |
| 36 | |
| 37 const WrapperTypeInfo V8TestInterfaceNamedConstructor2Constructor::wrapperTypeIn
fo = { gin::kEmbedderBlink, V8TestInterfaceNamedConstructor2Constructor::domTemp
late, V8TestInterfaceNamedConstructor2::refObject, V8TestInterfaceNamedConstruct
or2::derefObject, V8TestInterfaceNamedConstructor2::createPersistentHandle, 0, 0
, 0, V8TestInterfaceNamedConstructor2::installConditionallyEnabledMethods, V8Tes
tInterfaceNamedConstructor2::installConditionallyEnabledProperties, 0, WrapperTy
peInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeI
nfo::Independent, WrapperTypeInfo::RefCountedObject }; | |
| 38 | |
| 39 static void V8TestInterfaceNamedConstructor2ConstructorCallback(const v8::Functi
onCallbackInfo<v8::Value>& info) | |
| 40 { | |
| 41 if (!info.IsConstructCall()) { | |
| 42 V8ThrowException::throwTypeError(ExceptionMessages::constructorNotCallab
leAsFunction("Audio"), info.GetIsolate()); | |
| 43 return; | |
| 44 } | |
| 45 | |
| 46 if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExis
tingObject) { | |
| 47 v8SetReturnValue(info, info.Holder()); | |
| 48 return; | |
| 49 } | |
| 50 if (UNLIKELY(info.Length() < 1)) { | |
| 51 V8ThrowException::throwException(createMinimumArityTypeErrorForConstruct
or("TestInterfaceNamedConstructor2", 1, info.Length(), info.GetIsolate()), info.
GetIsolate()); | |
| 52 return; | |
| 53 } | |
| 54 V8StringResource<> stringArg; | |
| 55 { | |
| 56 TOSTRING_VOID_INTERNAL(stringArg, info[0]); | |
| 57 } | |
| 58 RefPtr<TestInterfaceNamedConstructor2> impl = TestInterfaceNamedConstructor2
::createForJSConstructor(stringArg); | |
| 59 v8::Handle<v8::Object> wrapper = info.Holder(); | |
| 60 impl->associateWithWrapper(&V8TestInterfaceNamedConstructor2Constructor::wra
pperTypeInfo, wrapper, info.GetIsolate()); | |
| 61 v8SetReturnValue(info, wrapper); | |
| 62 } | |
| 63 | |
| 64 v8::Handle<v8::FunctionTemplate> V8TestInterfaceNamedConstructor2Constructor::do
mTemplate(v8::Isolate* isolate) | |
| 65 { | |
| 66 static int domTemplateKey; // This address is used for a key to look up the
dom template. | |
| 67 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | |
| 68 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(&domTempl
ateKey); | |
| 69 if (!result.IsEmpty()) | |
| 70 return result; | |
| 71 | |
| 72 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate"); | |
| 73 result = v8::FunctionTemplate::New(isolate, V8TestInterfaceNamedConstructor2
ConstructorCallback); | |
| 74 v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate(); | |
| 75 instanceTemplate->SetInternalFieldCount(V8TestInterfaceNamedConstructor2::in
ternalFieldCount); | |
| 76 result->SetClassName(v8AtomicString(isolate, "TestInterfaceNamedConstructor2
")); | |
| 77 result->Inherit(V8TestInterfaceNamedConstructor2::domTemplate(isolate)); | |
| 78 data->setDOMTemplate(&domTemplateKey, result); | |
| 79 return result; | |
| 80 } | |
| 81 | |
| 82 static void installV8TestInterfaceNamedConstructor2Template(v8::Handle<v8::Funct
ionTemplate> functionTemplate, v8::Isolate* isolate) | |
| 83 { | |
| 84 functionTemplate->ReadOnlyPrototype(); | |
| 85 | |
| 86 v8::Local<v8::Signature> defaultSignature; | |
| 87 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceNamedConstructor2", v8::Local<v8::FunctionTemplate>(), V8Test
InterfaceNamedConstructor2::internalFieldCount, | |
| 88 0, 0, | |
| 89 0, 0, | |
| 90 0, 0, | |
| 91 isolate); | |
| 92 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTempla
te->InstanceTemplate(); | |
| 93 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTempl
ate->PrototypeTemplate(); | |
| 94 | |
| 95 // Custom toString template | |
| 96 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:from(isolate)->toStringTemplate()); | |
| 97 } | |
| 98 | |
| 99 v8::Handle<v8::FunctionTemplate> V8TestInterfaceNamedConstructor2::domTemplate(v
8::Isolate* isolate) | |
| 100 { | |
| 101 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeI
nfo*>(&wrapperTypeInfo), installV8TestInterfaceNamedConstructor2Template); | |
| 102 } | |
| 103 | |
| 104 bool V8TestInterfaceNamedConstructor2::hasInstance(v8::Handle<v8::Value> v8Value
, v8::Isolate* isolate) | |
| 105 { | |
| 106 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); | |
| 107 } | |
| 108 | |
| 109 v8::Handle<v8::Object> V8TestInterfaceNamedConstructor2::findInstanceInPrototype
Chain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) | |
| 110 { | |
| 111 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); | |
| 112 } | |
| 113 | |
| 114 TestInterfaceNamedConstructor2* V8TestInterfaceNamedConstructor2::toImplWithType
Check(v8::Isolate* isolate, v8::Handle<v8::Value> value) | |
| 115 { | |
| 116 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle
<v8::Object>::Cast(value))->toImpl<TestInterfaceNamedConstructor2>() : 0; | |
| 117 } | |
| 118 | |
| 119 | |
| 120 void V8TestInterfaceNamedConstructor2::refObject(ScriptWrappableBase* internalPo
inter) | |
| 121 { | |
| 122 internalPointer->toImpl<TestInterfaceNamedConstructor2>()->ref(); | |
| 123 } | |
| 124 | |
| 125 void V8TestInterfaceNamedConstructor2::derefObject(ScriptWrappableBase* internal
Pointer) | |
| 126 { | |
| 127 internalPointer->toImpl<TestInterfaceNamedConstructor2>()->deref(); | |
| 128 } | |
| 129 | |
| 130 WrapperPersistentNode* V8TestInterfaceNamedConstructor2::createPersistentHandle(
ScriptWrappableBase* internalPointer) | |
| 131 { | |
| 132 ASSERT_NOT_REACHED(); | |
| 133 return 0; | |
| 134 } | |
| 135 | |
| 136 template<> | |
| 137 v8::Handle<v8::Value> toV8NoInline(TestInterfaceNamedConstructor2* impl, v8::Han
dle<v8::Object> creationContext, v8::Isolate* isolate) | |
| 138 { | |
| 139 return toV8(impl, creationContext, isolate); | |
| 140 } | |
| 141 | |
| 142 } // namespace blink | |
| OLD | NEW |