Upstream version 10.38.222.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / bindings / tests / results / V8TestSpecialOperationsNotEnumerable.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 "V8TestSpecialOperationsNotEnumerable.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 "platform/RuntimeEnabledFeatures.h"
17 #include "platform/TraceEvent.h"
18 #include "wtf/GetPtr.h"
19 #include "wtf/RefPtr.h"
20
21 namespace blink {
22
23 static void initializeScriptWrappableForInterface(TestSpecialOperationsNotEnumerable* object)
24 {
25     if (ScriptWrappable::wrapperCanBeStoredInObject(object))
26         ScriptWrappable::fromObject(object)->setTypeInfo(&V8TestSpecialOperationsNotEnumerable::wrapperTypeInfo);
27     else
28         ASSERT_NOT_REACHED();
29 }
30
31 } // namespace blink
32
33 void webCoreInitializeScriptWrappableForInterface(blink::TestSpecialOperationsNotEnumerable* object)
34 {
35     blink::initializeScriptWrappableForInterface(object);
36 }
37
38 namespace blink {
39 const WrapperTypeInfo V8TestSpecialOperationsNotEnumerable::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestSpecialOperationsNotEnumerable::domTemplate, V8TestSpecialOperationsNotEnumerable::derefObject, 0, 0, 0, V8TestSpecialOperationsNotEnumerable::installConditionallyEnabledMethods, 0, WrapperTypeObjectPrototype, RefCountedObject };
40
41 namespace TestSpecialOperationsNotEnumerableV8Internal {
42
43 template <typename T> void V8_USE(T) { }
44
45 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
46 {
47     TestSpecialOperationsNotEnumerable* impl = V8TestSpecialOperationsNotEnumerable::toNative(info.Holder());
48     String result = impl->anonymousIndexedGetter(index);
49     if (result.isNull())
50         return;
51     v8SetReturnValueString(info, result, info.GetIsolate());
52 }
53
54 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
55 {
56     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty");
57     TestSpecialOperationsNotEnumerableV8Internal::indexedPropertyGetter(index, info);
58     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
59 }
60
61 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
62 {
63     if (info.Holder()->HasRealNamedProperty(name))
64         return;
65     if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
66         return;
67
68     TestSpecialOperationsNotEnumerable* impl = V8TestSpecialOperationsNotEnumerable::toNative(info.Holder());
69     AtomicString propertyName = toCoreAtomicString(name);
70     String result = impl->anonymousNamedGetter(propertyName);
71     if (result.isNull())
72         return;
73     v8SetReturnValueString(info, result, info.GetIsolate());
74 }
75
76 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
77 {
78     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
79     TestSpecialOperationsNotEnumerableV8Internal::namedPropertyGetter(name, info);
80     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
81 }
82
83 } // namespace TestSpecialOperationsNotEnumerableV8Internal
84
85 static void installV8TestSpecialOperationsNotEnumerableTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
86 {
87     functionTemplate->ReadOnlyPrototype();
88
89     v8::Local<v8::Signature> defaultSignature;
90     defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestSpecialOperationsNotEnumerable", v8::Local<v8::FunctionTemplate>(), V8TestSpecialOperationsNotEnumerable::internalFieldCount,
91         0, 0,
92         0, 0,
93         0, 0,
94         isolate);
95     v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTemplate->InstanceTemplate();
96     v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTemplate->PrototypeTemplate();
97     functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestSpecialOperationsNotEnumerableV8Internal::indexedPropertyGetterCallback, 0, 0, 0, 0);
98     functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestSpecialOperationsNotEnumerableV8Internal::namedPropertyGetterCallback, 0, 0, 0, 0);
99
100     // Custom toString template
101     functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
102 }
103
104 v8::Handle<v8::FunctionTemplate> V8TestSpecialOperationsNotEnumerable::domTemplate(v8::Isolate* isolate)
105 {
106     return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8TestSpecialOperationsNotEnumerableTemplate);
107 }
108
109 bool V8TestSpecialOperationsNotEnumerable::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
110 {
111     return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
112 }
113
114 v8::Handle<v8::Object> V8TestSpecialOperationsNotEnumerable::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
115 {
116     return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
117 }
118
119 TestSpecialOperationsNotEnumerable* V8TestSpecialOperationsNotEnumerable::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
120 {
121     return hasInstance(value, isolate) ? fromInternalPointer(blink::toInternalPointer(v8::Handle<v8::Object>::Cast(value))) : 0;
122 }
123
124 v8::Handle<v8::Object> wrap(TestSpecialOperationsNotEnumerable* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
125 {
126     ASSERT(impl);
127     ASSERT(!DOMDataStore::containsWrapper<V8TestSpecialOperationsNotEnumerable>(impl, isolate));
128     return V8TestSpecialOperationsNotEnumerable::createWrapper(impl, creationContext, isolate);
129 }
130
131 v8::Handle<v8::Object> V8TestSpecialOperationsNotEnumerable::createWrapper(PassRefPtr<TestSpecialOperationsNotEnumerable> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
132 {
133     ASSERT(impl);
134     ASSERT(!DOMDataStore::containsWrapper<V8TestSpecialOperationsNotEnumerable>(impl.get(), isolate));
135     if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
136         const WrapperTypeInfo* actualInfo = ScriptWrappable::fromObject(impl.get())->typeInfo();
137         // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapperTypeInfo. These will both have
138         // the same object de-ref functions, though, so use that as the basis of the check.
139         RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
140     }
141
142     v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate);
143     if (UNLIKELY(wrapper.IsEmpty()))
144         return wrapper;
145
146     installConditionallyEnabledProperties(wrapper, isolate);
147     V8DOMWrapper::associateObjectWithWrapper<V8TestSpecialOperationsNotEnumerable>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent);
148     return wrapper;
149 }
150
151 void V8TestSpecialOperationsNotEnumerable::derefObject(ScriptWrappableBase* internalPointer)
152 {
153     fromInternalPointer(internalPointer)->deref();
154 }
155
156 template<>
157 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsNotEnumerable* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
158 {
159     return toV8(impl, creationContext, isolate);
160 }
161
162 } // namespace blink