Merge lp:~mzanetti/unity8/fix-laggy-launcher-dnd into lp:unity8

Proposed by Michael Zanetti
Status: Merged
Approved by: Michael Terry
Approved revision: 1644
Merged at revision: 1678
Proposed branch: lp:~mzanetti/unity8/fix-laggy-launcher-dnd
Merge into: lp:unity8
Diff against target: 97 lines (+23/-4)
5 files modified
plugins/AccountsService/AccountsService.cpp (+1/-1)
plugins/AccountsService/AccountsServiceDBusAdaptor.cpp (+11/-2)
plugins/AccountsService/AccountsServiceDBusAdaptor.h (+2/-0)
plugins/Unity/Launcher/gsettings.cpp (+8/-1)
plugins/Unity/Launcher/gsettings.h (+1/-0)
To merge this branch: bzr merge lp:~mzanetti/unity8/fix-laggy-launcher-dnd
Reviewer Review Type Date Requested Status
Michael Terry Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+251567@code.launchpad.net

Commit message

performance improvements

* Prevent processing of built-in AccountsService properties if we know it's not a built-in that changed
* don't reload the launcher settings after we just set them ourselves

Description of the change

 * Are there any related MPs required for this MP to build/function as expected? Please list.

no

 * Did you perform an exploratory manual test run of your code change and any related functionality?

yes

 * Did you make sure that your branch does not contain spurious tags?

yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?

n/a

 * If you changed the UI, has there been a design review?

n/a

To post a comment you must log in.
1642. By Michael Zanetti

fix typo in comment

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Terry (mterry) wrote :

Inline comments

review: Needs Fixing
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Added my two cents inline

1643. By Michael Zanetti

be more clever with caching

Revision history for this message
Michael Zanetti (mzanetti) wrote :

inline replies

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1644. By Michael Zanetti

always reset the flag

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Terry (mterry) wrote :

Looks great! Tested and it's fine.

 * Did you perform an exploratory manual test run of the code change and any related functionality?
 Yes

 * Did CI run pass? If not, please explain why.
 Eh, for other reasons.

 * Did you make sure that the branch does not contain spurious tags?
 Yes

review: Approve
Revision history for this message
MichaƂ Sawicz (saviq) wrote :

Is there a way to test this? The symptom I was fighting with this morning was starting or closing an unpinned app, this resulted in 1-2s UI lock every time.

Revision history for this message
Michael Zanetti (mzanetti) wrote :

> Is there a way to test this? The symptom I was fighting with this morning was
> starting or closing an unpinned app, this resulted in 1-2s UI lock every time.

So the actual issue is that AccountService does only emit a "Changed" signal for all built-in properties, without having a parameter that actually telly you which built-in property it is. That in turn causes all connected things to look up their properties with sync dbus calls.

