[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-panel-devel
Subject: Re: Review Request 115326: fix theme cache cleanup and discarding
From: "Aaron J. Seigo" <aseigo () kde ! org>
Date: 2014-01-29 16:52:04
Message-ID: 20140129165204.2191.47939 () probe ! kde ! org
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
> On Jan. 29, 2014, 1:50 p.m., Aaron J. Seigo wrote:
> > this patch doesn't actually improve anything. in fact, the actual bug is left:
> >
> > pixmapCache = new KImageCache(pixmapCacheFileName, config.themeCacheKb() * 1024);
> >
> > pixmapCacheFileName should have the version # in it. this was an oversight on my \
> > part when fixing br320855 in 59e88c777b92935cc95f28e52f84fe97563dec9d
> > this patch should not go in as is, but instead have the cache file name ammended \
> > to include the version information.
>
> Harald Sitter wrote:
> the point of this patch is not to fix cache versioning but cache cleaning such that \
> http://i.imgur.com/v0Zyees.png does not happen. further more as mentioned in the \
> description, fixing the cache versioning goes beyond the KImageCache construction \
> but also requires the entire logic to be created for the svgelements cache. to that \
> extent this patch is nothing but a hotfix and a step towards correct cache \
> handling, not a complete fix.
"fixing the cache versioning goes beyond the KImageCache construction but also \
requires the entire logic to be created for the svgelements cache."
right; so what should be happening is that the image cache and the elements cache \
should both be created with the version number in their name. that keeps them in sync \
with each other and with the current contents of the theme.
the cache file is indeed being created w/out the version # in it, which is a \
regression introduced in 59e88c777b92935cc95f28e52f84fe97563dec9d. putting the \
version # back in the cache file name should be sufficient.
then in discardCache the version string used in the image cache filename should also \
be used to initialize svgElementsCache.
probably the easiest way to manage this is to add a member to the Private class for \
the version # string..
> On Jan. 29, 2014, 1:50 p.m., Aaron J. Seigo wrote:
> > plasma/theme.cpp, lines 306-307
> > <https://git.reviewboard.kde.org/r/115326/diff/3/?file=240803#file240803line306>
> >
> > by creating the pixmap cache here, the above calls to discardCache won't really \
> > be doing anything as they act on the pixmapCache .. unless they delete the file \
> > from disk in which it doesn't matter.
> > iow, you've got a very complex way of doing:
> >
> > QFile::remove(pixmapCacheFileName);
> > pixmapCache = new KImageCache(pixmapCacheFileName, config.themeCacheKb() * 1024);
>
> Harald Sitter wrote:
> So, should I be moving it above the age check?
yes, and doing the discardCache call once instead of twice.
> On Jan. 29, 2014, 1:50 p.m., Aaron J. Seigo wrote:
> > plasma/theme.cpp, lines 291-302
> > <https://git.reviewboard.kde.org/r/115326/diff/3/?file=240803#file240803line291>
> >
> > discardCache can take both PixmapCache and SvgElementsCache. in fact, calling it \
> > in this fashion will result in the cache first being invalidated and THEN deleted \
> > from disk.
> > this should not even be necessary, however: if the cache is removed, then the svg \
> > elements also are removed.
>
> Harald Sitter wrote:
> pixmapCache is not delted from disk by discard, because there is no pixmapCache at \
> this point as the if is only entered iff there is no pixmapCache to begin with.
> as for the svg discard, the reason I chose to strip it out of the pixmap age check \
> is because it's more explicit on it's own.
then perhaps sth like this:
CacheType clear = NoCache;
if (...) {
clear |= PixmapCache;
}
if (...) {
clear |= SvgElementsCache;
}
if (clear != NoCache) {
discardCache(clear);
}
> On Jan. 29, 2014, 1:50 p.m., Aaron J. Seigo wrote:
> > plasma/theme.cpp, lines 273-276
> > <https://git.reviewboard.kde.org/r/115326/diff/3/?file=240803#file240803line273>
> >
> > it's nice to clean up the svg elements files; however without an active cache \
> > file it doesn't matter and they are a couple dozen K in size. didn't seem worth \
> > it for cache directory maintenance.
> > leaving them on disk would result them in them being used again if the user \
> > installs a newer version of the theme, then later rolls back to an older version. \
> > however, given that the svg file should be tied to the version of the theme, all \
> > this accomplishes is having to re-calculate all the svg geometry data.
> > i don't see the point in doing this at all.
>
> Harald Sitter wrote:
> well, from a downgrade POV perhaps the kimagecache cleanup also ought not delte all \
> versions but those older than one or two versions down? that is, if downgrading is \
> actually a viable use case of course. otherwise the logic would seem a bit \
> incosistent. yeah, the kcache is sustantially larger, but I doubt any piece of \
> software iterating the cache dir will care much for that reasoning when the dir \
> suddenly contains
> plasma-svgelements-yolo_v1
> plasma-svgelements-yolo_v2
> plasma-svgelements-yolo_v3
> plasma-svgelements-yolo_v4
> plasma-svgelements-yolo_v5
> plasma-svgelements-yolo_v6
> ...
>
>
"from a downgrade POV perhaps the kimagecache cleanup also ought not delte all \
versions but those older than one or two versions down?"
besides requiring a version parser / standard that gets followed, this is overly \
complex. downgrading themes is not common, which is why the caches are removed.
"otherwise the logic would seem a bit incosistent."
i don't see how: it keeps the cache for the current version, drops the rest.
"yeah, the kcache is sustantially larger"
which is a significant issue on devices with smaller disks or many users.
"but I doubt any piece of software iterating the cache dir will care much for that \
reasoning when the dir suddenly contains"
it's not about iterating the dir, but using substantial amounts of disk space for no \
reason.
- Aaron J.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/115326/#review48535
-----------------------------------------------------------
On Jan. 28, 2014, 9:18 a.m., Harald Sitter wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/115326/
> -----------------------------------------------------------
>
> (Updated Jan. 28, 2014, 9:18 a.m.)
>
>
> Review request for Plasma, Aaron J. Seigo and Martin Klapetek.
>
>
> Repository: kdelibs
>
>
> Description
> -------
>
> - introduce svgelements cache handling in useCache()
> - to decide whether or not to discard a cache type now the mtimes of \
> metadata.desktop and the respective cache file are compared (previously this was an \
> invalid file compared to cache change time)
> - cache cleanup now happens entirely before creation of the KImageCache instance to \
> prevent any sort of problem there
> - add fixme comment about broken version-based cache handling. for one the version \
> specific file name is not actually used for the KImageCache and for another the \
> entire shebang is missing from svgelements all together. this has the very \
> unfortunate side effect that the *active* cache files are deleted ever so often, it \
> may be worth removing the code portions until someone finds time/interest to \
> actually implement this in a working fashion.
>
> Diffs
> -----
>
> plasma/theme.cpp cb44878
>
> Diff: https://git.reviewboard.kde.org/r/115326/diff/
>
>
> Testing
> -------
>
> upgraded from 4.8 straight to 4.12 -> theme caches correctly discarded
>
>
> Thanks,
>
> Harald Sitter
>
>
[Attachment #5 (text/html)]
<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;"> <tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://git.reviewboard.kde.org/r/115326/">https://git.reviewboard.kde.org/r/115326/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <p style="margin-top: 0;">On January 29th, 2014, 1:50 p.m. UTC, <b>Aaron J. \
Seigo</b> wrote:</p> <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;"> <pre style="white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">this patch doesn't actually improve anything. in fact, the actual \
bug is left:
pixmapCache = new KImageCache(pixmapCacheFileName, config.themeCacheKb() * 1024);
pixmapCacheFileName should have the version # in it. this was an oversight on my part \
when fixing br320855 in 59e88c777b92935cc95f28e52f84fe97563dec9d
this patch should not go in as is, but instead have the cache file name ammended to \
include the version information.</pre> </blockquote>
<p>On January 29th, 2014, 2:48 p.m. UTC, <b>Harald Sitter</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">the point of this patch \
is not to fix cache versioning but cache cleaning such that \
http://i.imgur.com/v0Zyees.png does not happen. further more as mentioned in the \
description, fixing the cache versioning goes beyond the KImageCache construction but \
also requires the entire logic to be created for the svgelements cache. to that \
extent this patch is nothing but a hotfix and a step towards correct cache handling, \
not a complete fix.</pre> </blockquote>
</blockquote>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">"fixing the cache \
versioning goes beyond the KImageCache construction but also requires the entire \
logic to be created for the svgelements cache."
right; so what should be happening is that the image cache and the elements cache \
should both be created with the version number in their name. that keeps them in sync \
with each other and with the current contents of the theme.
the cache file is indeed being created w/out the version # in it, which is a \
regression introduced in 59e88c777b92935cc95f28e52f84fe97563dec9d. putting the \
version # back in the cache file name should be sufficient.
then in discardCache the version string used in the image cache filename should also \
be used to initialize svgElementsCache.
probably the easiest way to manage this is to add a member to the Private class for \
the version # string..</pre> <br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <p style="margin-top: 0;">On January 29th, 2014, 1:50 p.m. UTC, <b>Aaron J. \
Seigo</b> wrote:</p> <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="https://git.reviewboard.kde.org/r/115326/diff/3/?file=240803#file240803line273" \
style="color: black; font-weight: bold; text-decoration: \
underline;">plasma/theme.cpp</a> <span style="font-weight: normal;">
(Diff revision 3)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">const \
char *ThemePrivate::systemColorsTheme = \
"internal-system-colors";</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">248</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="p">}</span></pre></td> <th bgcolor="#e9eaa8" style="border-left: 1px solid \
#C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">270</font></th> <td bgcolor="#fdfebc" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; "> <span class="c1">// Repeat for SVG \
caches.</span></pre></td> </tr>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">249</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">271</font></th> <td bgcolor="#fdfebc" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> \
<span class="n">foreach</span> <span class="p">(</span><span class="k">const</span> \
<span class="n">QString</span> <span class="o">&</span><span \
class="n">file</span><span class="p">,</span> <span class="n">KGlobal</span><span \
class="o">::</span><span class="n">dirs</span><span class="p">()</span><span \
class="o">-></span><span class="n">findAllResources</span><span \
class="p">(</span><span class="s">"cache"</span><span class="p">,</span> \
<span class="n">svgCacheFileBase</span><span class="p">))</span> <span \
class="p">{</span></pre></td> </tr>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">250</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">ThemeConfig</span> <span class="n">config</span><span \
class="p">;</span></pre></td> <th bgcolor="#e9eaa8" style="border-left: 1px solid \
#C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">272</font></th> <td bgcolor="#fdfebc" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; "> <span class="k">if</span> <span \
class="p">(</span><span class="n">currentSvgCacheFileName</span><span \
class="p">.</span><span class="n">isEmpty</span><span class="p">()</span> <span \
class="o">||</span> <span class="o">!</span><span class="n">file</span><span \
class="p">.</span><span class="n">endsWith</span><span class="p">(</span><span \
class="n">currentSvgCacheFileName</span><span class="p">))</span> <span \
class="p">{</span></pre></td> </tr>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">251</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">pixmapCache</span> <span class="o">=</span> <span class="k">new</span> \
<span class="n">KImageCache</span><span class="p">(</span><span \
class="n">cacheFile</span><span class="p">,</span> <span class="n">config</span><span \
class="p">.</span><span class="n">themeCacheKb</span><span class="p">()</span> <span \
class="o">*</span> <span class="mi">1024</span><span class="p">);</span></pre></td> \
<th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">273</font></th> <td bgcolor="#fdfebc" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> \
<span class="n">QFile</span><span class="o">::</span><span \
class="n">remove</span><span class="p">(</span><span class="n">file</span><span \
class="p">);</span></pre></td> </tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">it's nice to clean \
up the svg elements files; however without an active cache file it doesn't matter \
and they are a couple dozen K in size. didn't seem worth it for cache directory \
maintenance.
leaving them on disk would result them in them being used again if the user installs \
a newer version of the theme, then later rolls back to an older version. however, \
given that the svg file should be tied to the version of the theme, all this \
accomplishes is having to re-calculate all the svg geometry data.
i don't see the point in doing this at all.</pre>
</blockquote>
<p>On January 29th, 2014, 2:48 p.m. UTC, <b>Harald Sitter</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">well, from a downgrade \
POV perhaps the kimagecache cleanup also ought not delte all versions but those older \
than one or two versions down? that is, if downgrading is actually a viable use case \
of course. otherwise the logic would seem a bit incosistent. yeah, the kcache is \
sustantially larger, but I doubt any piece of software iterating the cache dir will \
care much for that reasoning when the dir suddenly contains
plasma-svgelements-yolo_v1
plasma-svgelements-yolo_v2
plasma-svgelements-yolo_v3
plasma-svgelements-yolo_v4
plasma-svgelements-yolo_v5
plasma-svgelements-yolo_v6
...
</pre>
</blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">"from \
a downgrade POV perhaps the kimagecache cleanup also ought not delte all versions but \
those older than one or two versions down?"
besides requiring a version parser / standard that gets followed, this is overly \
complex. downgrading themes is not common, which is why the caches are removed.
"otherwise the logic would seem a bit incosistent."
i don't see how: it keeps the cache for the current version, drops the rest.
"yeah, the kcache is sustantially larger"
which is a significant issue on devices with smaller disks or many users.
"but I doubt any piece of software iterating the cache dir will care much for \
that reasoning when the dir suddenly contains"
it's not about iterating the dir, but using substantial amounts of disk space for \
no reason.</pre> <br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <p style="margin-top: 0;">On January 29th, 2014, 1:50 p.m. UTC, <b>Aaron J. \
Seigo</b> wrote:</p> <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="https://git.reviewboard.kde.org/r/115326/diff/3/?file=240803#file240803line291" \
style="color: black; font-weight: bold; text-decoration: \
underline;">plasma/theme.cpp</a> <span style="font-weight: normal;">
(Diff revision 3)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">const \
char *ThemePrivate::systemColorsTheme = \
"internal-system-colors";</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">286</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> \
<span class="n">KStandardDirs</span><span class="o">::</span><span \
class="n">locate</span><span class="p">(</span><span \
class="s">"cache"</span><span class="p">,</span> <span \
class="n">pixmapCacheFileName</span><span class="p">);</span></pre></td> </tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">287</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> \
<span class="k">const</span> <span class="n">QFileInfo</span> <span \
class="nf">pixmapCacheFileInfo</span><span class="p">(</span><span \
class="n">pixmapCacheFilePath</span><span class="p">);</span></pre></td> </tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">288</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> \
<span class="k">if</span> <span class="p">(</span><span \
class="n">metaDataFileInfo</span><span class="p">.</span><span \
class="n">lastModified</span><span class="p">().</span><span \
class="n">toTime_t</span><span class="p">()</span> <span class="o">></span> <span \
class="n">pixmapCacheFileInfo</span><span class="p">.</span><span \
class="n">lastModified</span><span class="p">().</span><span \
class="n">toTime_t</span><span class="p">())</span> <span \
class="p">{</span></pre></td> </tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">289</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> \
<span class="n">discardCache</span><span class="p">(</span><span \
class="n">PixmapCache</span><span class="p">);</span></pre></td> </tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">290</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> \
<span class="p">}</span></pre></td> </tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">291</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> \
</tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">292</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> \
<span class="k">const</span> <span class="n">QString</span> <span \
class="n">svgCacheFilePath</span> <span class="o">=</span></pre></td> </tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">293</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> \
<span class="n">KStandardDirs</span><span class="o">::</span><span \
class="n">locate</span><span class="p">(</span><span \
class="s">"cache"</span><span class="p">,</span> <span \
class="n">svgCacheFileName</span><span class="p">);</span></pre></td> </tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">294</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> \
<span class="k">const</span> <span class="n">QFileInfo</span> <span \
class="nf">svgCacheFileInfo</span><span class="p">(</span><span \
class="n">svgCacheFilePath</span><span class="p">);</span></pre></td> </tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">295</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> \
<span class="k">if</span> <span class="p">(</span><span \
class="n">metaDataFileInfo</span><span class="p">.</span><span \
class="n">lastModified</span><span class="p">().</span><span \
class="n">toTime_t</span><span class="p">()</span> <span class="o">></span> <span \
class="n">svgCacheFileInfo</span><span class="p">.</span><span \
class="n">lastModified</span><span class="p">().</span><span \
class="n">toTime_t</span><span class="p">())</span> <span \
class="p">{</span></pre></td> </tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">296</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> \
<span class="n">discardCache</span><span class="p">(</span><span \
class="n">SvgElementsCache</span><span class="p">);</span></pre></td> </tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">297</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> \
<span class="p">}</span></pre></td> </tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">discardCache can take \
both PixmapCache and SvgElementsCache. in fact, calling it in this fashion will \
result in the cache first being invalidated and THEN deleted from disk.
this should not even be necessary, however: if the cache is removed, then the svg \
elements also are removed.</pre> </blockquote>
<p>On January 29th, 2014, 2:48 p.m. UTC, <b>Harald Sitter</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">pixmapCache is not \
delted from disk by discard, because there is no pixmapCache at this point as the if \
is only entered iff there is no pixmapCache to begin with.
as for the svg discard, the reason I chose to strip it out of the pixmap age check is \
because it's more explicit on it's own.</pre> </blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">then \
perhaps sth like this:
CacheType clear = NoCache;
if (...) {
clear |= PixmapCache;
}
if (...) {
clear |= SvgElementsCache;
}
if (clear != NoCache) {
discardCache(clear);
}</pre>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <p style="margin-top: 0;">On January 29th, 2014, 1:50 p.m. UTC, <b>Aaron J. \
Seigo</b> wrote:</p> <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="https://git.reviewboard.kde.org/r/115326/diff/3/?file=240803#file240803line306" \
style="color: black; font-weight: bold; text-decoration: \
underline;">plasma/theme.cpp</a> <span style="font-weight: normal;">
(Diff revision 3)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">const \
char *ThemePrivate::systemColorsTheme = \
"internal-system-colors";</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">301</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">ThemeConfig</span> <span class="n">config</span><span \
class="p">;</span></pre></td> </tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">302</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">pixmapCache</span> <span class="o">=</span> <span class="k">new</span> \
<span class="n">KImageCache</span><span class="p">(</span><span \
class="n">pixmapCacheFileName</span><span class="p">,</span> <span \
class="n">config</span><span class="p">.</span><span \
class="n">themeCacheKb</span><span class="p">()</span> <span class="o">*</span> <span \
class="mi">1024</span><span class="p">);</span></pre></td> </tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">by creating the pixmap \
cache here, the above calls to discardCache won't really be doing anything as \
they act on the pixmapCache .. unless they delete the file from disk in which it \
doesn't matter.
iow, you've got a very complex way of doing:
QFile::remove(pixmapCacheFileName);
pixmapCache = new KImageCache(pixmapCacheFileName, config.themeCacheKb() * \
1024);</pre> </blockquote>
<p>On January 29th, 2014, 2:48 p.m. UTC, <b>Harald Sitter</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">So, should I be moving \
it above the age check?</pre> </blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">yes, and \
doing the discardCache call once instead of twice.</pre> <br />
<p>- Aaron J.</p>
<br />
<p>On January 28th, 2014, 9:18 a.m. UTC, Harald Sitter wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('https://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;"> <tr>
<td>
<div>Review request for Plasma, Aaron J. Seigo and Martin Klapetek.</div>
<div>By Harald Sitter.</div>
<p style="color: grey;"><i>Updated Jan. 28, 2014, 9:18 a.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
kdelibs
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">- introduce svgelements cache handling in useCache()
- to decide whether or not to discard a cache type now the mtimes of metadata.desktop \
and the respective cache file are compared (previously this was an invalid file \
compared to cache change time)
- cache cleanup now happens entirely before creation of the KImageCache instance to \
prevent any sort of problem there
- add fixme comment about broken version-based cache handling. for one the version \
specific file name is not actually used for the KImageCache and for another the \
entire shebang is missing from svgelements all together. this has the very \
unfortunate side effect that the *active* cache files are deleted ever so often, it \
may be worth removing the code portions until someone finds time/interest to actually \
implement this in a working fashion.</pre> </td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">upgraded from 4.8 straight to 4.12 -> theme caches correctly \
discarded</pre> </td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>plasma/theme.cpp <span style="color: grey">(cb44878)</span></li>
</ul>
<p><a href="https://git.reviewboard.kde.org/r/115326/diff/" style="margin-left: \
3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>
_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic