[f-spot/mipmapped-loading: 5/13] Let PhotoLoaderCache use ILoadable as indices.
- From: Ruben Vermeersch <rubenv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [f-spot/mipmapped-loading: 5/13] Let PhotoLoaderCache use ILoadable as indices.
- Date: Sat, 3 Jul 2010 09:54:17 +0000 (UTC)
commit 71fb48912345f73a9ebff7b12b0c4b1835d2f798
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]