Revise MIDORI_ADBLOCK so 1 is parsing and 2 is timing
Huge amounts of console output affect performance, so timing should be taken separately.
This commit is contained in:
parent
130eb0e46a
commit
efc5252048
1 changed files with 20 additions and 5 deletions
|
@ -34,7 +34,7 @@
|
||||||
filter[4] != '-'
|
filter[4] != '-'
|
||||||
#ifdef G_ENABLE_DEBUG
|
#ifdef G_ENABLE_DEBUG
|
||||||
#define adblock_debug(dmsg, darg1, darg2) \
|
#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
|
#else
|
||||||
#define adblock_debug(dmsg, darg1, darg2) /* nothing */
|
#define adblock_debug(dmsg, darg1, darg2) /* nothing */
|
||||||
#endif
|
#endif
|
||||||
|
@ -44,7 +44,7 @@ static GHashTable* keys;
|
||||||
static gchar* blockcss = NULL;
|
static gchar* blockcss = NULL;
|
||||||
static gchar* blockcssprivate = NULL;
|
static gchar* blockcssprivate = NULL;
|
||||||
static gchar* blockscript = NULL;
|
static gchar* blockscript = NULL;
|
||||||
static gboolean debug;
|
static guint debug;
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
adblock_parse_file (gchar* path);
|
adblock_parse_file (gchar* path);
|
||||||
|
@ -764,7 +764,7 @@ adblock_resource_request_starting_cb (WebKitWebView* web_view,
|
||||||
page_uri = req_uri;
|
page_uri = req_uri;
|
||||||
|
|
||||||
#ifdef G_ENABLE_DEBUG
|
#ifdef G_ENABLE_DEBUG
|
||||||
if (debug)
|
if (debug == 2)
|
||||||
g_test_timer_start ();
|
g_test_timer_start ();
|
||||||
#endif
|
#endif
|
||||||
/* TODO: opts should be defined */
|
/* 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");
|
webkit_network_request_set_uri (request, "about:blank");
|
||||||
g_object_set_data (G_OBJECT (web_view), "blocked-uris", blocked_uris);
|
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
|
#else
|
||||||
|
@ -1349,6 +1352,7 @@ static void
|
||||||
adblock_activate_cb (MidoriExtension* extension,
|
adblock_activate_cb (MidoriExtension* extension,
|
||||||
MidoriApp* app)
|
MidoriApp* app)
|
||||||
{
|
{
|
||||||
|
const gchar* debug_mode;
|
||||||
KatzeArray* browsers;
|
KatzeArray* browsers;
|
||||||
MidoriBrowser* browser;
|
MidoriBrowser* browser;
|
||||||
guint i;
|
guint i;
|
||||||
|
@ -1359,7 +1363,18 @@ adblock_activate_cb (MidoriExtension* extension,
|
||||||
G_CALLBACK (adblock_session_request_queued_cb), NULL);
|
G_CALLBACK (adblock_session_request_queued_cb), NULL);
|
||||||
#endif
|
#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);
|
adblock_reload_rules (extension, FALSE);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue