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 "V8TestInterfaceCustomConstructor.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 V8TestInterfaceCustomConstructor::wrapperTypeInfo = { gin:
:kEmbedderBlink, V8TestInterfaceCustomConstructor::domTemplate, V8TestInterfaceC
ustomConstructor::refObject, V8TestInterfaceCustomConstructor::derefObject, V8Te
stInterfaceCustomConstructor::createPersistentHandle, 0, 0, 0, V8TestInterfaceCu
stomConstructor::installConditionallyEnabledMethods, V8TestInterfaceCustomConstr
uctor::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
eCustomConstructor.h. | |
27 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in | |
28 // bindings/core/v8/ScriptWrappable.h. | |
29 const WrapperTypeInfo& TestInterfaceCustomConstructor::s_wrapperTypeInfo = V8Tes
tInterfaceCustomConstructor::wrapperTypeInfo; | |
30 | |
31 namespace TestInterfaceCustomConstructorV8Internal { | |
32 | |
33 template <typename T> void V8_USE(T) { } | |
34 | |
35 } // namespace TestInterfaceCustomConstructorV8Internal | |
36 | |
37 void V8TestInterfaceCustomConstructor::constructorCallback(const v8::FunctionCal
lbackInfo<v8::Value>& info) | |
38 { | |
39 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMConstructor"); | |
40 if (!info.IsConstructCall()) { | |
41 V8ThrowException::throwTypeError(ExceptionMessages::constructorNotCallab
leAsFunction("TestInterfaceCustomConstructor"), info.GetIsolate()); | |
42 return; | |
43 } | |
44 | |
45 if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExis
tingObject) { | |
46 v8SetReturnValue(info, info.Holder()); | |
47 return; | |
48 } | |
49 | |
50 V8TestInterfaceCustomConstructor::constructorCustom(info); | |
51 } | |
52 | |
53 static void installV8TestInterfaceCustomConstructorTemplate(v8::Handle<v8::Funct
ionTemplate> functionTemplate, v8::Isolate* isolate) | |
54 { | |
55 functionTemplate->ReadOnlyPrototype(); | |
56 | |
57 v8::Local<v8::Signature> defaultSignature; | |
58 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceCustomConstructor", v8::Local<v8::FunctionTemplate>(), V8Test
InterfaceCustomConstructor::internalFieldCount, | |
59 0, 0, | |
60 0, 0, | |
61 0, 0, | |
62 isolate); | |
63 functionTemplate->SetCallHandler(V8TestInterfaceCustomConstructor::construct
orCallback); | |
64 functionTemplate->SetLength(0); | |
65 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTempla
te->InstanceTemplate(); | |
66 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTempl
ate->PrototypeTemplate(); | |
67 | |
68 // Custom toString template | |
69 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:from(isolate)->toStringTemplate()); | |
70 } | |
71 | |
72 v8::Handle<v8::FunctionTemplate> V8TestInterfaceCustomConstructor::domTemplate(v
8::Isolate* isolate) | |
73 { | |
74 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeI
nfo*>(&wrapperTypeInfo), installV8TestInterfaceCustomConstructorTemplate); | |
75 } | |
76 | |
77 bool V8TestInterfaceCustomConstructor::hasInstance(v8::Handle<v8::Value> v8Value
, v8::Isolate* isolate) | |
78 { | |
79 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); | |
80 } | |
81 | |
82 v8::Handle<v8::Object> V8TestInterfaceCustomConstructor::findInstanceInPrototype
Chain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) | |
83 { | |
84 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); | |
85 } | |
86 | |
87 TestInterfaceCustomConstructor* V8TestInterfaceCustomConstructor::toImplWithType
Check(v8::Isolate* isolate, v8::Handle<v8::Value> value) | |
88 { | |
89 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle
<v8::Object>::Cast(value))->toImpl<TestInterfaceCustomConstructor>() : 0; | |
90 } | |
91 | |
92 | |
93 void V8TestInterfaceCustomConstructor::refObject(ScriptWrappableBase* internalPo
inter) | |
94 { | |
95 internalPointer->toImpl<TestInterfaceCustomConstructor>()->ref(); | |
96 } | |
97 | |
98 void V8TestInterfaceCustomConstructor::derefObject(ScriptWrappableBase* internal
Pointer) | |
99 { | |
100 internalPointer->toImpl<TestInterfaceCustomConstructor>()->deref(); | |
101 } | |
102 | |
103 WrapperPersistentNode* V8TestInterfaceCustomConstructor::createPersistentHandle(
ScriptWrappableBase* internalPointer) | |
104 { | |
105 ASSERT_NOT_REACHED(); | |
106 return 0; | |
107 } | |
108 | |
109 template<> | |
110 v8::Handle<v8::Value> toV8NoInline(TestInterfaceCustomConstructor* impl, v8::Han
dle<v8::Object> creationContext, v8::Isolate* isolate) | |
111 { | |
112 return toV8(impl, creationContext, isolate); | |
113 } | |
114 | |
115 } // namespace blink | |
OLD | NEW |