[f-spot/mipmapped-loading] Let PhotoLoaderCache use ILoadable as indices.
- From: Ruben Vermeersch <rubenv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [f-spot/mipmapped-loading] Let PhotoLoaderCache use ILoadable as indices.
- Date: Sun, 20 Jun 2010 12:36:47 +0000 (UTC)
commit b51e7df71dcec350da6693d04ca000182f9f71f9
Author: Ruben Vermeersch <ruben savanne be>
Date: Sun Jun 20 14:34:46 2010 +0200
Let PhotoLoaderCache use ILoadable as indices.
src/Loaders/PhotoLoaderCache.cs | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/Loaders/PhotoLoaderCache.cs b/src/Loaders/PhotoLoaderCache.cs
index ab9e5b3..6af2033 100644
--- a/src/Loaders/PhotoLoaderCache.cs
+++ b/src/Loaders/PhotoLoaderCache.cs
@@ -5,24 +5,25 @@ namespace FSpot.Loaders
{
public class PhotoLoaderCache
{
- Dictionary<string, WeakReference> Loaders = new Dictionary<string, WeakReference>();
+ Dictionary<ILoadable, WeakReference> Loaders = new Dictionary<ILoadable, WeakReference>();
public IPhotoLoader RequestLoader (ILoadable photo)
{
- var key = photo.Uri.ToString ();
WeakReference reference = null;
IPhotoLoader loader = null;
- if (Loaders.TryGetValue (key, out reference)) {
+ if (Loaders.TryGetValue (photo, out reference)) {
loader = reference.Target as IPhotoLoader;
}
if (loader == null) {
loader = new XdgThumbnailLoader (photo);
- Loaders[key] = new WeakReference (loader);
+ Loaders[photo] = new WeakReference (loader);
}
return loader;
}
+
+ // FIXME: periodically purge
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]