This branch at least decouples built-in properties from not built-in ones (the launcher stuff isn't built-in) so a change in the launcher doesn't cause things like "backgroundimage" to refresh at least.

I guess it'd be possible to test if a change in a not built-in property does not emit the generic changed property. Whether that's really a useful test or not, I'm not exactly sure about.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/AccountsService/AccountsService.cpp'
--- plugins/AccountsService/AccountsService.cpp 2014-11-28 15:55:08 +0000
+++ plugins/AccountsService/AccountsService.cpp 2015-03-04 15:58:00 +0000
@@ -152,7 +152,7 @@
152152
153void AccountsService::updateBackgroundFile()153void AccountsService::updateBackgroundFile()
154{154{
155 auto backgroundFile = m_service->getUserProperty(m_user, "org.freedesktop.Accounts.User", "BackgroundFile").toString();155 QString backgroundFile = m_service->getUserProperty(m_user, "org.freedesktop.Accounts.User", "BackgroundFile").toString();
156 if (m_backgroundFile != backgroundFile) {156 if (m_backgroundFile != backgroundFile) {
157 m_backgroundFile = backgroundFile;157 m_backgroundFile = backgroundFile;
158 Q_EMIT backgroundFileChanged();158 Q_EMIT backgroundFileChanged();
159159
=== modified file 'plugins/AccountsService/AccountsServiceDBusAdaptor.cpp'
--- plugins/AccountsService/AccountsServiceDBusAdaptor.cpp 2014-12-12 10:00:31 +0000
+++ plugins/AccountsService/AccountsServiceDBusAdaptor.cpp 2015-03-04 15:58:00 +0000
@@ -25,7 +25,8 @@
25AccountsServiceDBusAdaptor::AccountsServiceDBusAdaptor(QObject* parent)25AccountsServiceDBusAdaptor::AccountsServiceDBusAdaptor(QObject* parent)
26 : QObject(parent),26 : QObject(parent),
27 m_accountsManager(nullptr),27 m_accountsManager(nullptr),
28 m_users()28 m_users(),
29 m_ignoreNextChanged(false)
29{30{
30 QDBusConnection connection = QDBusConnection::SM_BUSNAME();31 QDBusConnection connection = QDBusConnection::SM_BUSNAME();
31 QDBusConnectionInterface *interface = connection.interface();32 QDBusConnectionInterface *interface = connection.interface();
@@ -75,11 +76,19 @@
75 combined.removeDuplicates();76 combined.removeDuplicates();
7677
77 Q_EMIT propertiesChanged(getUserForPath(message().path()), interface, combined);78 Q_EMIT propertiesChanged(getUserForPath(message().path()), interface, combined);
79
80 // In case a non-builtin property changes, we're getting propertiesChanged *and* changed
81 // As the generic changed requires asking back over DBus, it's quite slow to process.
82 // We don't want to trigger that when we know it's not a built-in property change.
83 m_ignoreNextChanged = true;
78}84}
7985
80void AccountsServiceDBusAdaptor::maybeChangedSlot()86void AccountsServiceDBusAdaptor::maybeChangedSlot()
81{87{
82 Q_EMIT maybeChanged(getUserForPath(message().path()));88 if (!m_ignoreNextChanged) {
89 Q_EMIT maybeChanged(getUserForPath(message().path()));
90 }
91 m_ignoreNextChanged = false;
83}92}
8493
85QString AccountsServiceDBusAdaptor::getUserForPath(const QString &path)94QString AccountsServiceDBusAdaptor::getUserForPath(const QString &path)
8695
=== modified file 'plugins/AccountsService/AccountsServiceDBusAdaptor.h'
--- plugins/AccountsService/AccountsServiceDBusAdaptor.h 2015-02-04 09:41:40 +0000
+++ plugins/AccountsService/AccountsServiceDBusAdaptor.h 2015-03-04 15:58:00 +0000
@@ -61,6 +61,8 @@
6161
62 QDBusInterface *m_accountsManager;62 QDBusInterface *m_accountsManager;
63 QMap<QString, QDBusInterface *> m_users;63 QMap<QString, QDBusInterface *> m_users;
64
65 bool m_ignoreNextChanged;
64};66};
6567
66#endif68#endif
6769
=== modified file 'plugins/Unity/Launcher/gsettings.cpp'
--- plugins/Unity/Launcher/gsettings.cpp 2014-10-02 13:34:11 +0000
+++ plugins/Unity/Launcher/gsettings.cpp 2015-03-04 15:58:00 +0000
@@ -59,12 +59,19 @@
59 Q_FOREACH(const QString &entry, storedApplications) {59 Q_FOREACH(const QString &entry, storedApplications) {
60 gSettingsList << QString("appid://%1").arg(entry);60 gSettingsList << QString("appid://%1").arg(entry);
61 }61 }
62 // GSettings will emit a changed signal to ourselves. Let's cache the items
63 // and only forward the changed signal when the list did actually change.
64 m_cachedItems = gSettingsList;
62 m_gSettings->set("items", gSettingsList);65 m_gSettings->set("items", gSettingsList);
63}66}
6467
65void GSettings::onSettingsChanged(const QString &key)68void GSettings::onSettingsChanged(const QString &key)
66{69{
67 if (key == "items") {70 if (key == "items") {
68 Q_EMIT changed();71 QStringList cachedItems = m_gSettings->get("items").toStringList();
72 if (m_cachedItems != cachedItems) {
73 m_cachedItems = cachedItems;
74 Q_EMIT changed();
75 }
69 }76 }
70}77}
7178
=== modified file 'plugins/Unity/Launcher/gsettings.h'
--- plugins/Unity/Launcher/gsettings.h 2014-10-02 13:34:11 +0000
+++ plugins/Unity/Launcher/gsettings.h 2015-03-04 15:58:00 +0000
@@ -41,6 +41,7 @@
4141
42private:42private:
43 QGSettings *m_gSettings;43 QGSettings *m_gSettings;
44 QStringList m_cachedItems;
44};45};
4546
46#endif47#endif

Subscribers

People subscribed via source and target branches