[Xfce4-commits] <midori:master> Revise MIDORI_ADBLOCK so 1 is parsing and 2 is timing
Christian Dywan
noreply at xfce.org
Sat Apr 10 01:00:03 CEST 2010
Updating branch refs/heads/master
to efc5252048ec04e2b079de1b73d1105b9c4b5b9a (commit)
from 130eb0e46aaf5af673b12d0eff3fe8e7b58c5699 (commit)
commit efc5252048ec04e2b079de1b73d1105b9c4b5b9a
Author: Christian Dywan <christian at twotoasts.de>
Date: Fri Apr 9 22:57:05 2010 +0200
Revise MIDORI_ADBLOCK so 1 is parsing and 2 is timing
Huge amounts of console output affect performance, so timing
should be taken separately.
extensions/adblock.c | 25 ++++++++++++++++++++-----
1 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/extensions/adblock.c b/extensions/adblock.c
index 2b142c7..8fd25a9 100644
--- a/extensions/adblock.c
+++ b/extensions/adblock.c
@@ -34,7 +34,7 @@
filter[4] != '-'
#ifdef G_ENABLE_DEBUG
#define adblock_debug(dmsg, darg1, darg2) \
- do { if (debug) g_debug (dmsg, darg1, darg2); } while (0)
+ do { if (debug == 1) g_debug (dmsg, darg1, darg2); } while (0)
#else
#define adblock_debug(dmsg, darg1, darg2) /* nothing */
#endif
@@ -44,7 +44,7 @@ static GHashTable* keys;
static gchar* blockcss = NULL;
static gchar* blockcssprivate = NULL;
static gchar* blockscript = NULL;
-static gboolean debug;
+static guint debug;
static gboolean
adblock_parse_file (gchar* path);
@@ -764,7 +764,7 @@ adblock_resource_request_starting_cb (WebKitWebView* web_view,
page_uri = req_uri;
#ifdef G_ENABLE_DEBUG
- if (debug)
+ if (debug == 2)
g_test_timer_start ();
#endif
/* TODO: opts should be defined */
@@ -775,7 +775,10 @@ adblock_resource_request_starting_cb (WebKitWebView* web_view,
webkit_network_request_set_uri (request, "about:blank");
g_object_set_data (G_OBJECT (web_view), "blocked-uris", blocked_uris);
}
- adblock_debug ("match: %f%s", g_test_timer_elapsed (), "seconds");
+ #ifdef G_ENABLE_DEBUG
+ if (debug == 2)
+ g_debug ("match: %f%s", g_test_timer_elapsed (), "seconds");
+ #endif
}
#else
@@ -1349,6 +1352,7 @@ static void
adblock_activate_cb (MidoriExtension* extension,
MidoriApp* app)
{
+ const gchar* debug_mode;
KatzeArray* browsers;
MidoriBrowser* browser;
guint i;
@@ -1359,7 +1363,18 @@ adblock_activate_cb (MidoriExtension* extension,
G_CALLBACK (adblock_session_request_queued_cb), NULL);
#endif
- debug = g_getenv ("MIDORI_ADBLOCK") != NULL;
+ #ifdef G_ENABLE_DEBUG
+ debug_mode = g_getenv ("MIDORI_ADBLOCK");
+ if (debug_mode)
+ {
+ if (*debug_mode == '1')
+ debug = 1;
+ else if (*debug_mode == '2')
+ debug = 2;
+ else
+ debug = 0;
+ }
+ #endif
adblock_reload_rules (extension, FALSE);
More information about the Xfce4-commits
mailing list