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

Unified Diff: Source/bindings/tests/results/modules/V8TestInterfacePartial.cpp

Issue 618373003: [bindings] partial interfaces should not violate componentization (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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: Source/bindings/tests/results/modules/V8TestInterfacePartial.cpp
diff --git a/Source/bindings/tests/results/modules/V8TestInterfacePartial.cpp b/Source/bindings/tests/results/modules/V8TestInterfacePartial.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..7755b5324303d05ec6807280bd93bcb349141e43
--- /dev/null
+++ b/Source/bindings/tests/results/modules/V8TestInterfacePartial.cpp
@@ -0,0 +1,322 @@
+// 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"
+#if ENABLE(CONDITION)
+#include "V8TestInterfacePartial.h"
+
+#include "bindings/core/v8/ExceptionState.h"
+#include "bindings/core/v8/PrivateScriptRunner.h"
+#include "bindings/core/v8/ScriptValue.h"
+#include "bindings/core/v8/V8DOMConfiguration.h"
+#include "bindings/core/v8/V8HiddenValue.h"
+#include "bindings/core/v8/V8Node.h"
+#include "bindings/core/v8/V8ObjectConstructor.h"
+#include "bindings/core/v8/V8TestInterface.h"
+#include "bindings/core/v8/V8TestInterfaceEmpty.h"
+#include "bindings/tests/idls/modules/TestPartialInterfaceImplementation3.h"
+#include "core/dom/ContextFeatures.h"
+#include "core/dom/Document.h"
+#include "core/frame/LocalFrame.h"
+#include "platform/RuntimeEnabledFeatures.h"
+#include "platform/ScriptForbiddenScope.h"
+#include "platform/TraceEvent.h"
+#include "wtf/GetPtr.h"
+#include "wtf/RefPtr.h"
+
+namespace blink {
+
+namespace TestPartialInterfaceImplementation3PartialV8Internal {
+
+static void partial3LongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ v8::Handle<v8::Object> holder = info.Holder();
+ TestPartialInterfaceImplementation3* impl = V8TestInterface::toImpl(holder);
+ v8SetReturnValueInt(info, TestPartialInterfaceImplementation3::partial3LongAttribute(*impl));
+}
+
+static void partial3LongAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
+ TestPartialInterfaceImplementation3PartialV8Internal::partial3LongAttributeAttributeGetter(info);
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
+}
+
+static void partial3LongAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Handle<v8::Object> holder = info.Holder();
+ ExceptionState exceptionState(ExceptionState::SetterContext, "partial3LongAttribute", "TestInterface", holder, info.GetIsolate());
+ TestPartialInterfaceImplementation3* impl = V8TestInterface::toImpl(holder);
+ TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState), exceptionState);
+ TestPartialInterfaceImplementation3::setPartial3LongAttribute(*impl, cppValue);
+}
+
+static void partial3LongAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
+ TestPartialInterfaceImplementation3PartialV8Internal::partial3LongAttributeAttributeSetter(v8Value, info);
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
+}
+
+static void partial3StaticLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ v8SetReturnValueInt(info, TestPartialInterfaceImplementation3::partial3StaticLongAttribute());
+}
+
+static void partial3StaticLongAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
+ TestPartialInterfaceImplementation3PartialV8Internal::partial3StaticLongAttributeAttributeGetter(info);
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
+}
+
+static void partial3StaticLongAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
+{
+ ExceptionState exceptionState(ExceptionState::SetterContext, "partial3StaticLongAttribute", "TestInterface", holder, info.GetIsolate());
+ TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionState), exceptionState);
+ TestPartialInterfaceImplementation3::setPartial3StaticLongAttribute(cppValue);
+}
+
+static void partial3StaticLongAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
+ TestPartialInterfaceImplementation3PartialV8Internal::partial3StaticLongAttributeAttributeSetter(v8Value, info);
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
+}
+
+static void voidMethodPartialOverload3Method(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ TestPartialInterfaceImplementation3* impl = V8TestInterface::toImpl(info.Holder());
+ V8StringResource<> value;
+ {
+ TOSTRING_VOID_INTERNAL(value, info[0]);
+ }
+ TestPartialInterfaceImplementation3::voidMethodPartialOverload(*impl, value);
+}
+
+static void voidMethodPartialOverloadMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodPartialOverload", "TestInterface", info.Holder(), info.GetIsolate());
+ switch (std::min(1, info.Length())) {
+ case 0:
+ break;
+ case 1:
+ if (true) {
+ voidMethodPartialOverload3Method(info);
+ return;
+ }
+ break;
+ default:
+ exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, info.Length()));
+ exceptionState.throwIfNeeded();
+ return;
+ }
+ exceptionState.throwTypeError("No function was found that matched the signature provided.");
+ exceptionState.throwIfNeeded();
+}
+
+static void staticVoidMethodPartialOverload2Method(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ V8StringResource<> value;
+ {
+ TOSTRING_VOID_INTERNAL(value, info[0]);
+ }
+ TestPartialInterfaceImplementation3::staticVoidMethodPartialOverload(value);
+}
+
+static void staticVoidMethodPartialOverloadMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "staticVoidMethodPartialOverload", "TestInterface", info.Holder(), info.GetIsolate());
+ switch (std::min(1, info.Length())) {
+ case 0:
+ break;
+ case 1:
+ if (true) {
+ staticVoidMethodPartialOverload2Method(info);
+ return;
+ }
+ break;
+ default:
+ exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, info.Length()));
+ exceptionState.throwIfNeeded();
+ return;
+ }
+ exceptionState.throwTypeError("No function was found that matched the signature provided.");
+ exceptionState.throwIfNeeded();
+}
+
+static void partial2VoidMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ TestPartialInterfaceImplementation3* impl = V8TestInterface::toImpl(info.Holder());
+ V8StringResource<> value;
+ {
+ TOSTRING_VOID_INTERNAL(value, info[0]);
+ }
+ TestPartialInterfaceImplementation3::partial2VoidMethod(*impl, value);
+}
+
+static void partial2VoidMethod3Method(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ TestPartialInterfaceImplementation3* impl = V8TestInterface::toImpl(info.Holder());
+ Node* node;
+ {
+ if (info.Length() > 0 && !V8Node::hasInstance(info[0], info.GetIsolate())) {
+ V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute("partial2VoidMethod", "TestInterface", "parameter 1 is not of type 'Node'."), info.GetIsolate());
+ return;
+ }
+ node = V8Node::toImplWithTypeCheck(info.GetIsolate(), info[0]);
+ }
+ TestPartialInterfaceImplementation3::partial2VoidMethod(*impl, node);
+}
+
+static void partial2VoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "partial2VoidMethod", "TestInterface", info.Holder(), info.GetIsolate());
+ switch (std::min(1, info.Length())) {
+ case 0:
+ break;
+ case 1:
+ if (V8Node::hasInstance(info[0], info.GetIsolate())) {
+ partial2VoidMethod3Method(info);
+ return;
+ }
+ if (true) {
+ partial2VoidMethod2Method(info);
+ return;
+ }
+ break;
+ default:
+ exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, info.Length()));
+ exceptionState.throwIfNeeded();
+ return;
+ }
+ exceptionState.throwTypeError("No function was found that matched the signature provided.");
+ exceptionState.throwIfNeeded();
+}
+
+static void partial2StaticVoidMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ V8StringResource<> value;
+ {
+ TOSTRING_VOID_INTERNAL(value, info[0]);
+ }
+ TestPartialInterfaceImplementation3::partial2StaticVoidMethod(value);
+}
+
+static void partial2StaticVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "partial2StaticVoidMethod", "TestInterface", info.Holder(), info.GetIsolate());
+ switch (std::min(1, info.Length())) {
+ case 0:
+ break;
+ case 1:
+ if (true) {
+ partial2StaticVoidMethod2Method(info);
+ return;
+ }
+ break;
+ default:
+ exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, info.Length()));
+ exceptionState.throwIfNeeded();
+ return;
+ }
+ exceptionState.throwTypeError("No function was found that matched the signature provided.");
+ exceptionState.throwIfNeeded();
+}
+
+} // namespace TestPartialInterfaceImplementation3PartialV8Internal
+
+void V8TestInterfacePartial::installV8TestInterfaceTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
+{
+ V8TestInterface::installV8TestInterfaceTemplate(functionTemplate, isolate);
+
+ v8::Local<v8::Signature> defaultSignature;
+ if (!RuntimeEnabledFeatures::featureNameEnabled())
+ defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "", v8::Local<v8::FunctionTemplate>(), V8TestInterface::internalFieldCount, 0, 0, 0, 0, 0, 0, isolate);
+ else
+ defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterface", v8::Local<v8::FunctionTemplate>(), V8TestInterface::internalFieldCount,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ isolate);
+ v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate();
+ ALLOW_UNUSED_LOCAL(instanceTemplate);
+ v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate();
+ ALLOW_UNUSED_LOCAL(prototypeTemplate);
+ static const V8DOMConfiguration::ConstantConfiguration V8TestInterfaceConstants[] = {
+ {"PARTIAL3_UNSIGNED_SHORT", 0, 0, 0, V8DOMConfiguration::ConstantTypeUnsignedShort},
+ };
+ V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8TestInterfaceConstants, WTF_ARRAY_LENGTH(V8TestInterfaceConstants), isolate);
+ functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler(V8TestInterface::legacyCallCustom);
+ functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "partial3StaticLongAttribute"), TestPartialInterfaceImplementation3V8Internal::partial3StaticLongAttributeAttributeGetterCallback, TestPartialInterfaceImplementation3PartialV8Internal::partial3StaticLongAttributeAttributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
+}
+
+void V8TestInterfacePartial::installConditionallyEnabledProperties(v8::Handle<v8::Object> instanceObject, v8::Isolate* isolate)
+{
+ V8TestInterface::installConditionallyEnabledProperties(instanceObject, isolate);
+ v8::Local<v8::Object> prototypeObject = v8::Local<v8::Object>::Cast(instanceObject->GetPrototype());
+ ExecutionContext* context = toExecutionContext(prototypeObject->CreationContext());
+
+ if (context && context->isDocument() && ContextFeatures::partialContextName3Enabled(toDocument(context))) {
+ static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\
+ {"partial3LongAttribute", TestPartialInterfaceImplementation3PartialV8Internal::partial3LongAttributeAttributeGetterCallback, TestPartialInterfaceImplementation3PartialV8Internal::partial3LongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance};
+ V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, attributeConfiguration, isolate);
+ }
+ if (context && context->isDocument() && ContextFeatures::partialContextName3Enabled(toDocument(context))) {
+ static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\
+ {"partial3StaticLongAttribute", TestPartialInterfaceImplementation3PartialV8Internal::partial3StaticLongAttributeAttributeGetterCallback, TestPartialInterfaceImplementation3PartialV8Internal::partial3StaticLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance};
+ V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, attributeConfiguration, isolate);
+ }
+}
+
+void V8TestInterfacePartial::installConditionallyEnabledMethods(v8::Handle<v8::Object> prototypeObject, v8::Isolate* isolate)
+{
+ V8TestInterface::installConditionallyEnabledMethods(prototypeObject, isolate);
+}
+
+bool V8TestInterface::PrivateScript::shortMethodWithShortArgumentImplementedInPrivateScriptMethod(LocalFrame* frame, TestInterface* holderImpl, int value, int* result)
+{
+ if (!frame)
+ return false;
+ v8::HandleScope handleScope(toIsolate(frame));
+ ScriptForbiddenScope::AllowUserAgentScript script;
+ v8::Handle<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrapperWorld::privateScriptIsolatedWorld());
+ if (contextInPrivateScript.IsEmpty())
+ return false;
+ ScriptState* scriptState = ScriptState::from(contextInPrivateScript);
+ ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
+ if (!scriptState->executionContext())
+ return false;
+
+ ScriptState::Scope scope(scriptState);
+ v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Global(), scriptState->isolate());
+
+ v8::Handle<v8::Value> valueHandle = v8::Integer::New(scriptState->isolate(), value);
+ v8::Handle<v8::Value> argv[] = { valueHandle };
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "shortMethodWithShortArgumentImplementedInPrivateScript", "TestPartialInterfaceImplementation3", scriptState->context()->Global(), scriptState->isolate());
+ v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptState, scriptStateInUserScript, "TestPartialInterfaceImplementation3", "shortMethodWithShortArgumentImplementedInPrivateScript", holder, 1, argv);
+ if (v8Value.IsEmpty())
+ return false;
+ TONATIVE_DEFAULT_EXCEPTIONSTATE(int, cppValue, toInt16(v8Value, exceptionState), exceptionState, false);
+ *result = cppValue;
+ RELEASE_ASSERT(!exceptionState.hadException());
+ return true;
+}
+
+void V8TestInterfacePartial::initialize()
+{
+ // Should be invoked from initModules.
+ V8TestInterface::updateWrapperTypeInfo(
+ &V8TestInterfacePartial::installV8TestInterfaceTemplate,
+ &V8TestInterfacePartial::installConditionallyEnabledMethods);
+ V8TestInterface::registerVoidMethodPartialOverloadMethodForPartialInterface(&TestPartialInterfaceImplementation3PartialV8Internal::voidMethodPartialOverloadMethod);
+ V8TestInterface::registerStaticVoidMethodPartialOverloadMethodForPartialInterface(&TestPartialInterfaceImplementation3PartialV8Internal::staticVoidMethodPartialOverloadMethod);
+ V8TestInterface::registerPartial2VoidMethodMethodForPartialInterface(&TestPartialInterfaceImplementation3PartialV8Internal::partial2VoidMethodMethod);
+ V8TestInterface::registerPartial2StaticVoidMethodMethodForPartialInterface(&TestPartialInterfaceImplementation3PartialV8Internal::partial2StaticVoidMethodMethod);
+}
+
+} // namespace blink
+#endif // ENABLE(CONDITION)

Powered by Google App Engine
This is Rietveld 408576698