aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-05-29 12:30:34 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2013-05-29 15:00:33 +0200
commit5998ab3d4d111a536eb44e74aa901aa103b0bfc3 (patch)
treed1ea613df5b67a4d02c347593b8c4e48fedcb8dd
parent4658491eb23c99c140e9b261fc708b2d43c9023d (diff)
Remove now unused subcontext functionality
Change-Id: I63b1803397dc79a671bd4cf35fb667ecacb10cab Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r--src/qml/qml/v8/qv8contextwrapper.cpp40
-rw-r--r--src/qml/qml/v8/qv8contextwrapper_p.h3
2 files changed, 2 insertions, 41 deletions
diff --git a/src/qml/qml/v8/qv8contextwrapper.cpp b/src/qml/qml/v8/qv8contextwrapper.cpp
index 643dd79d2e..7cbf7f7dac 100644
--- a/src/qml/qml/v8/qv8contextwrapper.cpp
+++ b/src/qml/qml/v8/qv8contextwrapper.cpp
@@ -65,25 +65,10 @@ public:
inline QQmlContextData *getContext() const;
inline QObject *getScopeObject() const;
- quint32 hasSubContexts:1;
quint32 readOnly:1;
quint32 ownsContext:1;
quint32 dummy:29;
- // This is a pretty horrible hack, and an abuse of external strings. When we create a
- // sub-context (a context created by a Qt.include() in an external javascript file),
- // we pass a specially crafted SubContext external string as the v8::Script::Data() to
- // the script, which contains a pointer to the context. We can then access the
- // v8::Script::Data() later on to resolve names and URLs against the sub-context instead
- // of the main outer context.
- struct SubContext : public v8::String::ExternalStringResource {
- SubContext(QQmlContextData *context) : context(context) {}
- QQmlGuardedContextData context;
-
- virtual const uint16_t* data() const { return (const uint16_t *)internal.constData(); }
- virtual size_t length() const { return internal.length(); }
- };
-
private:
QQmlGuardedContextData context;
QQmlGuard<QObject> scopeObject;
@@ -91,7 +76,7 @@ private:
};
QV8ContextResource::QV8ContextResource(QV8Engine *engine, QQmlContextData *context, QObject *scopeObject, bool ownsContext)
-: QV8ObjectResource(engine), hasSubContexts(false), readOnly(true),
+: QV8ObjectResource(engine), readOnly(true),
ownsContext(ownsContext), dummy(0), context(context), scopeObject(scopeObject)
{
}
@@ -111,19 +96,7 @@ QObject *QV8ContextResource::getScopeObject() const
// Returns the context, including resolving a subcontext
QQmlContextData *QV8ContextResource::getContext() const
{
- if (!hasSubContexts)
- return context;
-
- v8::Handle<v8::Value> callingdata = v8::Context::GetCallingScriptData();
- if (callingdata.IsEmpty() || !callingdata->IsString())
- return context;
-
- v8::Handle<v8::String> callingstring = callingdata->ToString();
- Q_ASSERT(callingstring->IsExternal());
- Q_ASSERT(callingstring->GetExternalStringResource());
-
- SubContext *sc = static_cast<SubContext *>(callingstring->GetExternalStringResource());
- return sc->context;
+ return context;
}
QV8ContextWrapper::QV8ContextWrapper()
@@ -186,15 +159,6 @@ void QV8ContextWrapper::setReadOnly(v8::Handle<v8::Object> qmlglobal, bool readO
resource->readOnly = readOnly;
}
-//void QV8ContextWrapper::addSubContext(v8::Handle<v8::Object> qmlglobal, v8::Handle<v8::Script> script,
-// QQmlContextData *ctxt)
-//{
-// QV8ContextResource *resource = v8_resource_cast<QV8ContextResource>(qmlglobal);
-// Q_ASSERT(resource);
-// resource->hasSubContexts = true;
-// script->SetData(v8::String::NewExternal(new QV8ContextResource::SubContext(ctxt)));
-//}
-
QQmlContextData *QV8ContextWrapper::callingContext()
{
QV4::Object *qmlglobal = QV8Engine::getV4(m_engine)->qmlContextObject();
diff --git a/src/qml/qml/v8/qv8contextwrapper_p.h b/src/qml/qml/v8/qv8contextwrapper_p.h
index 783cc4242c..cd75cc66e5 100644
--- a/src/qml/qml/v8/qv8contextwrapper_p.h
+++ b/src/qml/qml/v8/qv8contextwrapper_p.h
@@ -79,9 +79,6 @@ public:
void setReadOnly(v8::Handle<v8::Object>, bool);
-// void addSubContext(v8::Handle<v8::Object> qmlglobal, v8::Handle<v8::Script>,
-// QQmlContextData *ctxt);
-
QQmlContextData *callingContext();
QQmlContextData *context(v8::Handle<v8::Value>);