[epiphany/gnome-3-20] Revert "snapshot-service: Update snapshots after one week"



commit b6625e51de8a3a2ce00fe88b01339be1044505fb
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Tue Mar 29 20:12:09 2016 -0500

    Revert "snapshot-service: Update snapshots after one week"
    
    This reverts commit 80ba0ff169d472888389589b143407d56898ea62.
    
    This code has been broken since it was introduced. There are two cases
    where we use the snapshot service:
    
     * From EphyAboutHandler. Here we pass the a time taken from
       EphyHistoryService for the mtime. This check does not seem useful in
       this case, because it is only a query: it can never result in a new
       snapshot being taken to replace the old snapshot.
    
     * From EphyWebView itself, when a new page is loaded (or, until
       recently, when a favicon was acquired for that page). This is the
       only case in which a new snapshot can ever be taken (or updated). In
       this case, we pass the current time for mtime, then the comparison
       current_time - mtime <= SNAPSHOT_UPDATE_THRESHOLD is the same as
       if (0 <= SNAPSHOT_UPDATE_THRESHOLD), and so the snapshots always pass
       the check and are never expired.
    
    Ideally we would reimplement this properly, since one week seems like a
    good amount of time for which to persist snapshots. But this is far from
    straightforward to do. For now, let's just remove this code, causing
    snapshots to be updated at most once per browsing session.
    
    This mitigates the bug where, until recently, we would take snapshots of
    completely white web views, before the pages had rendered; even though
    we no longer take white snapshots, broken snapshots that were taken
    previously currently persist forever until ~/.cache/thumbnails is
    cleared somehow (e.g. by gnome-settings-daemon's housekeeping plugin).
    Now they will be cleared much sooner.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=763184

 lib/ephy-snapshot-service.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)
---
diff --git a/lib/ephy-snapshot-service.c b/lib/ephy-snapshot-service.c
index dd2103b..61ef261 100644
--- a/lib/ephy-snapshot-service.c
+++ b/lib/ephy-snapshot-service.c
@@ -27,9 +27,6 @@
 #include <libgnome-desktop/gnome-desktop-thumbnail.h>
 #include <webkit2/webkit2.h>
 
-/* Update snapshots after one week. */
-#define SNAPSHOT_UPDATE_THRESHOLD (60 * 60 * 24 * 7)
-
 struct _EphySnapshotService {
   GObject parent_instance;
   GnomeDesktopThumbnailFactory *factory;
@@ -544,7 +541,6 @@ ephy_snapshot_service_get_snapshot_async (EphySnapshotService *service,
 {
   GTask *task;
   const char *uri;
-  time_t current_time = time (NULL);
 
   g_return_if_fail (EPHY_IS_SNAPSHOT_SERVICE (service));
   g_return_if_fail (WEBKIT_IS_WEB_VIEW (web_view));
@@ -556,7 +552,7 @@ ephy_snapshot_service_get_snapshot_async (EphySnapshotService *service,
 
   /* Try to get the snapshot from the cache first if we have a URL */
   uri = webkit_web_view_get_uri (web_view);
-  if (uri && current_time - mtime <= SNAPSHOT_UPDATE_THRESHOLD)
+  if (uri)
     ephy_snapshot_service_get_snapshot_for_url_async (service,
                                                       uri, mtime, cancellable,
                                                       (GAsyncReadyCallback)got_snapshot_for_url,
@@ -795,7 +791,6 @@ ephy_snapshot_service_get_snapshot_path_async (EphySnapshotService *service,
 {
   GTask *task;
   const char *uri;
-  time_t current_time = time (NULL);
 
   g_return_if_fail (EPHY_IS_SNAPSHOT_SERVICE (service));
   g_return_if_fail (WEBKIT_IS_WEB_VIEW (web_view));
@@ -803,7 +798,7 @@ ephy_snapshot_service_get_snapshot_path_async (EphySnapshotService *service,
   task = g_task_new (service, cancellable, callback, user_data);
 
   uri = webkit_web_view_get_uri (web_view);
-  if (uri && current_time - mtime <= SNAPSHOT_UPDATE_THRESHOLD) {
+  if (uri) {
     const char *path = g_hash_table_lookup (service->cache, uri);
 
     if (path) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]