summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-02-04 18:21:39 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-02-04 18:21:39 (GMT)
commit4f09b0b7823dfe17e2f7d7fafafa7934414f3d88 (patch)
tree39eeba968ff1506136234fb11dfab67dd02ce9b5 /examples
parenta607d90832220132887e9c6bb334974c11f6fa74 (diff)
parentb0c109ff2479dd8f4474b6c5ad537168224a5dc4 (diff)
downloadQt-4f09b0b7823dfe17e2f7d7fafafa7934414f3d88.zip
Qt-4f09b0b7823dfe17e2f7d7fafafa7934414f3d88.tar.gz
Qt-4f09b0b7823dfe17e2f7d7fafafa7934414f3d88.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-air-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-air-staging: Add QScriptClass/ByteArray benchmark Add Context2D QtScript benchmark
Diffstat (limited to 'examples')
-rw-r--r--examples/script/context2d/environment.cpp17
-rw-r--r--examples/script/context2d/environment.h2
2 files changed, 19 insertions, 0 deletions
diff --git a/examples/script/context2d/environment.cpp b/examples/script/context2d/environment.cpp
index 7d6d6f8..e68c1ca 100644
--- a/examples/script/context2d/environment.cpp
+++ b/examples/script/context2d/environment.cpp
@@ -363,6 +363,23 @@ QScriptValue Environment::evaluate(const QString &code, const QString &fileName)
return m_engine->evaluate(code, fileName);
}
+bool Environment::hasIntervalTimers() const
+{
+ return !m_intervalHash.isEmpty();
+}
+
+// This is used by the Context2D QtScript benchmark.
+void Environment::triggerTimers()
+{
+ for (int x = 0; x < 2; ++x) {
+ QList<int> timerIds = x ? m_intervalHash.keys() : m_timeoutHash.keys();
+ for (int i = 0; i < timerIds.size(); ++i) {
+ QTimerEvent fakeEvent(timerIds.at(i));
+ timerEvent(&fakeEvent);
+ }
+ }
+}
+
//! [2]
QScriptValue Environment::toWrapper(QObject *object)
{
diff --git a/examples/script/context2d/environment.h b/examples/script/context2d/environment.h
index dd92e85..221875f 100644
--- a/examples/script/context2d/environment.h
+++ b/examples/script/context2d/environment.h
@@ -78,6 +78,8 @@ public:
//! [0]
QScriptEngine *engine() const;
+ bool hasIntervalTimers() const;
+ void triggerTimers();
//! [1]
public slots: