| 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 "V8TestInterfaceConstructor4.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 "bindings/tests/v8/V8TestInterfaceConstructor4.h" | |
| 15 #include "core/dom/ContextFeatures.h" | |
| 16 #include "core/dom/Document.h" | |
| 17 #include "core/frame/LocalDOMWindow.h" | |
| 18 #include "platform/RuntimeEnabledFeatures.h" | |
| 19 #include "platform/TraceEvent.h" | |
| 20 #include "wtf/GetPtr.h" | |
| 21 #include "wtf/RefPtr.h" | |
| 22 | |
| 23 namespace blink { | |
| 24 | |
| 25 const WrapperTypeInfo V8TestInterfaceConstructor4::wrapperTypeInfo = { gin::kEmb
edderBlink, V8TestInterfaceConstructor4::domTemplate, V8TestInterfaceConstructor
4::refObject, V8TestInterfaceConstructor4::derefObject, V8TestInterfaceConstruct
or4::createPersistentHandle, 0, 0, 0, V8TestInterfaceConstructor4::installCondit
ionallyEnabledMethods, V8TestInterfaceConstructor4::installConditionallyEnabledP
roperties, 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::Obje
ctClassId, WrapperTypeInfo::Independent, WrapperTypeInfo::RefCountedObject }; | |
| 26 | |
| 27 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestInterfac
eConstructor4.h. | |
| 28 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in | |
| 29 // bindings/core/v8/ScriptWrappable.h. | |
| 30 const WrapperTypeInfo& TestInterfaceConstructor4::s_wrapperTypeInfo = V8TestInte
rfaceConstructor4::wrapperTypeInfo; | |
| 31 | |
| 32 namespace TestInterfaceConstructor4V8Internal { | |
| 33 | |
| 34 template <typename T> void V8_USE(T) { } | |
| 35 | |
| 36 static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 37 { | |
| 38 TestInterfaceConstructor4* testInterface4Arg; | |
| 39 { | |
| 40 v8::TryCatch block; | |
| 41 V8RethrowTryCatchScope rethrow(block); | |
| 42 TONATIVE_VOID_INTERNAL(testInterface4Arg, V8TestInterfaceConstructor4::t
oImplWithTypeCheck(info.GetIsolate(), info[0])); | |
| 43 } | |
| 44 RefPtr<TestInterfaceConstructor4> impl = TestInterfaceConstructor4::create(t
estInterface4Arg); | |
| 45 v8::Handle<v8::Object> wrapper = info.Holder(); | |
| 46 impl->associateWithWrapper(&V8TestInterfaceConstructor4::wrapperTypeInfo, wr
apper, info.GetIsolate()); | |
| 47 v8SetReturnValue(info, wrapper); | |
| 48 } | |
| 49 | |
| 50 static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 51 { | |
| 52 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte
rfaceConstructor4", info.Holder(), info.GetIsolate()); | |
| 53 V8StringResource<> scalarValueStringArg; | |
| 54 { | |
| 55 v8::TryCatch block; | |
| 56 V8RethrowTryCatchScope rethrow(block); | |
| 57 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(scalarValueStringArg, toScalarValu
eString(info[0], exceptionState), exceptionState); | |
| 58 } | |
| 59 RefPtr<TestInterfaceConstructor4> impl = TestInterfaceConstructor4::create(s
calarValueStringArg); | |
| 60 v8::Handle<v8::Object> wrapper = info.Holder(); | |
| 61 impl->associateWithWrapper(&V8TestInterfaceConstructor4::wrapperTypeInfo, wr
apper, info.GetIsolate()); | |
| 62 v8SetReturnValue(info, wrapper); | |
| 63 } | |
| 64 | |
| 65 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 66 { | |
| 67 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte
rfaceConstructor4", info.Holder(), info.GetIsolate()); | |
| 68 switch (std::min(1, info.Length())) { | |
| 69 case 1: | |
| 70 if (V8TestInterfaceConstructor4::hasInstance(info[0], info.GetIsolate())
) { | |
| 71 TestInterfaceConstructor4V8Internal::constructor1(info); | |
| 72 return; | |
| 73 } | |
| 74 if (true) { | |
| 75 TestInterfaceConstructor4V8Internal::constructor2(info); | |
| 76 return; | |
| 77 } | |
| 78 break; | |
| 79 default: | |
| 80 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); | |
| 81 exceptionState.throwIfNeeded(); | |
| 82 return; | |
| 83 } | |
| 84 exceptionState.throwTypeError("No matching constructor signature."); | |
| 85 exceptionState.throwIfNeeded(); | |
| 86 } | |
| 87 | |
| 88 } // namespace TestInterfaceConstructor4V8Internal | |
| 89 | |
| 90 void V8TestInterfaceConstructor4::constructorCallback(const v8::FunctionCallback
Info<v8::Value>& info) | |
| 91 { | |
| 92 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMConstructor"); | |
| 93 if (!info.IsConstructCall()) { | |
| 94 V8ThrowException::throwTypeError(ExceptionMessages::constructorNotCallab
leAsFunction("TestInterfaceConstructor4"), info.GetIsolate()); | |
| 95 return; | |
| 96 } | |
| 97 | |
| 98 if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExis
tingObject) { | |
| 99 v8SetReturnValue(info, info.Holder()); | |
| 100 return; | |
| 101 } | |
| 102 | |
| 103 TestInterfaceConstructor4V8Internal::constructor(info); | |
| 104 } | |
| 105 | |
| 106 static void installV8TestInterfaceConstructor4Template(v8::Handle<v8::FunctionTe
mplate> functionTemplate, v8::Isolate* isolate) | |
| 107 { | |
| 108 functionTemplate->ReadOnlyPrototype(); | |
| 109 | |
| 110 v8::Local<v8::Signature> defaultSignature; | |
| 111 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceConstructor4", v8::Local<v8::FunctionTemplate>(), V8TestInter
faceConstructor4::internalFieldCount, | |
| 112 0, 0, | |
| 113 0, 0, | |
| 114 0, 0, | |
| 115 isolate); | |
| 116 functionTemplate->SetCallHandler(V8TestInterfaceConstructor4::constructorCal
lback); | |
| 117 functionTemplate->SetLength(1); | |
| 118 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTempla
te->InstanceTemplate(); | |
| 119 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTempl
ate->PrototypeTemplate(); | |
| 120 | |
| 121 // Custom toString template | |
| 122 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:from(isolate)->toStringTemplate()); | |
| 123 } | |
| 124 | |
| 125 v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructor4::domTemplate(v8::Is
olate* isolate) | |
| 126 { | |
| 127 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeI
nfo*>(&wrapperTypeInfo), installV8TestInterfaceConstructor4Template); | |
| 128 } | |
| 129 | |
| 130 bool V8TestInterfaceConstructor4::hasInstance(v8::Handle<v8::Value> v8Value, v8:
:Isolate* isolate) | |
| 131 { | |
| 132 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); | |
| 133 } | |
| 134 | |
| 135 v8::Handle<v8::Object> V8TestInterfaceConstructor4::findInstanceInPrototypeChain
(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) | |
| 136 { | |
| 137 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); | |
| 138 } | |
| 139 | |
| 140 TestInterfaceConstructor4* V8TestInterfaceConstructor4::toImplWithTypeCheck(v8::
Isolate* isolate, v8::Handle<v8::Value> value) | |
| 141 { | |
| 142 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle
<v8::Object>::Cast(value))->toImpl<TestInterfaceConstructor4>() : 0; | |
| 143 } | |
| 144 | |
| 145 | |
| 146 void V8TestInterfaceConstructor4::refObject(ScriptWrappableBase* internalPointer
) | |
| 147 { | |
| 148 internalPointer->toImpl<TestInterfaceConstructor4>()->ref(); | |
| 149 } | |
| 150 | |
| 151 void V8TestInterfaceConstructor4::derefObject(ScriptWrappableBase* internalPoint
er) | |
| 152 { | |
| 153 internalPointer->toImpl<TestInterfaceConstructor4>()->deref(); | |
| 154 } | |
| 155 | |
| 156 WrapperPersistentNode* V8TestInterfaceConstructor4::createPersistentHandle(Scrip
tWrappableBase* internalPointer) | |
| 157 { | |
| 158 ASSERT_NOT_REACHED(); | |
| 159 return 0; | |
| 160 } | |
| 161 | |
| 162 template<> | |
| 163 v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor4* impl, v8::Handle<v
8::Object> creationContext, v8::Isolate* isolate) | |
| 164 { | |
| 165 return toV8(impl, creationContext, isolate); | |
| 166 } | |
| 167 | |
| 168 } // namespace blink | |
| OLD | NEW |