summaryrefslogtreecommitdiffstats
path: root/examples/script/context2d/environment.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/script/context2d/environment.cpp')
-rw-r--r--examples/script/context2d/environment.cpp17
1 files changed, 17 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)
{