[KFilePlacesView] Call KDiskFreeSpaceInfo only if neccessary
ClosedPublic

Authored by broulik on Mar 6 2018, 8:39 AM.

Details

Summary

I found this was called 350 times for me when opening the file dialog since for every paint pass it would needlessly call this for every place. It queries all mountpoints and does other expensive work.
Instead, only do so when the bar would actually be shown. Ideally this would be cached somehow but this patch is a nice simple optimization already.

Test Plan
  • Verified it is no longer called when opening file dialog
  • Free space bar still shows up fine when hovering a mounted USB device

Diff Detail

Repository
R241 KIO
Lint
Lint Skipped
Unit
Unit Tests Skipped
broulik created this revision.Mar 6 2018, 8:39 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptMar 6 2018, 8:39 AM
broulik requested review of this revision.Mar 6 2018, 8:39 AM
broulik updated this revision to Diff 28797.Mar 6 2018, 9:06 AM
  • Slightly optimize
broulik updated this revision to Diff 29085.Mar 9 2018, 1:57 PM
  • Bail out if contentsOpacity is zero, just because the device is mounted and visible doesn't mean it shows its capacity bar (only on hover it would)
davidedmundson accepted this revision.Mar 9 2018, 2:49 PM
This revision is now accepted and ready to land.Mar 9 2018, 2:49 PM
This revision was automatically updated to reflect the committed changes.