Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1857)

Unified Diff: third_party/WebKit/Source/bindings/tests/results/core/V8TestIntegerIndexedGlobal.cpp

Issue 1381413003: [bindings] add support for integer-indexed @@iterator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use SetIntrinsicDataProperty() in new V8 roll Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/tests/results/core/V8TestIntegerIndexedGlobal.cpp
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestIntegerIndexedGlobal.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestIntegerIndexedGlobal.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..3ee806c4fd7d35c3ddfbe3fdd1d61be8411adf18
--- /dev/null
+++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestIntegerIndexedGlobal.cpp
@@ -0,0 +1,232 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
+
+#include "config.h"
+#include "V8TestIntegerIndexedGlobal.h"
+
+#include "bindings/core/v8/ExceptionState.h"
+#include "bindings/core/v8/V8DOMConfiguration.h"
+#include "bindings/core/v8/V8Document.h"
+#include "bindings/core/v8/V8Node.h"
+#include "bindings/core/v8/V8ObjectConstructor.h"
+#include "core/dom/ContextFeatures.h"
+#include "core/dom/Document.h"
+#include "platform/RuntimeEnabledFeatures.h"
+#include "platform/TraceEvent.h"
+#include "wtf/GetPtr.h"
+#include "wtf/RefPtr.h"
+
+namespace blink {
+
+// Suppress warning: global constructors, because struct WrapperTypeInfo is trivial
+// and does not depend on another global objects.
+#if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wglobal-constructors"
+#endif
+const WrapperTypeInfo V8TestIntegerIndexedGlobal::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestIntegerIndexedGlobal::domTemplate, V8TestIntegerIndexedGlobal::refObject, V8TestIntegerIndexedGlobal::derefObject, V8TestIntegerIndexedGlobal::trace, 0, 0, V8TestIntegerIndexedGlobal::preparePrototypeAndInterfaceObject, V8TestIntegerIndexedGlobal::installConditionallyEnabledProperties, "TestIntegerIndexedGlobal", 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::NotInheritFromEventTarget, WrapperTypeInfo::Independent, WrapperTypeInfo::RefCountedObject };
+#if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
+#pragma clang diagnostic pop
+#endif
+
+// This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestIntegerIndexedGlobal.h.
+// For details, see the comment of DEFINE_WRAPPERTYPEINFO in
+// bindings/core/v8/ScriptWrappable.h.
+const WrapperTypeInfo& TestIntegerIndexedGlobal::s_wrapperTypeInfo = V8TestIntegerIndexedGlobal::wrapperTypeInfo;
+
+namespace TestIntegerIndexedGlobalV8Internal {
+
+static void lengthAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ v8::Local<v8::Object> holder = info.Holder();
+ TestIntegerIndexedGlobal* impl = V8TestIntegerIndexedGlobal::toImpl(holder);
+ v8SetReturnValue(info, static_cast<double>(impl->length()));
+}
+
+static void lengthAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
+ TestIntegerIndexedGlobalV8Internal::lengthAttributeGetter(info);
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
+}
+
+static void lengthAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ v8::Local<v8::Object> holder = info.Holder();
+ ExceptionState exceptionState(ExceptionState::SetterContext, "length", "TestIntegerIndexedGlobal", holder, info.GetIsolate());
+ TestIntegerIndexedGlobal* impl = V8TestIntegerIndexedGlobal::toImpl(holder);
+ unsigned long long cppValue = toUInt64(info.GetIsolate(), v8Value, NormalConversion, exceptionState);
+ if (exceptionState.throwIfNeeded())
+ return;
+ impl->setLength(cppValue);
+}
+
+static void lengthAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ v8::Local<v8::Value> v8Value = info[0];
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
+ TestIntegerIndexedGlobalV8Internal::lengthAttributeSetter(v8Value, info);
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
+}
+
+static void voidMethodDocumentMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ if (UNLIKELY(info.Length() < 1)) {
+ V8ThrowException::throwException(createMinimumArityTypeErrorForMethod(info.GetIsolate(), "voidMethodDocument", "TestIntegerIndexedGlobal", 1, info.Length()), info.GetIsolate());
+ return;
+ }
+ TestIntegerIndexedGlobal* impl = V8TestIntegerIndexedGlobal::toImpl(info.Holder());
+ Document* document;
+ {
+ document = V8Document::toImplWithTypeCheck(info.GetIsolate(), info[0]);
+ }
+ impl->voidMethodDocument(document);
+}
+
+static void voidMethodDocumentMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
+ TestIntegerIndexedGlobalV8Internal::voidMethodDocumentMethod(info);
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
+}
+
+static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty");
+ V8TestIntegerIndexedGlobal::indexedPropertyGetterCustom(index, info);
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
+}
+
+static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty");
+ V8TestIntegerIndexedGlobal::indexedPropertySetterCustom(index, v8Value, info);
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
+}
+
+static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty");
+ V8TestIntegerIndexedGlobal::indexedPropertyDeleterCustom(index, info);
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
+}
+
+static void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
+ V8TestIntegerIndexedGlobal::namedPropertyGetterCustom(name, info);
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
+}
+
+static void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
+ V8TestIntegerIndexedGlobal::namedPropertySetterCustom(name, v8Value, info);
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
+}
+
+static void namedPropertyQueryCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
+ V8TestIntegerIndexedGlobal::namedPropertyQueryCustom(name, info);
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
+}
+
+static void namedPropertyDeleterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
+ V8TestIntegerIndexedGlobal::namedPropertyDeleterCustom(name, info);
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
+}
+
+static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::Array>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
+ V8TestIntegerIndexedGlobal::namedPropertyEnumeratorCustom(info);
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
+}
+
+} // namespace TestIntegerIndexedGlobalV8Internal
+
+const V8DOMConfiguration::AccessorConfiguration V8TestIntegerIndexedGlobalAccessors[] = {
+ {"length", TestIntegerIndexedGlobalV8Internal::lengthAttributeGetterCallback, TestIntegerIndexedGlobalV8Internal::lengthAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
+};
+
+const V8DOMConfiguration::MethodConfiguration V8TestIntegerIndexedGlobalMethods[] = {
+ {"voidMethodDocument", TestIntegerIndexedGlobalV8Internal::voidMethodDocumentMethodCallback, 0, 1, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
+};
+
+static void installV8TestIntegerIndexedGlobalTemplate(v8::Local<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
+{
+ functionTemplate->ReadOnlyPrototype();
+
+ v8::Local<v8::Signature> defaultSignature;
+ defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "TestIntegerIndexedGlobal", V8TestIntegerIndexedGlobal::domTemplateForNamedPropertiesObject(isolate), V8TestIntegerIndexedGlobal::internalFieldCount,
+ 0, 0,
+ V8TestIntegerIndexedGlobalAccessors, WTF_ARRAY_LENGTH(V8TestIntegerIndexedGlobalAccessors),
+ V8TestIntegerIndexedGlobalMethods, WTF_ARRAY_LENGTH(V8TestIntegerIndexedGlobalMethods));
+ v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate();
+ ALLOW_UNUSED_LOCAL(instanceTemplate);
+ v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate();
+ ALLOW_UNUSED_LOCAL(prototypeTemplate);
+ if (RuntimeEnabledFeatures::iterableCollectionsEnabled()) {
+ instanceTemplate->SetIntrinsicDataProperty(v8::Symbol::GetIterator(isolate), v8::kArrayProto_values, v8::DontEnum);
+ }
+ v8::IndexedPropertyHandlerConfiguration indexedPropertyHandlerConfig(TestIntegerIndexedGlobalV8Internal::indexedPropertyGetterCallback, TestIntegerIndexedGlobalV8Internal::indexedPropertySetterCallback, 0, TestIntegerIndexedGlobalV8Internal::indexedPropertyDeleterCallback, indexedPropertyEnumerator<TestIntegerIndexedGlobal>, v8::Local<v8::Value>(), v8::PropertyHandlerFlags::kNone);
+ instanceTemplate->SetHandler(indexedPropertyHandlerConfig);
+ functionTemplate->SetHiddenPrototype(true);
+
+ // Custom toString template
+ functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
+}
+
+v8::Local<v8::FunctionTemplate> V8TestIntegerIndexedGlobal::domTemplate(v8::Isolate* isolate)
+{
+ return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8TestIntegerIndexedGlobalTemplate);
+}
+
+v8::Local<v8::FunctionTemplate> V8TestIntegerIndexedGlobal::domTemplateForNamedPropertiesObject(v8::Isolate* isolate)
+{
+ v8::Local<v8::FunctionTemplate> parentTemplate = V8None::domTemplate(isolate);
+
+ v8::Local<v8::FunctionTemplate> namedPropertiesObjectFunctionTemplate = v8::FunctionTemplate::New(isolate);
+ namedPropertiesObjectFunctionTemplate->SetClassName(v8AtomicString(isolate, "TestIntegerIndexedGlobalProperties"));
+ namedPropertiesObjectFunctionTemplate->Inherit(parentTemplate);
+
+ v8::Local<v8::ObjectTemplate> namedPropertiesObjectTemplate = namedPropertiesObjectFunctionTemplate->PrototypeTemplate();
+ namedPropertiesObjectTemplate->SetInternalFieldCount(V8TestIntegerIndexedGlobal::internalFieldCount);
+ v8::NamedPropertyHandlerConfiguration namedPropertyHandlerConfig(TestIntegerIndexedGlobalV8Internal::namedPropertyGetterCallback, TestIntegerIndexedGlobalV8Internal::namedPropertySetterCallback, TestIntegerIndexedGlobalV8Internal::namedPropertyQueryCallback, TestIntegerIndexedGlobalV8Internal::namedPropertyDeleterCallback, TestIntegerIndexedGlobalV8Internal::namedPropertyEnumeratorCallback, v8::Local<v8::Value>(), static_cast<v8::PropertyHandlerFlags>(int(v8::PropertyHandlerFlags::kOnlyInterceptStrings) | int(v8::PropertyHandlerFlags::kNonMasking)));
+ namedPropertiesObjectTemplate->SetHandler(namedPropertyHandlerConfig);
+
+ return namedPropertiesObjectFunctionTemplate;
+}
+
+bool V8TestIntegerIndexedGlobal::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isolate)
+{
+ return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
+}
+
+v8::Local<v8::Object> V8TestIntegerIndexedGlobal::findInstanceInPrototypeChain(v8::Local<v8::Value> v8Value, v8::Isolate* isolate)
+{
+ return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
+}
+
+TestIntegerIndexedGlobal* V8TestIntegerIndexedGlobal::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local<v8::Value> value)
+{
+ return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(value)) : 0;
+}
+
+void V8TestIntegerIndexedGlobal::refObject(ScriptWrappable* scriptWrappable)
+{
+ scriptWrappable->toImpl<TestIntegerIndexedGlobal>()->ref();
+}
+
+void V8TestIntegerIndexedGlobal::derefObject(ScriptWrappable* scriptWrappable)
+{
+ scriptWrappable->toImpl<TestIntegerIndexedGlobal>()->deref();
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698