aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/v8/qv8contextwrapper.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2011-11-03 16:52:53 +0000
committerQt by Nokia <qt-info@nokia.com>2011-11-04 16:22:04 +0100
commit3e84e81da776234bf62570b439f1e21848f83c4b (patch)
treef4d435300c7ee5f47b98bb1e85b40a34235eca51 /src/declarative/qml/v8/qv8contextwrapper.cpp
parent986367abdac654cea9c1fe37f9ff4226b7516fa5 (diff)
Optimization: Minimize refreshing when root context changes
Modifying a context requires expressions to be refreshed incase they depend on a name resolution that changes. As it is common to modify the root context, and the root context can't hide any names, it is easy to constrain the expressions that require refreshing. In a well behaving app, this should mean that no expressions are reevaluated when the root context is modified. Change-Id: Id3b48cd595fdd6b5a3dc6f26319f652dccaef79c Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Diffstat (limited to 'src/declarative/qml/v8/qv8contextwrapper.cpp')
-rw-r--r--src/declarative/qml/v8/qv8contextwrapper.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/declarative/qml/v8/qv8contextwrapper.cpp b/src/declarative/qml/v8/qv8contextwrapper.cpp
index 46cf0e4298..20e479b28a 100644
--- a/src/declarative/qml/v8/qv8contextwrapper.cpp
+++ b/src/declarative/qml/v8/qv8contextwrapper.cpp
@@ -258,6 +258,7 @@ v8::Handle<v8::Value> QV8ContextWrapper::Getter(v8::Local<v8::String> property,
// Its possible we could delay the calculation of the "actual" context (in the case
// of sub contexts) until it is definately needed.
QDeclarativeContextData *context = resource->getContext();
+ QDeclarativeContextData *expressionContext = context;
if (!context)
return v8::Undefined();
@@ -362,6 +363,8 @@ v8::Handle<v8::Value> QV8ContextWrapper::Getter(v8::Local<v8::String> property,
context = context->parent;
}
+ expressionContext->unresolvedNames = true;
+
QString error = QLatin1String("Can't find variable: ") + engine->toString(property);
v8::ThrowException(v8::Exception::ReferenceError(engine->toString(error)));
return v8::Undefined();
@@ -394,6 +397,7 @@ v8::Handle<v8::Value> QV8ContextWrapper::Setter(v8::Local<v8::String> property,
// Its possible we could delay the calculation of the "actual" context (in the case
// of sub contexts) until it is definately needed.
QDeclarativeContextData *context = resource->getContext();
+ QDeclarativeContextData *expressionContext = context;
if (!context)
return v8::Undefined();
@@ -436,6 +440,8 @@ v8::Handle<v8::Value> QV8ContextWrapper::Setter(v8::Local<v8::String> property,
context = context->parent;
}
+ expressionContext->unresolvedNames = true;
+
if (!resource->readOnly) {
return v8::Handle<v8::Value>();
} else {