Commit f326b143 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[Shell Corona] Don't create ScriptingEngine if there are no update scripts

It takes almost 30ms here to create the engine and then we usually don't end up using
it as all update scripts had already been processed in the past.

Differential Revision: https://phabricator.kde.org/D14751
parent 976bc700
......@@ -948,6 +948,11 @@ void ShellCorona::loadDefaultLayout()
void ShellCorona::processUpdateScripts()
{
const QStringList scripts = WorkspaceScripting::ScriptEngine::pendingUpdateScripts(this);
if (scripts.isEmpty()) {
return;
}
WorkspaceScripting::ScriptEngine scriptEngine(this);
connect(&scriptEngine, &WorkspaceScripting::ScriptEngine::printError, this,
......@@ -958,7 +963,8 @@ void ShellCorona::processUpdateScripts()
[](const QString &msg) {
qDebug() << msg;
});
foreach (const QString &script, WorkspaceScripting::ScriptEngine::pendingUpdateScripts(this)) {
for (const QString &script : scripts) {
QFile file(script);
if (file.open(QIODevice::ReadOnly | QIODevice::Text) ) {
QString code = file.readAll();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment