[epiphany/mcatanzaro/#695: 4/4] history-service: Stop using settings on the history thread



commit ca1efca0a36b154fe38fd532c291c31b5a85eaea
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Mon Mar 4 16:03:50 2019 -0600

    history-service: Stop using settings on the history thread
    
    ephy_settings_get() is not threadsafe, and doesn't need to be
    threadsafe, because we only use it in one place on the history thread,
    and there's no amazing reason to do that when we can instead check the
    setting before sending the zoom level message to the history thread.
    
    Probably fixes #695

 lib/history/ephy-history-service-hosts-table.c | 6 ------
 lib/history/ephy-history-service.c             | 8 +++++++-
 lib/history/ephy-history-service.h             | 2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/lib/history/ephy-history-service-hosts-table.c b/lib/history/ephy-history-service-hosts-table.c
index f9695356a..ab66c90b0 100644
--- a/lib/history/ephy-history-service-hosts-table.c
+++ b/lib/history/ephy-history-service-hosts-table.c
@@ -22,8 +22,6 @@
 
 #include "ephy-history-service.h"
 #include "ephy-history-service-private.h"
-#include "ephy-prefs.h"
-#include "ephy-settings.h"
 #include "ephy-string.h"
 #include <glib/gi18n.h>
 
@@ -112,10 +110,6 @@ ephy_history_service_update_host_row (EphyHistoryService *self, EphyHistoryHost
 
   zoom_level = host->zoom_level;
 
-  /* Ensure that a change value which equals default zoom level is stored as 0.0 */
-  if (zoom_level == g_settings_get_double (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_DEFAULT_ZOOM_LEVEL))
-    zoom_level = 0.0f;
-
   if (ephy_sqlite_statement_bind_string (statement, 0, host->url, &error) == FALSE ||
       ephy_sqlite_statement_bind_string (statement, 1, host->title, &error) == FALSE ||
       ephy_sqlite_statement_bind_int (statement, 2, host->visit_count, &error) == FALSE ||
diff --git a/lib/history/ephy-history-service.c b/lib/history/ephy-history-service.c
index 4e0fad3a4..01c176354 100644
--- a/lib/history/ephy-history-service.c
+++ b/lib/history/ephy-history-service.c
@@ -24,6 +24,8 @@
 #include "ephy-history-service-private.h"
 #include "ephy-history-types.h"
 #include "ephy-lib-type-builtins.h"
+#include "ephy-prefs.h"
+#include "ephy-settings.h"
 #include "ephy-sqlite-connection.h"
 #include "ephy-sync-utils.h"
 
@@ -877,7 +879,7 @@ ephy_history_service_execute_set_url_zoom_level (EphyHistoryService *self,
 void
 ephy_history_service_set_url_zoom_level (EphyHistoryService    *self,
                                          const char            *url,
-                                         const double           zoom_level,
+                                         double                 zoom_level,
                                          GCancellable          *cancellable,
                                          EphyHistoryJobCallback callback,
                                          gpointer               user_data)
@@ -888,6 +890,10 @@ ephy_history_service_set_url_zoom_level (EphyHistoryService    *self,
   g_assert (EPHY_IS_HISTORY_SERVICE (self));
   g_assert (url != NULL);
 
+  /* Ensure that a change value which equals default zoom level is stored as 0.0 */
+  if (zoom_level == g_settings_get_double (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_DEFAULT_ZOOM_LEVEL))
+    zoom_level = 0.0f;
+
   variant = g_variant_new ("(sd)", url, zoom_level);
 
   message = ephy_history_service_message_new (self, SET_URL_ZOOM_LEVEL,
diff --git a/lib/history/ephy-history-service.h b/lib/history/ephy-history-service.h
index b003a2ec4..e536e0f0c 100644
--- a/lib/history/ephy-history-service.h
+++ b/lib/history/ephy-history-service.h
@@ -43,7 +43,7 @@ void                     ephy_history_service_query_visits            (EphyHisto
 void                     ephy_history_service_query_urls              (EphyHistoryService *self, 
EphyHistoryQuery *query, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data);
 void                     ephy_history_service_set_url_title           (EphyHistoryService *self, const char 
*url, const char *title, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data);
 void                     ephy_history_service_set_url_hidden          (EphyHistoryService *self, const char 
*url, gboolean hidden, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data);
-void                     ephy_history_service_set_url_zoom_level      (EphyHistoryService *self, const char 
*url, const double zoom_level, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer 
user_data);
+void                     ephy_history_service_set_url_zoom_level      (EphyHistoryService *self, const char 
*url, double zoom_level, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data);
 void                     ephy_history_service_get_host_for_url        (EphyHistoryService *self, const char 
*url, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data);
 void                     ephy_history_service_get_hosts               (EphyHistoryService *self, 
GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data);
 void                     ephy_history_service_query_hosts             (EphyHistoryService *self, 
EphyHistoryQuery *query, GCancellable *cancellable, EphyHistoryJobCallback callback, gpointer user_data);


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