From 20477daf07f2df99b7705ddafca6f8f1222863bf Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 7 Jun 2013 12:47:12 +0200 Subject: [PATCH] Remove unused code from QV8Engine Change-Id: Idb327cc50f0058e67f5c91d6ca35191b9ae64320 Reviewed-by: Lars Knoll --- src/qml/qml/v8/qv8engine.cpp | 38 -------------------------------------- src/qml/qml/v8/qv8engine_p.h | 2 -- 2 files changed, 40 deletions(-) diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp index 469f380..8c1de4c 100644 --- a/src/qml/qml/v8/qv8engine.cpp +++ b/src/qml/qml/v8/qv8engine.cpp @@ -491,44 +491,6 @@ void QV8Engine::setExtensionData(int index, Deletable *data) m_extensionData[index] = data; } - -QV4::WeakValue *QV8Engine::findOwnerAndStrength(QObject *object, bool *shouldBeStrong) -{ - QQmlData *data = QQmlData::get(object); - if (data && data->rootObjectInCreation) { // When the object is still being created it may not show up to the GC. - *shouldBeStrong = true; - return 0; - } - - QObject *parent = object->parent(); - if (!parent) { - // if the object has JS ownership, the object's v8object owns the lifetime of the persistent value. - if (QQmlEngine::objectOwnership(object) == QQmlEngine::JavaScriptOwnership) { - *shouldBeStrong = false; - return &(QQmlData::get(object)->jsWrapper); - } - - // no parent, and has CPP ownership - doesn't have an implicit parent. - *shouldBeStrong = true; - return 0; - } - - // if it is owned by CPP, it's root parent may still be owned by JS. - // in that case, the owner of the persistent handle is the root parent's v8object. - while (parent->parent()) - parent = parent->parent(); - - if (QQmlEngine::objectOwnership(parent) == QQmlEngine::JavaScriptOwnership) { - // root parent is owned by JS. It's v8object owns the persistent value in question. - *shouldBeStrong = false; - return &(QQmlData::get(parent)->jsWrapper); - } else { - // root parent has CPP ownership. The persistent value should not be made weak. - *shouldBeStrong = true; - return 0; - } -} - void QV8Engine::initQmlGlobalObject() { initializeGlobal(QV4::Value::fromObject(m_v4Engine->globalObject)); diff --git a/src/qml/qml/v8/qv8engine_p.h b/src/qml/qml/v8/qv8engine_p.h index dbb88eb..c7508ba 100644 --- a/src/qml/qml/v8/qv8engine_p.h +++ b/src/qml/qml/v8/qv8engine_p.h @@ -331,8 +331,6 @@ private: QVariantMap variantMapFromJS(QV4::Object *object, V8ObjectSet &visitedObjects); QVariant variantFromJS(const QV4::Value &value, V8ObjectSet &visitedObjects); - static QV4::WeakValue *findOwnerAndStrength(QObject *object, bool *shouldBeStrong); - Q_DISABLE_COPY(QV8Engine) }; -- 2.7.4