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
21namespace blink {
22
23const WrapperTypeInfo V8TestSpecialOperationsNotEnumerable::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestSpecialOperationsNotEnumerable::domTemplate, V8TestSpecialOperationsNotEnumerable::refObject, V8TestSpecialOperationsNotEnumerable::derefObject, V8TestSpecialOperationsNotEnumerable::createPersistentHandle, 0, 0, 0, V8TestSpecialOperationsNotEnumerable::installConditionallyEnabledMethods, V8TestSpecialOperationsNotEnumerable::installConditionallyEnabledProperties, 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::Independent, WrapperTypeInfo::RefCountedObject };
24
25// This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestSpecialOperationsNotEnumerable.h.
26// For details, see the comment of DEFINE_WRAPPERTYPEINFO in
27// bindings/core/v8/ScriptWrappable.h.
28const WrapperTypeInfo& TestSpecialOperationsNotEnumerable::s_wrapperTypeInfo = V8TestSpecialOperationsNotEnumerable::wrapperTypeInfo;
29
30namespace TestSpecialOperationsNotEnumerableV8Internal {
31
32template <typename T> void V8_USE(T) { }
33
34static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
35{
36    TestSpecialOperationsNotEnumerable* impl = V8TestSpecialOperationsNotEnumerable::toImpl(info.Holder());
37    String result = impl->anonymousIndexedGetter(index);
38    if (result.isNull())
39        return;
40    v8SetReturnValueString(info, result, info.GetIsolate());
41}
42
43static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
44{
45    TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty");
46    TestSpecialOperationsNotEnumerableV8Internal::indexedPropertyGetter(index, info);
47    TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
48}
49
50static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
51{
52    if (info.Holder()->HasRealNamedProperty(name))
53        return;
54    if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
55        return;
56
57    TestSpecialOperationsNotEnumerable* impl = V8TestSpecialOperationsNotEnumerable::toImpl(info.Holder());
58    AtomicString propertyName = toCoreAtomicString(name);
59    String result = impl->anonymousNamedGetter(propertyName);
60    if (result.isNull())
61        return;
62    v8SetReturnValueString(info, result, info.GetIsolate());
63}
64
65static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
66{
67    TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
68    TestSpecialOperationsNotEnumerableV8Internal::namedPropertyGetter(name, info);
69    TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
70}
71
72} // namespace TestSpecialOperationsNotEnumerableV8Internal
73
74static void installV8TestSpecialOperationsNotEnumerableTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
75{
76    functionTemplate->ReadOnlyPrototype();
77
78    v8::Local<v8::Signature> defaultSignature;
79    defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestSpecialOperationsNotEnumerable", v8::Local<v8::FunctionTemplate>(), V8TestSpecialOperationsNotEnumerable::internalFieldCount,
80        0, 0,
81        0, 0,
82        0, 0,
83        isolate);
84    v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTemplate->InstanceTemplate();
85    v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTemplate->PrototypeTemplate();
86    functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestSpecialOperationsNotEnumerableV8Internal::indexedPropertyGetterCallback, 0, 0, 0, 0);
87    functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestSpecialOperationsNotEnumerableV8Internal::namedPropertyGetterCallback, 0, 0, 0, 0);
88
89    // Custom toString template
90    functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
91}
92
93v8::Handle<v8::FunctionTemplate> V8TestSpecialOperationsNotEnumerable::domTemplate(v8::Isolate* isolate)
94{
95    return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8TestSpecialOperationsNotEnumerableTemplate);
96}
97
98bool V8TestSpecialOperationsNotEnumerable::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
99{
100    return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
101}
102
103v8::Handle<v8::Object> V8TestSpecialOperationsNotEnumerable::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
104{
105    return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
106}
107
108TestSpecialOperationsNotEnumerable* V8TestSpecialOperationsNotEnumerable::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
109{
110    return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestSpecialOperationsNotEnumerable>() : 0;
111}
112
113
114void V8TestSpecialOperationsNotEnumerable::refObject(ScriptWrappableBase* internalPointer)
115{
116    internalPointer->toImpl<TestSpecialOperationsNotEnumerable>()->ref();
117}
118
119void V8TestSpecialOperationsNotEnumerable::derefObject(ScriptWrappableBase* internalPointer)
120{
121    internalPointer->toImpl<TestSpecialOperationsNotEnumerable>()->deref();
122}
123
124WrapperPersistentNode* V8TestSpecialOperationsNotEnumerable::createPersistentHandle(ScriptWrappableBase* internalPointer)
125{
126    ASSERT_NOT_REACHED();
127    return 0;
128}
129
130template<>
131v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsNotEnumerable* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
132{
133    return toV8(impl, creationContext, isolate);
134}
135
136} // namespace blink
137