Revision 66f3bf4...

Go back to digest for 23rd June 2013

Optimization in KDE Base

Frank Reininghaus committed changes in [kde-baseapps] /src/kitemviews:

Simplify handling of preview jobs

This patch changes two things about the way we handle the preview jobs:

(a) Rather than passing a KFileItemList to startPreviewJob(),
remembering the leftovers in the member variable
m_pendingPreviewItems and then starting a new preview job for
these, we append items that need a preview to this member, and let
startPreviewJob() take its input from there. This simplifies the
code greatly.

(b) To prevent that we start preview jobs with just one item and also
that the GUI is frozen too long by startPreviewJob(), we take the
following approach:

* If the mime type of the first pending item is known, the function
has probably been called by startUpdating(), which has determined
mime types for the visible items already. startUpdating() has
also blocked the GUI, so we just take all items at the beginning
of the list with known mime type, and do not do any expensive
mime type determination in startPreviewJob().

* If the mime type of the first pending item is unknown, the
function has probably been called by slotPreviewJobFinished(). In
that case, we can afford to block the GUI for a short while, so
we determine mime types for 200 ms.

REVIEW: 111008

File Changes

Modified 2 files
  • /src/kitemviews
  •   dolphin/kfileitemmodelrolesupdater.cpp
  •   dolphin/kfileitemmodelrolesupdater.h
2 files changed in total