Commit 82b4b70f authored by Eike Hein's avatar Eike Hein Committed by Nate Graham
Browse files

[libtaskmanager] Remove a poorly conceived optimization

The LauncherTasksModel tried to avoid a model reset by making certain
assumptions to save a few cycles. Ultimately this was misguided, in-
correctly not evicting the internal app data cache as well as causing
a lot more work in the view trying to compute layout deltas and some-
times causing a few frames of ugly animations.

There likely _is_ some optimization potential here, but it needs to
be done smarter later on.

(cherry picked from commit 40d7df21)
parent 21dce8da
...@@ -475,31 +475,14 @@ void LauncherTasksModel::setLauncherList(const QStringList &serializedLaunchers) ...@@ -475,31 +475,14 @@ void LauncherTasksModel::setLauncherList(const QStringList &serializedLaunchers)
if (newLaunchersOrder != d->launchersOrder if (newLaunchersOrder != d->launchersOrder
|| newActivitiesForLauncher != d->activitiesForLauncher) { || newActivitiesForLauncher != d->activitiesForLauncher) {
// Common case optimization: If the list changed but its size beginResetModel();
// did not (e.g. due to reordering by a user of this model),
// just clear the caches and announce new data instead of
// resetting.
if (newLaunchersOrder.count() == d->launchersOrder.count()) {
std::swap(newLaunchersOrder, d->launchersOrder); std::swap(newLaunchersOrder, d->launchersOrder);
std::swap(newActivitiesForLauncher, d->activitiesForLauncher); std::swap(newActivitiesForLauncher, d->activitiesForLauncher);
emit dataChanged( d->appDataCache.clear();
index(0, 0),
index(d->launchersOrder.count() - 1, 0));
} else { endResetModel();
std::swap(newLaunchersOrder, d->launchersOrder);
std::swap(newActivitiesForLauncher, d->activitiesForLauncher);
emit launcherListChanged(); emit launcherListChanged();
} }
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