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.
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
8 #include "V8TestSpecialOperationsNotEnumerable.h"
10 #include "RuntimeEnabledFeatures.h"
11 #include "bindings/v8/ExceptionState.h"
12 #include "bindings/v8/V8DOMConfiguration.h"
13 #include "bindings/v8/V8HiddenValue.h"
14 #include "bindings/v8/V8ObjectConstructor.h"
15 #include "core/dom/ContextFeatures.h"
16 #include "core/dom/Document.h"
17 #include "platform/TraceEvent.h"
18 #include "wtf/GetPtr.h"
19 #include "wtf/RefPtr.h"
23 static void initializeScriptWrappableForInterface(TestSpecialOperationsNotEnumerable* object)
25 if (ScriptWrappable::wrapperCanBeStoredInObject(object))
26 ScriptWrappable::fromObject(object)->setTypeInfo(&V8TestSpecialOperationsNotEnumerable::wrapperTypeInfo);
31 } // namespace WebCore
33 void webCoreInitializeScriptWrappableForInterface(WebCore::TestSpecialOperationsNotEnumerable* object)
35 WebCore::initializeScriptWrappableForInterface(object);
39 const WrapperTypeInfo V8TestSpecialOperationsNotEnumerable::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestSpecialOperationsNotEnumerable::domTemplate, V8TestSpecialOperationsNotEnumerable::derefObject, 0, 0, 0, V8TestSpecialOperationsNotEnumerable::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype, RefCountedObject };
41 namespace TestSpecialOperationsNotEnumerableV8Internal {
43 template <typename T> void V8_USE(T) { }
45 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
47 TestSpecialOperationsNotEnumerable* impl = V8TestSpecialOperationsNotEnumerable::toNative(info.Holder());
48 String result = impl->anonymousIndexedGetter(index);
51 v8SetReturnValueString(info, result, info.GetIsolate());
54 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
56 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
57 TestSpecialOperationsNotEnumerableV8Internal::indexedPropertyGetter(index, info);
58 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
61 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
63 if (info.Holder()->HasRealNamedProperty(name))
65 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
68 TestSpecialOperationsNotEnumerable* impl = V8TestSpecialOperationsNotEnumerable::toNative(info.Holder());
69 AtomicString propertyName = toCoreAtomicString(name);
70 String result = impl->anonymousNamedGetter(propertyName);
73 v8SetReturnValueString(info, result, info.GetIsolate());
76 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
78 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
79 TestSpecialOperationsNotEnumerableV8Internal::namedPropertyGetter(name, info);
80 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
83 } // namespace TestSpecialOperationsNotEnumerableV8Internal
85 static void configureV8TestSpecialOperationsNotEnumerableTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
87 functionTemplate->ReadOnlyPrototype();
89 v8::Local<v8::Signature> defaultSignature;
90 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestSpecialOperationsNotEnumerable", v8::Local<v8::FunctionTemplate>(), V8TestSpecialOperationsNotEnumerable::internalFieldCount,
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);
100 // Custom toString template
101 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
104 v8::Handle<v8::FunctionTemplate> V8TestSpecialOperationsNotEnumerable::domTemplate(v8::Isolate* isolate)
106 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
107 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(const_cast<WrapperTypeInfo*>(&wrapperTypeInfo));
108 if (!result.IsEmpty())
111 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
112 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidConstructorMode);
113 configureV8TestSpecialOperationsNotEnumerableTemplate(result, isolate);
114 data->setDOMTemplate(const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), result);
118 bool V8TestSpecialOperationsNotEnumerable::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
120 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
123 v8::Handle<v8::Object> V8TestSpecialOperationsNotEnumerable::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
125 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
128 TestSpecialOperationsNotEnumerable* V8TestSpecialOperationsNotEnumerable::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
130 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Object>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0;
133 v8::Handle<v8::Object> V8TestSpecialOperationsNotEnumerable::createWrapper(PassRefPtr<TestSpecialOperationsNotEnumerable> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
136 ASSERT(!DOMDataStore::containsWrapper<V8TestSpecialOperationsNotEnumerable>(impl.get(), isolate));
137 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
138 const WrapperTypeInfo* actualInfo = ScriptWrappable::fromObject(impl.get())->typeInfo();
139 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapperTypeInfo. These will both have
140 // the same object de-ref functions, though, so use that as the basis of the check.
141 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
144 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate);
145 if (UNLIKELY(wrapper.IsEmpty()))
148 installPerContextEnabledProperties(wrapper, impl.get(), isolate);
149 V8DOMWrapper::associateObjectWithWrapper<V8TestSpecialOperationsNotEnumerable>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent);
153 void V8TestSpecialOperationsNotEnumerable::derefObject(void* object)
155 fromInternalPointer(object)->deref();
159 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsNotEnumerable* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
161 return toV8(impl, creationContext, isolate);
164 } // namespace WebCore