Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 06cb6cb6 authored by David Edmundson's avatar David Edmundson

[ksmserver] remove unused suspend/resume startup API

Summary:
ksmserver autostart had a system where processes, such as plasma, could
block the startup phase from moving on.

It is currently entirely unused.

It's very difficult to use properly, plasmashell has to block startup
before ksmserver moves on to phase 1. Racey at best.

I did hack it to work, and it does make a surprising positive
improvement to bootup. Worth exploring the idea properly, but implemented
better.

We should be able to get the same results by
blocking and waiting for the DBus name in the autostart desktop file to
become registered rather than having a ksmserver-specific solution.

Test Plan: Compiles, can still login

Reviewers: #plasma, broulik

Reviewed By: #plasma, broulik

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D16042
parent a1eb7a03
......@@ -23,12 +23,6 @@
<method name="saveCurrentSessionAs">
<arg type="s" direction="in"/>
</method>
<method name="suspendStartup">
<arg type="s" direction="in"/>
</method>
<method name="resumeStartup">
<arg type="s" direction="in"/>
</method>
<method name="wmChanged"/>
<method name="saveSubSession">
<arg type="s" direction="in"/>
......
......@@ -633,7 +633,6 @@ KSMServer::KSMServer( const QString& windowManager, InitFlags flags )
selectWm( windowManager );
connect(&startupSuspendTimeoutTimer, &QTimer::timeout, this, &KSMServer::startupSuspendTimeout);
connect(&pendingShutdown, &QTimer::timeout, this, &KSMServer::pendingShutdownTimeout);
only_local = flags.testFlag(InitFlag::OnlyLocal);
......
......@@ -117,9 +117,6 @@ public:
KWorkSpace::ShutdownType sdtype,
KWorkSpace::ShutdownMode sdmode );
virtual void suspendStartup( const QString &app );
virtual void resumeStartup( const QString &app );
void launchWM( const QList< QStringList >& wmStartCommands );
public Q_SLOTS:
......@@ -140,7 +137,6 @@ private Q_SLOTS:
void autoStart1();
void autoStart2();
void tryRestoreNext();
void startupSuspendTimeout();
void wmProcessChange();
void autoStart0Done();
void autoStart1Done();
......@@ -199,9 +195,7 @@ private:
WId windowWmClientLeader(WId w);
QByteArray windowSessionId(WId w, WId leader);
bool checkStartupSuspend();
void finishStartup();
void resumeStartupInternal();
void setupShortcuts();
void runShutdownScripts();
......@@ -249,7 +243,6 @@ private:
bool saveSession;
int wmPhase1WaitingCount;
int saveType;
QMap< QString, int > startupSuspendCount;
KWorkSpace::ShutdownType shutdownType;
KWorkSpace::ShutdownMode shutdownMode;
......@@ -265,7 +258,6 @@ private:
QTimer protectionTimer;
QTimer restoreTimer;
QString xonCommand;
QTimer startupSuspendTimeoutTimer;
bool waitAutoStart2;
bool waitKcmInit2;
QTimer pendingShutdown;
......
......@@ -249,8 +249,6 @@ void KSMServer::autoStart0()
{
if( state != LaunchingWM )
return;
if( !checkStartupSuspend())
return;
state = AutoStart0;
#ifdef KSMSERVER_STARTUP_DEBUG1
qCDebug(KSMSERVER) << t.elapsed();
......@@ -263,8 +261,6 @@ void KSMServer::autoStart0Done()
{
if( state != AutoStart0 )
return;
if( !checkStartupSuspend())
return;
qCDebug(KSMSERVER) << "Autostart 0 done";
#ifdef KSMSERVER_STARTUP_DEBUG1
qCDebug(KSMSERVER) << t.elapsed();
......@@ -325,8 +321,6 @@ void KSMServer::autoStart1Done()
{
if( state != AutoStart1 )
return;
if( !checkStartupSuspend())
return;
qCDebug(KSMSERVER) << "Autostart 1 done";
setupShortcuts(); // done only here, because it needs kglobalaccel :-/
lastAppStarted = 0;
......@@ -353,7 +347,6 @@ void KSMServer::tryRestoreNext()
if( state != Restoring && state != RestoringSubSession )
return;
restoreTimer.stop();
startupSuspendTimeoutTimer.stop();
KConfigGroup config(KSharedConfig::openConfig(), sessionGroup );
while ( lastAppStarted < appsToStart ) {
......@@ -406,8 +399,6 @@ void KSMServer::autoStart2()
{
if( state != Restoring )
return;
if( !checkStartupSuspend())
return;
state = FinishingStartup;
#ifdef KSMSERVER_STARTUP_DEBUG1
qCDebug(KSMSERVER)<< t.elapsed();
......@@ -574,67 +565,6 @@ void KSMServer::finishStartup()
setupXIOErrorHandler(); // From now on handle X errors as normal shutdown.
}
bool KSMServer::checkStartupSuspend()
{
if( startupSuspendCount.isEmpty())
return true;
// wait for the phase to finish
if( !startupSuspendTimeoutTimer.isActive())
{
startupSuspendTimeoutTimer.setSingleShot( true );
startupSuspendTimeoutTimer.start( 10000 );
}
return false;
}
void KSMServer::suspendStartup( const QString &app )
{
if( !startupSuspendCount.contains( app ))
startupSuspendCount[ app ] = 0;
++startupSuspendCount[ app ];
}
void KSMServer::resumeStartup( const QString &app )
{
if( !startupSuspendCount.contains( app ))
return;
if( --startupSuspendCount[ app ] == 0 ) {
startupSuspendCount.remove( app );
if( startupSuspendCount.isEmpty() && startupSuspendTimeoutTimer.isActive()) {
startupSuspendTimeoutTimer.stop();
resumeStartupInternal();
}
}
}
void KSMServer::startupSuspendTimeout()
{
qCDebug(KSMSERVER) << "Startup suspend timeout:" << state;
resumeStartupInternal();
}
void KSMServer::resumeStartupInternal()
{
startupSuspendCount.clear();
switch( state ) {
case LaunchingWM:
autoStart0();
break;
case AutoStart0:
autoStart0Done();
break;
case AutoStart1:
autoStart1Done();
break;
case Restoring:
autoStart2();
break;
default:
qCWarning(KSMSERVER) << "Unknown resume startup state" ;
break;
}
}
void KSMServer::upAndRunning( const QString& msg )
{
QDBusMessage ksplashProgressMessage = QDBusMessage::createMethodCall(QStringLiteral("org.kde.KSplash"),
......
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