Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / bindings / tests / results / core / V8TestInterfaceCustomConstructor.cpp
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, V8TestInterfaceCustomConstructor::refObject, V8TestInterfaceCustomConstructor::derefObject, V8TestInterfaceCustomConstructor::trace, 0, 0, 0, V8TestInterfaceCustomConstructor::installConditionallyEnabledMethods, V8TestInterfaceCustomConstructor::installConditionallyEnabledProperties, 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::Independent, WrapperTypeInfo::RefCountedObject };
25
26 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestInterfaceCustomConstructor.h.
27 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
28 // bindings/core/v8/ScriptWrappable.h.
29 const WrapperTypeInfo& TestInterfaceCustomConstructor::s_wrapperTypeInfo = V8TestInterfaceCustomConstructor::wrapperTypeInfo;
30
31 namespace TestInterfaceCustomConstructorV8Internal {
32
33 } // namespace TestInterfaceCustomConstructorV8Internal
34
35 void V8TestInterfaceCustomConstructor::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
36 {
37     TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMConstructor");
38     if (!info.IsConstructCall()) {
39         V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::constructorNotCallableAsFunction("TestInterfaceCustomConstructor"));
40         return;
41     }
42
43     if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExistingObject) {
44         v8SetReturnValue(info, info.Holder());
45         return;
46     }
47
48     V8TestInterfaceCustomConstructor::constructorCustom(info);
49 }
50
51 static void installV8TestInterfaceCustomConstructorTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
52 {
53     functionTemplate->ReadOnlyPrototype();
54
55     v8::Local<v8::Signature> defaultSignature;
56     defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterfaceCustomConstructor", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceCustomConstructor::internalFieldCount,
57         0, 0,
58         0, 0,
59         0, 0,
60         isolate);
61     functionTemplate->SetCallHandler(V8TestInterfaceCustomConstructor::constructorCallback);
62     functionTemplate->SetLength(0);
63     v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate();
64     ALLOW_UNUSED_LOCAL(instanceTemplate);
65     v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate();
66     ALLOW_UNUSED_LOCAL(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(v8::Isolate* isolate)
73 {
74     return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8TestInterfaceCustomConstructorTemplate);
75 }
76
77 bool V8TestInterfaceCustomConstructor::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
78 {
79     return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
80 }
81
82 v8::Handle<v8::Object> V8TestInterfaceCustomConstructor::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
83 {
84     return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
85 }
86
87 TestInterfaceCustomConstructor* V8TestInterfaceCustomConstructor::toImplWithTypeCheck(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 void V8TestInterfaceCustomConstructor::refObject(ScriptWrappableBase* scriptWrappableBase)
93 {
94     scriptWrappableBase->toImpl<TestInterfaceCustomConstructor>()->ref();
95 }
96
97 void V8TestInterfaceCustomConstructor::derefObject(ScriptWrappableBase* scriptWrappableBase)
98 {
99     scriptWrappableBase->toImpl<TestInterfaceCustomConstructor>()->deref();
100 }
101
102 template<>
103 v8::Handle<v8::Value> toV8NoInline(TestInterfaceCustomConstructor* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
104 {
105     return toV8(impl, creationContext, isolate);
106 }
107
108 } // namespace blink