[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    Re: KFileItem, mime types, and icons
From:       David Faure <faure () kde ! org>
Date:       2013-06-12 7:51:29
Message-ID: 5484850.l5i5Wg4Jsh () asterix
[Download RAW message or body]

> Thanks for the hint! The "Poor Man's Profiling" technique was unknown
> to me so far, but it is indeed very simple and effective :-)

Hehe, it's rather intuitive though: "what is that program doing right now?" :)
 
> Program received signal SIGTSTP, Stopped (user).
> 0x00007ffff14e1a17 in access () from /lib64/libc.so.6
> (gdb) bt
> #0  0x00007ffff14e1a17 in access () from /lib64/libc.so.6
> #1  0x00007ffff2bd4d9a in KStandardDirs::exists (fullPath=...) at
> /home/kde-devel/kde/src/KDE/kdelibs/kdecore/kernel/kstandarddirs.cpp:593
> #2  0x00007ffff2be9b22 in KFolderMimeTypePrivate::iconName
> (this=0xeaaf40, _url=...) at
> /home/kde-devel/kde/src/KDE/kdelibs/kdecore/services/kfoldermimetype.cpp:92
> #3  0x00007ffff2bf0b4b in KMimeType::iconName (this=0xd85fa0, url=...)
> at /home/kde-devel/kde/src/KDE/kdelibs/kdecore/services/kmimetype.cpp:605
> #4  0x00007ffff5ef77e6 in KFileItem::iconName (this=0x7fffffffb990) at
> /home/kde-devel/kde/src/KDE/kdelibs/kio/kio/kfileitem.cpp:921
> 
> It seems that it tries to access the directory on disk to see if there
> might be a .desktop file to read an icon name from. 

A .directory file, more precisely.

> This is not quite
> what I would have expected - after all, the point of calling
> KFileItem::iconName() without a previous determineMimeType() was to do
> it fast, without disk access (and that's apparently also what happens
> when calling iconName() for *files*).

Yep.
This is very very close to my recent fix for slow mounts, except that we want 
the same in all cases. So just removing checks for "is it slow" would do.
Can you test this patch?

-- 
David Faure, faure@kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5

["kfileitem_delay_slow_icons.cpp.diff" (kfileitem_delay_slow_icons.cpp.diff)]

diff --git a/kio/kio/kfileitem.cpp b/kio/kio/kfileitem.cpp
index 3d3db6c..bdaf21a 100644
--- a/kio/kio/kfileitem.cpp
+++ b/kio/kio/kfileitem.cpp
@@ -792,7 +792,7 @@ KMimeType::Ptr KFileItem::determineMimeType() const
         d->m_bMimeTypeKnown = true;
     }
 
-    if (isSlow() && d->m_delayedMimeTypes) { // if we delayed getting the iconName \
up till now, this is the right point in time to do so +    if (d->m_delayedMimeTypes) \
{ // if we delayed getting the iconName up till now, this is the right point in time \
to do so  d->m_delayedMimeTypes = false;
         d->m_useIconNameCache = false;
         (void)iconName();
@@ -817,7 +817,7 @@ bool KFileItem::isFinalIconKnown() const
     if (!d) {
         return false;
     }
-    return d->m_bMimeTypeKnown && (!d->m_delayedMimeTypes || !isSlow());
+    return d->m_bMimeTypeKnown && (!d->m_delayedMimeTypes);
 }
 
 QString KFileItem::mimeComment() const
@@ -902,7 +902,7 @@ QString KFileItem::iconName() const
         mime = mimeTypePtr();
     }
 
-    const bool delaySlowOperations = isSlow() && d->m_delayedMimeTypes;
+    const bool delaySlowOperations = d->m_delayedMimeTypes;
 
     if (isLocalUrl && !delaySlowOperations && mime->is("application/x-desktop")) {
         d->m_iconName = iconFromDesktopFile(url.toLocalFile());



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic