diff options
-rw-r--r-- | ChangeLog | 57 | ||||
-rw-r--r-- | embed/ephy-encodings.c | 1 | ||||
-rw-r--r-- | embed/ephy-favicon-cache.c | 18 | ||||
-rw-r--r-- | embed/ephy-history.c | 33 | ||||
-rw-r--r-- | lib/Makefile.am | 2 | ||||
-rw-r--r-- | lib/ephy-node-db.c | 27 | ||||
-rw-r--r-- | lib/ephy-node-filter.c | 2 | ||||
-rw-r--r-- | lib/ephy-node.c | 247 | ||||
-rw-r--r-- | lib/ephy-node.h | 4 | ||||
-rw-r--r-- | lib/ephy-state.c | 1 | ||||
-rw-r--r-- | lib/ephy-thread-helpers.c | 35 | ||||
-rw-r--r-- | lib/ephy-thread-helpers.h | 34 | ||||
-rw-r--r-- | lib/widgets/ephy-search-entry.c | 4 | ||||
-rw-r--r-- | lib/widgets/ephy-tree-model-node.c | 2 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks-editor.c | 4 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks-export.c | 3 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks-menu.c | 3 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks.c | 6 | ||||
-rw-r--r-- | src/bookmarks/ephy-topic-action.c | 3 | ||||
-rw-r--r-- | src/bookmarks/ephy-topics-selector.c | 1 | ||||
-rw-r--r-- | src/ephy-favorites-menu.c | 1 | ||||
-rw-r--r-- | src/ephy-history-window.c | 4 | ||||
-rw-r--r-- | src/ephy-location-action.c | 1 | ||||
-rw-r--r-- | src/ephy-main.c | 2 |
24 files changed, 57 insertions, 438 deletions
@@ -1,3 +1,60 @@ +2003-12-16 Marco Pesenti Gritti <marco@gnome.org> + + * embed/ephy-encodings.c: (ephy_encodings_get_encodings): + * embed/ephy-favicon-cache.c: (icons_added_cb), (icons_removed_cb), + (remove_obsolete_icons), (ephy_favicon_cache_init), + (kill_download), (ephy_favicon_cache_finalize), + (ephy_favicon_cache_get): + * embed/ephy-history.c: (remove_obsolete_pages), (hosts_added_cb), + (hosts_removed_cb), (pages_added_cb), (pages_removed_cb), + (update_host_on_child_remove), (update_hosts), (ephy_history_init), + (ephy_history_finalize), (ephy_history_get_host), + (ephy_history_get_page): + * lib/Makefile.am: + * lib/ephy-node-db.c: (ephy_node_db_init), (ephy_node_db_finalize), + (ephy_node_db_get_node_from_id), (_ephy_node_db_new_id), + (_ephy_node_db_add_id), (_ephy_node_db_remove_id), + (ephy_node_db_write_to_xml_valist): + * lib/ephy-node-filter.c: (ephy_node_filter_expression_evaluate): + * lib/ephy-node.c: (ephy_node_finalize), (real_remove_child), + (remove_child), (ephy_node_dispose), (ephy_node_new_with_id), + (ephy_node_get_id), (ephy_node_ref), (ephy_node_unref), + (child_changed), (ephy_node_set_property), + (ephy_node_get_property), (ephy_node_get_property_string), + (ephy_node_get_property_boolean), (ephy_node_get_property_long), + (ephy_node_get_property_int), (ephy_node_get_property_double), + (ephy_node_get_property_float), (ephy_node_get_property_node), + (write_parent), (ephy_node_write_to_xml), (ephy_node_add_child), + (ephy_node_remove_child), (ephy_node_has_child), + (ephy_node_sort_children), (ephy_node_reorder_children), + (ephy_node_get_children), (ephy_node_get_n_children), + (ephy_node_get_nth_child), (ephy_node_get_child_index), + (ephy_node_get_next_child), (ephy_node_get_previous_child): + * lib/ephy-node.h: + * lib/ephy-state.c: (find_by_name): + * lib/ephy-thread-helpers.c: + * lib/ephy-thread-helpers.h: + * lib/widgets/ephy-search-entry.c: (ephy_search_entry_timeout_cb): + * lib/widgets/ephy-tree-model-node.c: (filter_changed_cb): + * src/bookmarks/ephy-bookmarks-editor.c: (search_entry_search_cb): + * src/bookmarks/ephy-bookmarks-export.c: (write_topics_list), + (ephy_bookmarks_export_rdf): + * src/bookmarks/ephy-bookmarks-menu.c: (add_bookmarks_menu), + (ephy_bookmarks_menu_rebuild): + * src/bookmarks/ephy-bookmarks.c: (compute_lower_fav), + (get_topics_list), (topics_removed_cb), + (ephy_bookmarks_find_bookmark), (ephy_bookmarks_find_keyword): + * src/bookmarks/ephy-topic-action.c: (append_bookmarks_menu), + (build_topics_menu): + * src/bookmarks/ephy-topics-selector.c: (fill_model): + * src/ephy-favorites-menu.c: (ephy_favorites_menu_rebuild): + * src/ephy-history-window.c: (setup_filters): + * src/ephy-location-action.c: (init_actions_list): + * src/ephy-main.c: (main): + + No need to make our life hard being thread safe when we + never use that code in a thread. + 2003-12-15 Christian Persch <chpe@cvs.gnome.org> * src/Makefile.am: diff --git a/embed/ephy-encodings.c b/embed/ephy-encodings.c index 8373ae52c..c50ba19c2 100644 --- a/embed/ephy-encodings.c +++ b/embed/ephy-encodings.c @@ -259,7 +259,6 @@ ephy_encodings_get_encodings (EphyEncodings *encodings, list = g_list_prepend (list, kid); } } - ephy_node_thaw (encodings->priv->encodings); return list; } diff --git a/embed/ephy-favicon-cache.c b/embed/ephy-favicon-cache.c index 4da3ab2e8..3421e1ce5 100644 --- a/embed/ephy-favicon-cache.c +++ b/embed/ephy-favicon-cache.c @@ -50,7 +50,6 @@ struct EphyFaviconCachePrivate EphyNodeDb *db; EphyNode *icons; GHashTable *icons_hash; - GStaticRWLock *icons_hash_lock; GHashTable *downloads_hash; }; @@ -142,13 +141,9 @@ icons_added_cb (EphyNode *node, EphyNode *child, EphyFaviconCache *eb) { - g_static_rw_lock_writer_lock (eb->priv->icons_hash_lock); - g_hash_table_insert (eb->priv->icons_hash, (char *) ephy_node_get_property_string (child, EPHY_NODE_FAVICON_PROP_URL), child); - - g_static_rw_lock_writer_unlock (eb->priv->icons_hash_lock); } static void @@ -156,12 +151,8 @@ icons_removed_cb (EphyNode *node, EphyNode *child, EphyFaviconCache *eb) { - g_static_rw_lock_writer_lock (eb->priv->icons_hash_lock); - g_hash_table_remove (eb->priv->icons_hash, ephy_node_get_property_string (child, EPHY_NODE_FAVICON_PROP_URL)); - - g_static_rw_lock_writer_unlock (eb->priv->icons_hash_lock); } static void @@ -177,7 +168,6 @@ remove_obsolete_icons (EphyFaviconCache *eb) g_date_set_time (¤t_date, time (NULL)); children = ephy_node_get_children (eb->priv->icons); - ephy_node_thaw (eb->priv->icons); for (i = 0; i < children->len; i++) { EphyNode *kid; @@ -227,8 +217,6 @@ ephy_favicon_cache_init (EphyFaviconCache *cache) cache->priv->icons_hash = g_hash_table_new (g_str_hash, g_str_equal); - cache->priv->icons_hash_lock = g_new0 (GStaticRWLock, 1); - g_static_rw_lock_init (cache->priv->icons_hash_lock); cache->priv->downloads_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, @@ -263,9 +251,7 @@ kill_download (gpointer key, ephy_embed_persist_cancel (persist); g_object_unref (persist); - g_static_rw_lock_reader_lock (cache->priv->icons_hash_lock); icon = g_hash_table_lookup (cache->priv->icons_hash, (char *)key); - g_static_rw_lock_reader_unlock (cache->priv->icons_hash_lock); ephy_node_unref (icon); @@ -300,8 +286,6 @@ ephy_favicon_cache_finalize (GObject *object) g_free (cache->priv->xml_file); g_free (cache->priv->directory); g_hash_table_destroy (cache->priv->icons_hash); - g_static_rw_lock_free (cache->priv->icons_hash_lock); - g_free (cache->priv->icons_hash_lock); g_hash_table_destroy (cache->priv->downloads_hash); g_object_unref (cache->priv->db); @@ -390,9 +374,7 @@ ephy_favicon_cache_get (EphyFaviconCache *cache, now = time (NULL); - g_static_rw_lock_reader_lock (cache->priv->icons_hash_lock); icon = g_hash_table_lookup (cache->priv->icons_hash, url); - g_static_rw_lock_reader_unlock (cache->priv->icons_hash_lock); if (!icon) { diff --git a/embed/ephy-history.c b/embed/ephy-history.c index 666e6b4e6..8aae3eaf0 100644 --- a/embed/ephy-history.c +++ b/embed/ephy-history.c @@ -52,9 +52,7 @@ struct EphyHistoryPrivate EphyNode *pages; EphyNode *last_page; GHashTable *hosts_hash; - GStaticRWLock *hosts_hash_lock; GHashTable *pages_hash; - GStaticRWLock *pages_hash_lock; int autosave_timeout; guint update_hosts_idle; gboolean dirty; @@ -160,7 +158,6 @@ remove_obsolete_pages (EphyHistory *eb) g_date_set_time (¤t_date, time (NULL)); children = ephy_node_get_children (eb->priv->pages); - ephy_node_thaw (eb->priv->pages); for (i = 0; i < children->len; i++) { EphyNode *kid; @@ -211,13 +208,9 @@ hosts_added_cb (EphyNode *node, { eb->priv->dirty = TRUE; - g_static_rw_lock_writer_lock (eb->priv->hosts_hash_lock); - g_hash_table_insert (eb->priv->hosts_hash, (char *) ephy_node_get_property_string (child, EPHY_NODE_PAGE_PROP_LOCATION), child); - - g_static_rw_lock_writer_unlock (eb->priv->hosts_hash_lock); } static void @@ -228,12 +221,8 @@ hosts_removed_cb (EphyNode *node, { eb->priv->dirty = TRUE; - g_static_rw_lock_writer_lock (eb->priv->hosts_hash_lock); - g_hash_table_remove (eb->priv->hosts_hash, ephy_node_get_property_string (child, EPHY_NODE_PAGE_PROP_LOCATION)); - - g_static_rw_lock_writer_unlock (eb->priv->hosts_hash_lock); } static void @@ -251,13 +240,9 @@ pages_added_cb (EphyNode *node, { eb->priv->dirty = TRUE; - g_static_rw_lock_writer_lock (eb->priv->pages_hash_lock); - g_hash_table_insert (eb->priv->pages_hash, (char *) ephy_node_get_property_string (child, EPHY_NODE_PAGE_PROP_LOCATION), child); - - g_static_rw_lock_writer_unlock (eb->priv->pages_hash_lock); } static void @@ -268,12 +253,8 @@ pages_removed_cb (EphyNode *node, { eb->priv->dirty = TRUE; - g_static_rw_lock_writer_lock (eb->priv->pages_hash_lock); - g_hash_table_remove (eb->priv->pages_hash, ephy_node_get_property_string (child, EPHY_NODE_PAGE_PROP_LOCATION)); - - g_static_rw_lock_writer_unlock (eb->priv->pages_hash_lock); } static void @@ -318,7 +299,6 @@ update_host_on_child_remove (EphyNode *node) new_host_last_visit = last_visit; } } - ephy_node_thaw (node); if (host_last_visit != new_host_last_visit) { @@ -358,7 +338,6 @@ update_hosts (EphyHistory *eh) } } } - ephy_node_thaw (eh->priv->hosts); g_list_foreach (empty, (GFunc)ephy_node_unref, NULL); g_list_free (empty); @@ -412,13 +391,8 @@ ephy_history_init (EphyHistory *eb) eb->priv->pages_hash = g_hash_table_new (g_str_hash, g_str_equal); - eb->priv->pages_hash_lock = g_new0 (GStaticRWLock, 1); - g_static_rw_lock_init (eb->priv->pages_hash_lock); - eb->priv->hosts_hash = g_hash_table_new (g_str_hash, g_str_equal); - eb->priv->hosts_hash_lock = g_new0 (GStaticRWLock, 1); - g_static_rw_lock_init (eb->priv->hosts_hash_lock); /* Pages */ eb->priv->pages = ephy_node_new_with_id (db, PAGES_NODE_ID); @@ -505,9 +479,7 @@ ephy_history_finalize (GObject *object) g_object_unref (eb->priv->db); g_hash_table_destroy (eb->priv->pages_hash); - g_static_rw_lock_free (eb->priv->pages_hash_lock); g_hash_table_destroy (eb->priv->hosts_hash); - g_static_rw_lock_free (eb->priv->hosts_hash_lock); g_source_remove (eb->priv->autosave_timeout); @@ -626,15 +598,12 @@ ephy_history_get_host (EphyHistory *eh, const char *url) g_return_val_if_fail (host_locations != NULL, NULL); - g_static_rw_lock_reader_lock (eh->priv->hosts_hash_lock); - for (l = host_locations; l != NULL; l = l->next) { host = g_hash_table_lookup (eh->priv->hosts_hash, (char *)l->data); if (host) break; } - g_static_rw_lock_reader_unlock (eh->priv->hosts_hash_lock); if (!host) { @@ -792,9 +761,7 @@ ephy_history_get_page (EphyHistory *eb, { EphyNode *node; - g_static_rw_lock_reader_lock (eb->priv->pages_hash_lock); node = g_hash_table_lookup (eb->priv->pages_hash, url); - g_static_rw_lock_reader_unlock (eb->priv->pages_hash_lock); return node; } diff --git a/lib/Makefile.am b/lib/Makefile.am index 10e1fa519..8e6ec93b2 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -32,7 +32,6 @@ NOINST_H_FILES = \ ephy-state.h \ ephy-string.h \ ephy-stock-icons.h \ - ephy-thread-helpers.h \ ephy-zoom.h INST_H_FILES = \ @@ -63,7 +62,6 @@ libephymisc_la_SOURCES = \ ephy-state.c \ ephy-string.c \ ephy-stock-icons.c \ - ephy-thread-helpers.c \ ephy-zoom.c \ $(INST_H_FILES) \ $(NOINST_H_FILES) diff --git a/lib/ephy-node-db.c b/lib/ephy-node-db.c index 10276eaba..8c569485a 100644 --- a/lib/ephy-node-db.c +++ b/lib/ephy-node-db.c @@ -49,10 +49,8 @@ struct EphyNodeDbPrivate { char *name; - GMutex *id_factory_lock; long id_factory; - GStaticRWLock *id_to_node_lock; GPtrArray *id_to_node; }; @@ -168,12 +166,8 @@ ephy_node_db_init (EphyNodeDb *db) /* id to node */ db->priv->id_to_node = g_ptr_array_new (); - db->priv->id_to_node_lock = g_new0 (GStaticRWLock, 1); - g_static_rw_lock_init (db->priv->id_to_node_lock); - /* id factory */ db->priv->id_factory = RESERVED_IDS; - db->priv->id_factory_lock = g_mutex_new (); } static void @@ -189,10 +183,6 @@ ephy_node_db_finalize (GObject *object) g_ptr_array_free (db->priv->id_to_node, FALSE); - g_static_rw_lock_free (db->priv->id_to_node_lock); - - g_mutex_free (db->priv->id_factory_lock); - g_free (db->priv->name); G_OBJECT_CLASS (parent_class)->finalize (object); @@ -244,12 +234,8 @@ ephy_node_db_get_node_from_id (EphyNodeDb *db, long id) { EphyNode *ret = NULL; - g_static_rw_lock_reader_lock (db->priv->id_to_node_lock); - ret = node_from_id_real (db, id); - g_static_rw_lock_reader_unlock (db->priv->id_to_node_lock); - return ret; } @@ -258,8 +244,6 @@ _ephy_node_db_new_id (EphyNodeDb *db) { long ret; - g_mutex_lock (db->priv->id_factory_lock); - while (node_from_id_real (db, db->priv->id_factory) != NULL) { db->priv->id_factory++; @@ -267,8 +251,6 @@ _ephy_node_db_new_id (EphyNodeDb *db) ret = db->priv->id_factory; - g_mutex_unlock (db->priv->id_factory_lock); - return ret; } @@ -277,29 +259,21 @@ _ephy_node_db_add_id (EphyNodeDb *db, long id, EphyNode *node) { - g_static_rw_lock_writer_lock (db->priv->id_to_node_lock); - /* resize array if needed */ if (id >= db->priv->id_to_node->len) g_ptr_array_set_size (db->priv->id_to_node, id + 1); g_ptr_array_index (db->priv->id_to_node, id) = node; - - g_static_rw_lock_writer_unlock (db->priv->id_to_node_lock); } void _ephy_node_db_remove_id (EphyNodeDb *db, long id) { - g_static_rw_lock_writer_lock (db->priv->id_to_node_lock); - g_ptr_array_index (db->priv->id_to_node, id) = NULL; /* reset id factory so we use the freed node id */ db->priv->id_factory = RESERVED_IDS; - - g_static_rw_lock_writer_unlock (db->priv->id_to_node_lock); } gboolean @@ -446,7 +420,6 @@ ephy_node_db_write_to_xml_valist (EphyNodeDb *db, if (ret < 0) break; } } - ephy_node_thaw (node); if (ret < 0) break; g_slist_free (exceptions); diff --git a/lib/ephy-node-filter.c b/lib/ephy-node-filter.c index 8af8d71a2..1625c6ecb 100644 --- a/lib/ephy-node-filter.c +++ b/lib/ephy-node-filter.c @@ -356,12 +356,10 @@ ephy_node_filter_expression_evaluate (EphyNodeFilterExpression *exp, if (prop == exp->args.prop_args.second_arg.node) { - ephy_node_thaw (node); return TRUE; } } - ephy_node_thaw (node); return FALSE; } case EPHY_NODE_FILTER_EXPRESSION_STRING_PROP_CONTAINS: diff --git a/lib/ephy-node.c b/lib/ephy-node.c index 35cbe6936..6194cb60f 100644 --- a/lib/ephy-node.c +++ b/lib/ephy-node.c @@ -34,7 +34,6 @@ #include "ephy-node.h" #include "ephy-string.h" -#include "ephy-thread-helpers.h" typedef struct { @@ -53,8 +52,6 @@ typedef struct struct EphyNode { - GStaticRWLock *lock; - int ref_count; gulong id; @@ -76,41 +73,6 @@ typedef struct va_list valist; } ENESCData; -/* evillish hacks to temporarily readlock->writelock and v.v. */ -static inline void -write_lock_to_read_lock (EphyNode *node) -{ - g_static_mutex_lock (&node->lock->mutex); - node->lock->read_counter++; - g_static_mutex_unlock (&node->lock->mutex); - - g_static_rw_lock_writer_unlock (node->lock); -} - -static inline void -read_lock_to_write_lock (EphyNode *node) -{ - g_static_mutex_lock (&node->lock->mutex); - node->lock->read_counter--; - g_static_mutex_unlock (&node->lock->mutex); - - g_static_rw_lock_writer_lock (node->lock); -} - -static inline void -lock_gdk (void) -{ - if (ephy_thread_helpers_in_main_thread () == FALSE) - GDK_THREADS_ENTER (); -} - -static inline void -unlock_gdk (void) -{ - if (ephy_thread_helpers_in_main_thread () == FALSE) - GDK_THREADS_LEAVE (); -} - static gboolean int_equal (gconstpointer a, gconstpointer b) @@ -208,9 +170,6 @@ ephy_node_finalize (EphyNode *node) g_ptr_array_free (node->children, TRUE); - g_static_rw_lock_free (node->lock); - g_free (node->lock); - g_free (node); } @@ -241,22 +200,13 @@ real_remove_child (EphyNode *node, borked_node = g_ptr_array_index (node->children, i); - g_static_rw_lock_writer_lock (borked_node->lock); borked_node_info = g_hash_table_lookup (borked_node->parents, GINT_TO_POINTER (node->id)); borked_node_info->index--; - - g_static_rw_lock_writer_unlock (borked_node->lock); } - write_lock_to_read_lock (node); - write_lock_to_read_lock (child); - ephy_node_emit_signal (node, EPHY_NODE_CHILD_REMOVED, child, old_index); - - read_lock_to_write_lock (node); - read_lock_to_write_lock (child); } if (remove_from_child) { @@ -270,11 +220,7 @@ remove_child (long id, EphyNodeParent *node_info, EphyNode *node) { - g_static_rw_lock_writer_lock (node_info->node->lock); - real_remove_child (node_info->node, node, TRUE, FALSE); - - g_static_rw_lock_writer_unlock (node_info->node->lock); } static void @@ -302,14 +248,8 @@ ephy_node_dispose (EphyNode *node) { guint i; - write_lock_to_read_lock (node); - ephy_node_emit_signal (node, EPHY_NODE_DESTROY); - read_lock_to_write_lock (node); - - lock_gdk (); - /* remove from DAG */ g_hash_table_foreach (node->parents, (GHFunc) remove_child, @@ -320,22 +260,14 @@ ephy_node_dispose (EphyNode *node) child = g_ptr_array_index (node->children, i); - g_static_rw_lock_writer_lock (child->lock); - real_remove_child (node, child, FALSE, TRUE); - - g_static_rw_lock_writer_unlock (child->lock); } - g_static_rw_lock_writer_unlock (node->lock); - g_hash_table_foreach (node->signals, (GHFunc) unref_signal_objects, node); _ephy_node_db_remove_id (node->db, node->id); - - unlock_gdk (); } EphyNode * @@ -359,9 +291,6 @@ ephy_node_new_with_id (EphyNodeDb *db, gulong reserved_id) node = g_new0 (EphyNode, 1); - node->lock = g_new0 (GStaticRWLock, 1); - g_static_rw_lock_init (node->lock); - node->ref_count = 0; node->id = reserved_id; @@ -403,12 +332,8 @@ ephy_node_get_id (EphyNode *node) g_return_val_if_fail (EPHY_IS_NODE (node), -1); - g_static_rw_lock_reader_lock (node->lock); - ret = node->id; - g_static_rw_lock_reader_unlock (node->lock); - return ret; } @@ -417,11 +342,7 @@ ephy_node_ref (EphyNode *node) { g_return_if_fail (EPHY_IS_NODE (node)); - g_static_rw_lock_writer_lock (node->lock); - node->ref_count++; - - g_static_rw_lock_writer_unlock (node->lock); } void @@ -429,44 +350,20 @@ ephy_node_unref (EphyNode *node) { g_return_if_fail (EPHY_IS_NODE (node)); - g_static_rw_lock_writer_lock (node->lock); - node->ref_count--; if (node->ref_count <= 0) { ephy_node_dispose (node); ephy_node_finalize (node); - } else { - g_static_rw_lock_writer_unlock (node->lock); } } -void -ephy_node_freeze (EphyNode *node) -{ - g_return_if_fail (EPHY_IS_NODE (node)); - - g_static_rw_lock_reader_lock (node->lock); -} - -void -ephy_node_thaw (EphyNode *node) -{ - g_return_if_fail (EPHY_IS_NODE (node)); - - g_static_rw_lock_reader_unlock (node->lock); -} - static void child_changed (gulong id, EphyNodeParent *node_info, EphyNode *node) { - g_static_rw_lock_reader_lock (node_info->node->lock); - ephy_node_emit_signal (node_info->node, EPHY_NODE_CHILD_CHANGED, node); - - g_static_rw_lock_reader_unlock (node_info->node->lock); } static inline void @@ -500,25 +397,15 @@ ephy_node_set_property (EphyNode *node, g_return_if_fail (property_id >= 0); g_return_if_fail (value != NULL); - lock_gdk (); - - g_static_rw_lock_writer_lock (node->lock); - new = g_new0 (GValue, 1); g_value_init (new, G_VALUE_TYPE (value)); g_value_copy (value, new); real_set_property (node, property_id, new); - write_lock_to_read_lock (node); - g_hash_table_foreach (node->parents, (GHFunc) child_changed, node); - - g_static_rw_lock_reader_unlock (node->lock); - - unlock_gdk (); } gboolean @@ -532,24 +419,18 @@ ephy_node_get_property (EphyNode *node, g_return_val_if_fail (property_id >= 0, FALSE); g_return_val_if_fail (value != NULL, FALSE); - g_static_rw_lock_reader_lock (node->lock); - if (property_id >= node->properties->len) { - g_static_rw_lock_reader_unlock (node->lock); return FALSE; } ret = g_ptr_array_index (node->properties, property_id); if (ret == NULL) { - g_static_rw_lock_reader_unlock (node->lock); return FALSE; } g_value_init (value, G_VALUE_TYPE (ret)); g_value_copy (ret, value); - g_static_rw_lock_reader_unlock (node->lock); - return TRUE; } @@ -563,23 +444,17 @@ ephy_node_get_property_string (EphyNode *node, g_return_val_if_fail (EPHY_IS_NODE (node), NULL); g_return_val_if_fail (property_id >= 0, NULL); - g_static_rw_lock_reader_lock (node->lock); - if (property_id >= node->properties->len) { - g_static_rw_lock_reader_unlock (node->lock); return NULL; } ret = g_ptr_array_index (node->properties, property_id); if (ret == NULL) { - g_static_rw_lock_reader_unlock (node->lock); return NULL; } retval = g_value_get_string (ret); - g_static_rw_lock_reader_unlock (node->lock); - return retval; } @@ -593,23 +468,17 @@ ephy_node_get_property_boolean (EphyNode *node, g_return_val_if_fail (EPHY_IS_NODE (node), FALSE); g_return_val_if_fail (property_id >= 0, FALSE); - g_static_rw_lock_reader_lock (node->lock); - if (property_id >= node->properties->len) { - g_static_rw_lock_reader_unlock (node->lock); return FALSE; } ret = g_ptr_array_index (node->properties, property_id); if (ret == NULL) { - g_static_rw_lock_reader_unlock (node->lock); return FALSE; } retval = g_value_get_boolean (ret); - g_static_rw_lock_reader_unlock (node->lock); - return retval; } @@ -623,23 +492,17 @@ ephy_node_get_property_long (EphyNode *node, g_return_val_if_fail (EPHY_IS_NODE (node), -1); g_return_val_if_fail (property_id >= 0, -1); - g_static_rw_lock_reader_lock (node->lock); - if (property_id >= node->properties->len) { - g_static_rw_lock_reader_unlock (node->lock); return -1; } ret = g_ptr_array_index (node->properties, property_id); if (ret == NULL) { - g_static_rw_lock_reader_unlock (node->lock); return -1; } retval = g_value_get_long (ret); - g_static_rw_lock_reader_unlock (node->lock); - return retval; } @@ -653,23 +516,17 @@ ephy_node_get_property_int (EphyNode *node, g_return_val_if_fail (EPHY_IS_NODE (node), -1); g_return_val_if_fail (property_id >= 0, -1); - g_static_rw_lock_reader_lock (node->lock); - if (property_id >= node->properties->len) { - g_static_rw_lock_reader_unlock (node->lock); return -1; } ret = g_ptr_array_index (node->properties, property_id); if (ret == NULL) { - g_static_rw_lock_reader_unlock (node->lock); return -1; } retval = g_value_get_int (ret); - g_static_rw_lock_reader_unlock (node->lock); - return retval; } @@ -683,23 +540,17 @@ ephy_node_get_property_double (EphyNode *node, g_return_val_if_fail (EPHY_IS_NODE (node), -1); g_return_val_if_fail (property_id >= 0, -1); - g_static_rw_lock_reader_lock (node->lock); - if (property_id >= node->properties->len) { - g_static_rw_lock_reader_unlock (node->lock); return -1; } ret = g_ptr_array_index (node->properties, property_id); if (ret == NULL) { - g_static_rw_lock_reader_unlock (node->lock); return -1; } retval = g_value_get_double (ret); - g_static_rw_lock_reader_unlock (node->lock); - return retval; } @@ -713,23 +564,17 @@ ephy_node_get_property_float (EphyNode *node, g_return_val_if_fail (EPHY_IS_NODE (node), -1); g_return_val_if_fail (property_id >= 0, -1); - g_static_rw_lock_reader_lock (node->lock); - if (property_id >= node->properties->len) { - g_static_rw_lock_reader_unlock (node->lock); return -1; } ret = g_ptr_array_index (node->properties, property_id); if (ret == NULL) { - g_static_rw_lock_reader_unlock (node->lock); return -1; } retval = g_value_get_float (ret); - g_static_rw_lock_reader_unlock (node->lock); - return retval; } @@ -743,23 +588,17 @@ ephy_node_get_property_node (EphyNode *node, g_return_val_if_fail (EPHY_IS_NODE (node), NULL); g_return_val_if_fail (property_id >= 0, NULL); - g_static_rw_lock_reader_lock (node->lock); - if (property_id >= node->properties->len) { - g_static_rw_lock_reader_unlock (node->lock); return NULL; } ret = g_ptr_array_index (node->properties, property_id); if (ret == NULL) { - g_static_rw_lock_reader_unlock (node->lock); return NULL; } retval = g_value_get_pointer (ret); - g_static_rw_lock_reader_unlock (node->lock); - return retval; } @@ -784,10 +623,8 @@ write_parent (gulong id, data->ret = xmlTextWriterStartElement (writer, "parent"); if (data->ret < 0) return; - g_static_rw_lock_reader_lock (node_info->node->lock); data->ret = xmlTextWriterWriteFormatAttribute (writer, "id", "%ld", node_info->node->id); - g_static_rw_lock_reader_unlock (node_info->node->lock); if (data->ret < 0) return; data->ret = xmlTextWriterEndElement (writer); /* parent */ @@ -806,8 +643,6 @@ ephy_node_write_to_xml(EphyNode *node, g_return_val_if_fail (EPHY_IS_NODE (node), -1); g_return_val_if_fail (writer != NULL, -1); - g_static_rw_lock_reader_lock (node->lock); - /* start writing the node */ ret = xmlTextWriterStartElement (writer, "node"); if (ret < 0) goto out; @@ -888,8 +723,6 @@ ephy_node_write_to_xml(EphyNode *node, if (ret < 0) goto out; out: - g_static_rw_lock_reader_unlock (node->lock); - return ret >= 0 ? 0 : -1; } @@ -915,9 +748,6 @@ real_add_child (EphyNode *node, node_info); } -/* this function assumes it's safe to not lock anything while loading, - * this is at least true for the case where we're loading the library xml file - * from the main loop */ EphyNode * ephy_node_new_from_xml (EphyNodeDb *db, xmlNodePtr xml_node) { @@ -1021,43 +851,20 @@ void ephy_node_add_child (EphyNode *node, EphyNode *child) { - lock_gdk (); - g_return_if_fail (EPHY_IS_NODE (node)); - g_static_rw_lock_writer_lock (node->lock); - g_static_rw_lock_writer_lock (child->lock); - real_add_child (node, child); - write_lock_to_read_lock (node); - write_lock_to_read_lock (child); - ephy_node_emit_signal (node, EPHY_NODE_CHILD_ADDED, child); - - g_static_rw_lock_reader_unlock (node->lock); - g_static_rw_lock_reader_unlock (child->lock); - - unlock_gdk (); } void ephy_node_remove_child (EphyNode *node, EphyNode *child) { - lock_gdk (); - g_return_if_fail (EPHY_IS_NODE (node)); - g_static_rw_lock_writer_lock (node->lock); - g_static_rw_lock_writer_lock (child->lock); - real_remove_child (node, child, TRUE, TRUE); - - g_static_rw_lock_writer_unlock (node->lock); - g_static_rw_lock_writer_unlock (child->lock); - - unlock_gdk (); } gboolean @@ -1068,15 +875,9 @@ ephy_node_has_child (EphyNode *node, g_return_val_if_fail (EPHY_IS_NODE (node), FALSE); - g_static_rw_lock_reader_lock (node->lock); - g_static_rw_lock_reader_lock (child->lock); - ret = (g_hash_table_lookup (child->parents, GINT_TO_POINTER (node->id)) != NULL); - g_static_rw_lock_reader_unlock (node->lock); - g_static_rw_lock_reader_unlock (child->lock); - return ret; } @@ -1108,10 +909,6 @@ ephy_node_sort_children (EphyNode *node, g_return_if_fail (EPHY_IS_NODE (node)); g_return_if_fail (compare_func != NULL); - lock_gdk (); - - g_static_rw_lock_writer_lock (node->lock); - newkids = g_ptr_array_new (); g_ptr_array_set_size (newkids, node->children->len); @@ -1141,15 +938,9 @@ ephy_node_sort_children (EphyNode *node, g_ptr_array_free (node->children, FALSE); node->children = newkids; - write_lock_to_read_lock (node); - ephy_node_emit_signal (node, EPHY_NODE_CHILDREN_REORDERED, new_order); g_free (new_order); - - g_static_rw_lock_reader_unlock (node->lock); - - unlock_gdk (); } void @@ -1162,10 +953,6 @@ ephy_node_reorder_children (EphyNode *node, g_return_if_fail (EPHY_IS_NODE (node)); g_return_if_fail (new_order != NULL); - lock_gdk (); - - g_static_rw_lock_writer_lock (node->lock); - newkids = g_ptr_array_new (); g_ptr_array_set_size (newkids, node->children->len); @@ -1185,13 +972,7 @@ ephy_node_reorder_children (EphyNode *node, g_ptr_array_free (node->children, FALSE); node->children = newkids; - write_lock_to_read_lock (node); - ephy_node_emit_signal (node, EPHY_NODE_CHILDREN_REORDERED, new_order); - - g_static_rw_lock_reader_unlock (node->lock); - - unlock_gdk (); } GPtrArray * @@ -1199,8 +980,6 @@ ephy_node_get_children (EphyNode *node) { g_return_val_if_fail (EPHY_IS_NODE (node), NULL); - g_static_rw_lock_reader_lock (node->lock); - return node->children; } @@ -1211,12 +990,8 @@ ephy_node_get_n_children (EphyNode *node) g_return_val_if_fail (EPHY_IS_NODE (node), -1); - g_static_rw_lock_reader_lock (node->lock); - ret = node->children->len; - g_static_rw_lock_reader_unlock (node->lock); - return ret; } @@ -1229,16 +1004,12 @@ ephy_node_get_nth_child (EphyNode *node, g_return_val_if_fail (EPHY_IS_NODE (node), NULL); g_return_val_if_fail (n >= 0, NULL); - g_static_rw_lock_reader_lock (node->lock); - if (n < node->children->len) { ret = g_ptr_array_index (node->children, n); } else { ret = NULL; } - g_static_rw_lock_reader_unlock (node->lock); - return ret; } @@ -1267,14 +1038,8 @@ ephy_node_get_child_index (EphyNode *node, g_return_val_if_fail (EPHY_IS_NODE (node), -1); g_return_val_if_fail (EPHY_IS_NODE (child), -1); - g_static_rw_lock_reader_lock (node->lock); - g_static_rw_lock_reader_lock (child->lock); - ret = ephy_node_real_get_child_index (node, child); - g_static_rw_lock_reader_unlock (node->lock); - g_static_rw_lock_reader_unlock (child->lock); - return ret; } @@ -1288,9 +1053,6 @@ ephy_node_get_next_child (EphyNode *node, g_return_val_if_fail (EPHY_IS_NODE (node), NULL); g_return_val_if_fail (EPHY_IS_NODE (child), NULL); - g_static_rw_lock_reader_lock (node->lock); - g_static_rw_lock_reader_lock (child->lock); - idx = get_child_index_real (node, child); if ((idx + 1) < node->children->len) { @@ -1299,9 +1061,6 @@ ephy_node_get_next_child (EphyNode *node, ret = NULL; } - g_static_rw_lock_reader_unlock (node->lock); - g_static_rw_lock_reader_unlock (child->lock); - return ret; } @@ -1315,9 +1074,6 @@ ephy_node_get_previous_child (EphyNode *node, g_return_val_if_fail (EPHY_IS_NODE (node), NULL); g_return_val_if_fail (EPHY_IS_NODE (child), NULL); - g_static_rw_lock_reader_lock (node->lock); - g_static_rw_lock_reader_lock (child->lock); - idx = get_child_index_real (node, child); if ((idx - 1) >= 0) { @@ -1326,9 +1082,6 @@ ephy_node_get_previous_child (EphyNode *node, ret = NULL; } - g_static_rw_lock_reader_unlock (node->lock); - g_static_rw_lock_reader_unlock (child->lock); - return ret; } diff --git a/lib/ephy-node.h b/lib/ephy-node.h index 50c5ab1bc..0e664bed4 100644 --- a/lib/ephy-node.h +++ b/lib/ephy-node.h @@ -62,10 +62,6 @@ long ephy_node_get_id (EphyNode *node); void ephy_node_ref (EphyNode *node); void ephy_node_unref (EphyNode *node); -/* locking */ -void ephy_node_freeze (EphyNode *node); -void ephy_node_thaw (EphyNode *node); - /* signals */ int ephy_node_signal_connect_object (EphyNode *node, EphyNodeSignalType type, diff --git a/lib/ephy-state.c b/lib/ephy-state.c index f106ed565..476b6ab4d 100644 --- a/lib/ephy-state.c +++ b/lib/ephy-state.c @@ -91,7 +91,6 @@ find_by_name (const char *name) result = kid; } } - ephy_node_thaw (states); return result; } diff --git a/lib/ephy-thread-helpers.c b/lib/ephy-thread-helpers.c deleted file mode 100644 index 720358968..000000000 --- a/lib/ephy-thread-helpers.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2002 Jorn Baayen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - */ - -#include "ephy-thread-helpers.h" - -static GThread *main_thread = NULL; - -void -ephy_thread_helpers_init (void) -{ - main_thread = g_thread_self (); -} - -gboolean -ephy_thread_helpers_in_main_thread (void) -{ - return (main_thread == g_thread_self ()); -} diff --git a/lib/ephy-thread-helpers.h b/lib/ephy-thread-helpers.h deleted file mode 100644 index 2b23156a3..000000000 --- a/lib/ephy-thread-helpers.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2002 Jorn Baayen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - */ - -#include <glib/gthread.h> - -#ifndef EPHY_THREAD_HELPERS_H -#define EPHY_THREAD_HELPERS_H - -G_BEGIN_DECLS - -void ephy_thread_helpers_init (void); - -gboolean ephy_thread_helpers_in_main_thread (void); - -G_END_DECLS - -#endif /* EPHY_THREAD_HELPERS_H */ diff --git a/lib/widgets/ephy-search-entry.c b/lib/widgets/ephy-search-entry.c index e6fa93a92..afa3d68ca 100644 --- a/lib/widgets/ephy-search-entry.c +++ b/lib/widgets/ephy-search-entry.c @@ -100,14 +100,10 @@ ephy_search_entry_class_init (EphySearchEntryClass *klass) static gboolean ephy_search_entry_timeout_cb (EphySearchEntry *entry) { - gdk_threads_enter (); - g_signal_emit (G_OBJECT (entry), ephy_search_entry_signals[SEARCH], 0, gtk_entry_get_text (GTK_ENTRY (entry))); entry->priv->timeout = 0; - gdk_threads_leave (); - return FALSE; } diff --git a/lib/widgets/ephy-tree-model-node.c b/lib/widgets/ephy-tree-model-node.c index e8b8b45b8..1af1dd869 100644 --- a/lib/widgets/ephy-tree-model-node.c +++ b/lib/widgets/ephy-tree-model-node.c @@ -216,8 +216,6 @@ filter_changed_cb (EphyNodeFilter *filter, g_ptr_array_index (kids, i), i); } - - ephy_node_thaw (model->priv->root); } static void diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c index 088af8a70..f2bd52b6e 100644 --- a/src/bookmarks/ephy-bookmarks-editor.c +++ b/src/bookmarks/ephy-bookmarks-editor.c @@ -1186,8 +1186,6 @@ search_entry_search_cb (GtkWidget *entry, const char *search_text, EphyBookmarks search_text = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1); - GDK_THREADS_ENTER (); - ephy_node_filter_empty (editor->priv->bookmarks_filter); ephy_node_filter_add_expression (editor->priv->bookmarks_filter, ephy_node_filter_expression_new (EPHY_NODE_FILTER_EXPRESSION_STRING_PROP_CONTAINS, @@ -1200,8 +1198,6 @@ search_entry_search_cb (GtkWidget *entry, const char *search_text, EphyBookmarks search_text), 0); ephy_node_filter_done_changing (editor->priv->bookmarks_filter); - - GDK_THREADS_LEAVE (); } static GtkWidget * diff --git a/src/bookmarks/ephy-bookmarks-export.c b/src/bookmarks/ephy-bookmarks-export.c index 1043f19c0..42bc28783 100644 --- a/src/bookmarks/ephy-bookmarks-export.c +++ b/src/bookmarks/ephy-bookmarks-export.c @@ -56,7 +56,6 @@ write_topics_list (EphyNode *topics, keywords = g_list_prepend (keywords, kid); } } - ephy_node_thaw (topics); for (l = keywords; l != NULL; l = l->next) { @@ -186,7 +185,6 @@ ephy_bookmarks_export_rdf (EphyBookmarks *bookmarks, ret = xmlTextWriterEndElement (writer); /* rdf:li */ if (ret < 0) break; } - ephy_node_thaw (bmks); if (ret < 0) goto out; ret = xmlTextWriterEndElement (writer); /* rdf:Seq */ @@ -262,7 +260,6 @@ ephy_bookmarks_export_rdf (EphyBookmarks *bookmarks, g_free (link); } - ephy_node_thaw (bmks); if (ret < 0) goto out; ret = xmlTextWriterEndElement (writer); /* rdf:RDF */ diff --git a/src/bookmarks/ephy-bookmarks-menu.c b/src/bookmarks/ephy-bookmarks-menu.c index 7548dfce9..b1b546ae6 100644 --- a/src/bookmarks/ephy-bookmarks-menu.c +++ b/src/bookmarks/ephy-bookmarks-menu.c @@ -225,8 +225,6 @@ add_bookmarks_menu (EphyBookmarksMenu *menu, EphyNode *node, const char *path) } g_list_free (node_list); } - - ephy_node_thaw (node); } static void @@ -269,7 +267,6 @@ ephy_bookmarks_menu_rebuild (EphyBookmarksMenu *menu) node_list = g_list_prepend (node_list, kid); } } - ephy_node_thaw (topics); node_list = g_list_sort (node_list, (GCompareFunc)sort_topics); diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c index 3ae0d41e4..c569ec2ca 100644 --- a/src/bookmarks/ephy-bookmarks.c +++ b/src/bookmarks/ephy-bookmarks.c @@ -335,7 +335,6 @@ compute_lower_fav (EphyNode *favorites, double *score) result = child; } } - ephy_node_thaw (favorites); if (result == NULL) *score = 0; @@ -449,7 +448,6 @@ get_topics_list (EphyBookmarks *eb, *no_topics = FALSE; } } - ephy_node_thaw (eb->priv->keywords); return g_string_free (list, FALSE); } @@ -497,7 +495,6 @@ topics_removed_cb (EphyNode *node, g_free (list); } - ephy_node_thaw (child); g_signal_emit (G_OBJECT (eb), ephy_bookmarks_signals[TREE_CHANGED], 0); } @@ -753,11 +750,9 @@ ephy_bookmarks_find_bookmark (EphyBookmarks *eb, if (location != NULL && strcmp (url, location) == 0) { - ephy_node_thaw (eb->priv->bookmarks); return kid; } } - ephy_node_thaw (eb->priv->bookmarks); return NULL; } @@ -1054,7 +1049,6 @@ ephy_bookmarks_find_keyword (EphyBookmarks *eb, node = kid; } } - ephy_node_thaw (eb->priv->keywords); return node; } diff --git a/src/bookmarks/ephy-topic-action.c b/src/bookmarks/ephy-topic-action.c index 2bdc167fc..1861418ff 100644 --- a/src/bookmarks/ephy-topic-action.c +++ b/src/bookmarks/ephy-topic-action.c @@ -293,8 +293,6 @@ append_bookmarks_menu (EphyTopicAction *action, GtkWidget *menu, EphyNode *node, g_list_free (node_list); } - - ephy_node_thaw (node); } static GtkWidget * @@ -400,7 +398,6 @@ build_topics_menu (EphyTopicAction *action, EphyNode *node) gtk_widget_show (bmk_menu); gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), bmk_menu); } - ephy_node_thaw (node); g_list_free (node_list); uncategorized = ephy_bookmarks_get_not_categorized (bookmarks); diff --git a/src/bookmarks/ephy-topics-selector.c b/src/bookmarks/ephy-topics-selector.c index e1a583a72..7dd84a501 100644 --- a/src/bookmarks/ephy-topics-selector.c +++ b/src/bookmarks/ephy-topics-selector.c @@ -219,7 +219,6 @@ fill_model (EphyTopicsSelector *editor) -1); } } - ephy_node_thaw (keywords); } static void diff --git a/src/ephy-favorites-menu.c b/src/ephy-favorites-menu.c index 67dafe759..40d3afddf 100644 --- a/src/ephy-favorites-menu.c +++ b/src/ephy-favorites-menu.c @@ -153,7 +153,6 @@ ephy_favorites_menu_rebuild (EphyFavoritesMenu *menu) name, verb, GTK_UI_MANAGER_MENUITEM, FALSE); } - ephy_node_thaw (fav); STOP_PROFILER ("Rebuild favorites menu") } diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c index 4c0af9398..1adf9db6d 100644 --- a/src/ephy-history-window.c +++ b/src/ephy-history-window.c @@ -941,8 +941,6 @@ static void setup_filters (EphyHistoryWindow *editor, gboolean pages, gboolean sites) { - GDK_THREADS_ENTER (); - LOG ("Setup filters for pages %d and sites %d", pages, sites); if (pages) @@ -965,8 +963,6 @@ setup_filters (EphyHistoryWindow *editor, ephy_node_filter_done_changing (editor->priv->sites_filter); } - - GDK_THREADS_LEAVE (); } static void diff --git a/src/ephy-location-action.c b/src/ephy-location-action.c index efb838d57..ff6dd64e9 100644 --- a/src/ephy-location-action.c +++ b/src/ephy-location-action.c @@ -397,7 +397,6 @@ init_actions_list (EphyLocationAction *action) action->priv->actions = g_list_append (action->priv->actions, kid); } - ephy_node_thaw (action->priv->smart_bmks); } static void diff --git a/src/ephy-main.c b/src/ephy-main.c index 276b39734..ccb349ee3 100644 --- a/src/ephy-main.c +++ b/src/ephy-main.c @@ -22,7 +22,6 @@ #include "ephy-shell.h" #include "ephy-file-helpers.h" -#include "ephy-thread-helpers.h" #include "ephy-state.h" #include "ephy-debug.h" #include "ephy-stock-icons.h" @@ -153,7 +152,6 @@ main (int argc, char *argv[]) gnome_vfs_init (); glade_gnome_init (); ephy_debug_init (); - ephy_thread_helpers_init (); ephy_file_helpers_init (); ephy_stock_icons_init (); eel_gconf_monitor_add ("/apps/epiphany/general"); |