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

Unified Diff: Source/bindings/tests/results/V8TestInterfacePython2.cpp

Issue 217053007: Revert of Make DOMWrapperWorld::current() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Revert 213543004 too Created 6 years, 9 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/V8TestInterfacePython2.cpp
diff --git a/Source/bindings/tests/results/V8TestInterfaceConstructor3.cpp b/Source/bindings/tests/results/V8TestInterfacePython2.cpp
similarity index 53%
copy from Source/bindings/tests/results/V8TestInterfaceConstructor3.cpp
copy to Source/bindings/tests/results/V8TestInterfacePython2.cpp
index 35c78c463bb6f2bf9478ad0e0f5680e75cf5bf4f..445135011f38a6339a8d2545054a219762f3804b 100644
--- a/Source/bindings/tests/results/V8TestInterfaceConstructor3.cpp
+++ b/Source/bindings/tests/results/V8TestInterfacePython2.cpp
@@ -5,15 +5,19 @@
// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
#include "config.h"
-#include "V8TestInterfaceConstructor3.h"
+#include "V8TestInterfacePython2.h"
#include "RuntimeEnabledFeatures.h"
+#include "V8Interface1.h"
+#include "V8Interface2.h"
#include "bindings/v8/ExceptionState.h"
#include "bindings/v8/V8DOMConfiguration.h"
+#include "bindings/v8/V8GCController.h"
#include "bindings/v8/V8HiddenValue.h"
#include "bindings/v8/V8ObjectConstructor.h"
#include "core/dom/ContextFeatures.h"
#include "core/dom/Document.h"
+#include "core/dom/Element.h"
#include "core/frame/DOMWindow.h"
#include "platform/TraceEvent.h"
#include "wtf/GetPtr.h"
@@ -21,50 +25,56 @@
namespace WebCore {
-static void initializeScriptWrappableForInterface(TestInterfaceConstructor3* object)
+static void initializeScriptWrappableForInterface(TestInterfacePython2* object)
{
if (ScriptWrappable::wrapperCanBeStoredInObject(object))
- ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceConstructor3::wrapperTypeInfo);
+ ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfacePython2::wrapperTypeInfo);
else
ASSERT_NOT_REACHED();
}
} // namespace WebCore
-void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceConstructor3* object)
+void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfacePython2* object)
{
WebCore::initializeScriptWrappableForInterface(object);
}
namespace WebCore {
-const WrapperTypeInfo V8TestInterfaceConstructor3::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceConstructor3::domTemplate, V8TestInterfaceConstructor3::derefObject, 0, 0, 0, V8TestInterfaceConstructor3::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype, false };
+const WrapperTypeInfo V8TestInterfacePython2::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfacePython2::domTemplate, V8TestInterfacePython2::derefObject, 0, 0, V8TestInterfacePython2::visitDOMWrapper, V8TestInterfacePython2::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype, false };
-namespace TestInterfaceConstructor3V8Internal {
+namespace TestInterfacePython2V8Internal {
template <typename T> void V8_USE(T) { }
static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Isolate* isolate = info.GetIsolate();
- if (UNLIKELY(info.Length() < 1)) {
- throwTypeError(ExceptionMessages::failedToConstruct("TestInterfaceConstructor3", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate());
- return;
- }
- V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[0]);
- RefPtr<TestInterfaceConstructor3> impl = TestInterfaceConstructor3::create(stringArg);
+ RefPtr<TestInterfacePython2> impl = TestInterfacePython2::create();
- v8::Handle<v8::Object> wrapper = info.Holder();
- V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor3>(impl.release(), &V8TestInterfaceConstructor3::wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent);
+ v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), isolate);
v8SetReturnValue(info, wrapper);
}
-} // namespace TestInterfaceConstructor3V8Internal
+} // namespace TestInterfacePython2V8Internal
+
+void V8TestInterfacePython2::visitDOMWrapper(void* object, const v8::Persistent<v8::Object>& wrapper, v8::Isolate* isolate)
+{
+ TestInterfacePython2* impl = fromInternalPointer(object);
+ // The ownerNode() method may return a reference or a pointer.
+ if (Node* owner = WTF::getPtr(impl->ownerNode())) {
+ Node* root = V8GCController::opaqueRootForGC(owner, isolate);
+ isolate->SetReferenceFromGroup(v8::UniqueId(reinterpret_cast<intptr_t>(root)), wrapper);
+ return;
+ }
+ setObjectGroup(object, wrapper, isolate);
+}
-void V8TestInterfaceConstructor3::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
+void V8TestInterfacePython2::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor");
if (!info.IsConstructCall()) {
- throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("TestInterfaceConstructor3"), info.GetIsolate());
+ throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("TestInterfacePython2"), info.GetIsolate());
return;
}
@@ -73,21 +83,21 @@ void V8TestInterfaceConstructor3::constructorCallback(const v8::FunctionCallback
return;
}
- TestInterfaceConstructor3V8Internal::constructor(info);
+ TestInterfacePython2V8Internal::constructor(info);
}
-static void configureV8TestInterfaceConstructor3Template(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
+static void configureV8TestInterfacePython2Template(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
{
functionTemplate->ReadOnlyPrototype();
v8::Local<v8::Signature> defaultSignature;
- defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterfaceConstructor3", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceConstructor3::internalFieldCount,
+ defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterfacePython2", v8::Local<v8::FunctionTemplate>(), V8TestInterfacePython2::internalFieldCount,
0, 0,
0, 0,
0, 0,
isolate);
- functionTemplate->SetCallHandler(V8TestInterfaceConstructor3::constructorCallback);
- functionTemplate->SetLength(1);
+ functionTemplate->SetCallHandler(V8TestInterfacePython2::constructorCallback);
+ functionTemplate->SetLength(0);
v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTemplate->InstanceTemplate();
v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTemplate->PrototypeTemplate();
@@ -95,7 +105,7 @@ static void configureV8TestInterfaceConstructor3Template(v8::Handle<v8::Function
functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::current()->toStringTemplate());
}
-v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructor3::domTemplate(v8::Isolate* isolate)
+v8::Handle<v8::FunctionTemplate> V8TestInterfacePython2::domTemplate(v8::Isolate* isolate)
{
V8PerIsolateData* data = V8PerIsolateData::from(isolate);
v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(const_cast<WrapperTypeInfo*>(&wrapperTypeInfo));
@@ -104,30 +114,41 @@ v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructor3::domTemplate(v8::Is
TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidConstructorMode);
- configureV8TestInterfaceConstructor3Template(result, isolate);
+ configureV8TestInterfacePython2Template(result, isolate);
data->setDOMTemplate(const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), result);
return result;
}
-bool V8TestInterfaceConstructor3::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
+bool V8TestInterfacePython2::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
{
return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
}
-v8::Handle<v8::Object> V8TestInterfaceConstructor3::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
+v8::Handle<v8::Object> V8TestInterfacePython2::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
{
return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
}
-TestInterfaceConstructor3* V8TestInterfaceConstructor3::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
+TestInterfacePython2* V8TestInterfacePython2::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
{
return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Object>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0;
}
-v8::Handle<v8::Object> V8TestInterfaceConstructor3::createWrapper(PassRefPtr<TestInterfaceConstructor3> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+v8::Handle<v8::Object> wrap(TestInterfacePython2* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ ASSERT(impl);
+ if (impl->isInterface1())
+ return wrap(toInterface1(impl), creationContext, isolate);
+ if (impl->isInterface2())
+ return wrap(toInterface2(impl), creationContext, isolate);
+ v8::Handle<v8::Object> wrapper = V8TestInterfacePython2::createWrapper(impl, creationContext, isolate);
+ return wrapper;
+}
+
+v8::Handle<v8::Object> V8TestInterfacePython2::createWrapper(PassRefPtr<TestInterfacePython2> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl);
- ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceConstructor3>(impl.get(), isolate));
+ ASSERT(!DOMDataStore::containsWrapper<V8TestInterfacePython2>(impl.get(), isolate));
if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl.get());
// Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapperTypeInfo. These will both have
@@ -140,17 +161,17 @@ v8::Handle<v8::Object> V8TestInterfaceConstructor3::createWrapper(PassRefPtr<Tes
return wrapper;
installPerContextEnabledProperties(wrapper, impl.get(), isolate);
- V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor3>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestInterfacePython2>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent);
return wrapper;
}
-void V8TestInterfaceConstructor3::derefObject(void* object)
+void V8TestInterfacePython2::derefObject(void* object)
{
fromInternalPointer(object)->deref();
}
template<>
-v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor3* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+v8::Handle<v8::Value> toV8NoInline(TestInterfacePython2* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
return toV8(impl, creationContext, isolate);
}
« no previous file with comments | « Source/bindings/tests/results/V8TestInterfacePython2.h ('k') | Source/bindings/tests/results/V8TestInterfacePython3.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698