Remove unused code from QV8Engine
authorSimon Hausmann <simon.hausmann@digia.com>
Fri, 7 Jun 2013 10:47:12 +0000 (12:47 +0200)
committerLars Knoll <lars.knoll@digia.com>
Fri, 7 Jun 2013 16:33:35 +0000 (18:33 +0200)
Change-Id: Idb327cc50f0058e67f5c91d6ca35191b9ae64320
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/qml/qml/v8/qv8engine.cpp
src/qml/qml/v8/qv8engine_p.h

index 469f380..8c1de4c 100644 (file)
@@ -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));
index dbb88eb..c7508ba 100644 (file)
@@ -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)
 };