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



commit a7d18ede51470965cd6af2a94d3787af934a4904
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 9d64ca7..2841776 100644
--- a/lib/ephy-snapshot-service.c
+++ b/lib/ephy-snapshot-service.c
@@ -31,9 +31,6 @@
 
 #define EPHY_SNAPSHOT_SERVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), EPHY_TYPE_SNAPSHOT_SERVICE, 
EphySnapshotServicePrivate))
 
-/* Update snapshots after one week. */
-#define SNAPSHOT_UPDATE_THRESHOLD (60 * 60 * 24 * 7)
-
 struct _EphySnapshotServicePrivate
 {
   GnomeDesktopThumbnailFactory *factory;
@@ -550,7 +547,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));
@@ -562,7 +558,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,
@@ -801,7 +797,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));
@@ -809,7 +804,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->priv->cache, uri);
 
     if (path) {


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