aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-11-27 21:53:56 +0800
committerChristian Persch <chpe@src.gnome.org>2005-11-27 21:53:56 +0800
commit11a67a6cfea95f39ad8bb37c05559462a2054c18 (patch)
tree2282298701c2ac1fba31910af8e0a79a60cb65fe
parent05babc4e972258a08db006ea0d988e5300bdf0ec (diff)
downloadgsoc2013-epiphany-11a67a6cfea95f39ad8bb37c05559462a2054c18.tar
gsoc2013-epiphany-11a67a6cfea95f39ad8bb37c05559462a2054c18.tar.gz
gsoc2013-epiphany-11a67a6cfea95f39ad8bb37c05559462a2054c18.tar.bz2
gsoc2013-epiphany-11a67a6cfea95f39ad8bb37c05559462a2054c18.tar.lz
gsoc2013-epiphany-11a67a6cfea95f39ad8bb37c05559462a2054c18.tar.xz
gsoc2013-epiphany-11a67a6cfea95f39ad8bb37c05559462a2054c18.tar.zst
gsoc2013-epiphany-11a67a6cfea95f39ad8bb37c05559462a2054c18.zip
Delay reloads when we get many change notifications in a short time. Fixes
2005-11-18 Christian Persch <chpe@cvs.gnome.org> * src/ephy-tab.c: Delay reloads when we get many change notifications in a short time. Fixes bug #319993.
-rw-r--r--src/ephy-tab.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/ephy-tab.c b/src/ephy-tab.c
index e6cf46806..30f7c0325 100644
--- a/src/ephy-tab.c
+++ b/src/ephy-tab.c
@@ -71,6 +71,10 @@
#define EPHY_TAB_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_TAB, EphyTabPrivate))
#define MAX_HIDDEN_POPUPS 5
+#define MAX_HIDDEN_POPUPS 5
+#define RELOAD_DELAY 250 /* ms */
+#define RELOAD_DELAY_MAX_TICKS 40 /* RELOAD_DELAY * RELOAD_DELAY_MAX_TICKS = 10 s */
+#define MAX_TITLE_LENGTH 512 /* characters */
struct _EphyTabPrivate
{
@@ -1315,15 +1319,25 @@ ephy_tab_file_monitor_cb (GnomeVFSMonitorHandle *handle,
* Delay the reload a little bit so we don't endlessly
* reload while a file is written.
*/
- if (priv->reload_scheduled_id != 0)
+ if (priv->reload_delay_ticks == 0)
{
- g_source_remove (priv->reload_scheduled_id);
+ priv->reload_delay_ticks = 1;
+ }
+ else
+ {
+ /* Exponential backoff */
+ priv->reload_delay_ticks = MIN (priv->reload_delay_ticks * 2,
+ RELOAD_DELAY_MAX_TICKS);
+ }
+
+ if (priv->reload_scheduled_id == 0)
+ {
+ priv->reload_scheduled_id =
+ g_timeout_add (RELOAD_DELAY,
+ (GSourceFunc) ephy_file_monitor_reload_cb,
+ tab);
}
- priv->reload_scheduled_id =
- g_timeout_add (100 /* ms */,
- (GSourceFunc) ephy_file_monitor_reload_cb,
- tab);
break;
case GNOME_VFS_MONITOR_EVENT_DELETED: