[Pkg-mozext-commits] [adblock-plus] 12/28: Issue 139 - Removed references to Timeline and timeline.js
David Prévot
taffit at moszumanska.debian.org
Wed Nov 12 02:09:50 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository adblock-plus.
commit 860b792c2dde99b2edd9c18c2e63c659ac65e698
Author: beelzy <beelzy at gmx.de>
Date: Mon Sep 15 12:47:08 2014 +0200
Issue 139 - Removed references to Timeline and timeline.js
--HG--
extra : rebase_source : d523f1aedda187fd925fe2fe295123b7733f95ae
---
lib/contentPolicy.js | 10 ----
lib/elemHide.js | 20 -------
lib/filterListener.js | 8 ---
lib/filterStorage.js | 26 ---------
lib/io.js | 31 +---------
lib/main.js | 11 ----
lib/notification.js | 5 --
lib/synchronizer.js | 5 --
lib/timeline.js | 155 --------------------------------------------------
9 files changed, 2 insertions(+), 269 deletions(-)
diff --git a/lib/contentPolicy.js b/lib/contentPolicy.js
index d21a2cd..9983e91 100644
--- a/lib/contentPolicy.js
+++ b/lib/contentPolicy.js
@@ -22,7 +22,6 @@
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
-let {TimeLine} = require("timeline");
let {Utils} = require("utils");
let {Prefs} = require("prefs");
let {FilterStorage} = require("filterStorage");
@@ -90,8 +89,6 @@ let Policy = exports.Policy =
*/
init: function()
{
- TimeLine.enter("Entered content policy initialization");
-
// type constant by type description and type description by type constant
let iface = Ci.nsIContentPolicy;
for (let typeName of contentTypes)
@@ -120,12 +117,8 @@ let Policy = exports.Policy =
for (let scheme of Prefs.whitelistschemes.toLowerCase().split(" "))
this.whitelistSchemes[scheme] = true;
- TimeLine.log("done initializing types");
-
// Generate class identifier used to collapse node and register corresponding
// stylesheet.
- TimeLine.log("registering global stylesheet");
-
let offset = "a".charCodeAt(0);
for (let i = 0; i < 20; i++)
collapsedClass += String.fromCharCode(offset + Math.random() * 26);
@@ -138,9 +131,6 @@ let Policy = exports.Policy =
{
Utils.styleService.unregisterSheet(collapseStyle, Ci.nsIStyleSheetService.USER_SHEET);
})
- TimeLine.log("done registering stylesheet");
-
- TimeLine.leave("Done initializing content policy");
},
/**
diff --git a/lib/elemHide.js b/lib/elemHide.js
index c844284..b8e0dd7 100644
--- a/lib/elemHide.js
+++ b/lib/elemHide.js
@@ -27,7 +27,6 @@ let {Prefs} = require("prefs");
let {ElemHideException} = require("filterClasses");
let {FilterNotifier} = require("filterNotifier");
let {AboutHandler} = require("elemHideHitRegistration");
-let {TimeLine} = require("timeline");
/**
* Lookup table, filters by their associated key
@@ -82,7 +81,6 @@ let ElemHide = exports.ElemHide =
*/
init: function()
{
- TimeLine.enter("Entered ElemHide.init()");
Prefs.addListener(function(name)
{
if (name == "enabled")
@@ -93,14 +91,9 @@ let ElemHide = exports.ElemHide =
ElemHide.unapply();
});
- TimeLine.log("done adding prefs listener");
-
let styleFile = IO.resolveFilePath(Prefs.data_directory);
styleFile.append("elemhide.css");
styleURL = Services.io.newFileURI(styleFile).QueryInterface(Ci.nsIFileURL);
- TimeLine.log("done determining stylesheet URL");
-
- TimeLine.leave("ElemHide.init() done");
},
/**
@@ -219,8 +212,6 @@ let ElemHide = exports.ElemHide =
return;
}
- TimeLine.enter("Entered ElemHide.apply()");
-
if (!ElemHide.isDirty || !Prefs.enabled)
{
// Nothing changed, looks like we merely got enabled/disabled
@@ -235,21 +226,17 @@ let ElemHide = exports.ElemHide =
{
Cu.reportError(e);
}
- TimeLine.log("Applying existing stylesheet finished");
}
else if (!Prefs.enabled && ElemHide.applied)
{
ElemHide.unapply();
- TimeLine.log("ElemHide.unapply() finished");
}
- TimeLine.leave("ElemHide.apply() done (no file changes)");
return;
}
IO.writeToFile(styleURL.file, this._generateCSSContent(), function(e)
{
- TimeLine.enter("ElemHide.apply() write callback");
this._applying = false;
// _generateCSSContent is throwing NS_ERROR_NOT_AVAILABLE to indicate that
@@ -274,7 +261,6 @@ let ElemHide = exports.ElemHide =
ElemHide.isDirty = false;
ElemHide.unapply();
- TimeLine.log("ElemHide.unapply() finished");
if (!noFilters)
{
@@ -287,23 +273,18 @@ let ElemHide = exports.ElemHide =
{
Cu.reportError(e);
}
- TimeLine.log("Applying stylesheet finished");
}
FilterNotifier.triggerListeners("elemhideupdate");
}
- TimeLine.leave("ElemHide.apply() write callback done");
}.bind(this), "ElemHideWrite");
this._applying = true;
-
- TimeLine.leave("ElemHide.apply() done", "ElemHideWrite");
},
_generateCSSContent: function()
{
// Grouping selectors by domains
- TimeLine.log("start grouping selectors");
let domains = Object.create(null);
let hasFilters = false;
for (let key in filterByKey)
@@ -322,7 +303,6 @@ let ElemHide = exports.ElemHide =
list[filter.selector] = key;
hasFilters = true;
}
- TimeLine.log("done grouping selectors");
if (!hasFilters)
throw Cr.NS_ERROR_NOT_AVAILABLE;
diff --git a/lib/filterListener.js b/lib/filterListener.js
index 1687a26..8935aa1 100644
--- a/lib/filterListener.js
+++ b/lib/filterListener.js
@@ -22,7 +22,6 @@
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
-let {TimeLine} = require("timeline");
let {FilterStorage} = require("filterStorage");
let {FilterNotifier} = require("filterNotifier");
let {ElemHide} = require("elemHide");
@@ -103,8 +102,6 @@ let HistoryPurgeObserver =
*/
function init()
{
- TimeLine.enter("Entered filter listener initialization()");
-
FilterNotifier.addListener(function(action, item, newValue, oldValue)
{
let match = /^(\w+)\.(.*)/.exec(action);
@@ -122,16 +119,11 @@ function init()
flushElemHide = function() {}; // No global stylesheet in Chrome & Co.
FilterStorage.loadFromDisk();
- TimeLine.log("done initializing data structures");
-
Services.obs.addObserver(HistoryPurgeObserver, "browser:purge-session-history", true);
onShutdown.add(function()
{
Services.obs.removeObserver(HistoryPurgeObserver, "browser:purge-session-history");
});
- TimeLine.log("done adding observers");
-
- TimeLine.leave("Filter listener initialization done");
}
init();
diff --git a/lib/filterStorage.js b/lib/filterStorage.js
index 7028ec9..958bbb7 100644
--- a/lib/filterStorage.js
+++ b/lib/filterStorage.js
@@ -29,7 +29,6 @@ let {Filter, ActiveFilter} = require("filterClasses");
let {Subscription, SpecialSubscription, ExternalSubscription} = require("subscriptionClasses");
let {FilterNotifier} = require("filterNotifier");
let {Utils} = require("utils");
-let {TimeLine} = require("timeline");
/**
* Version number of the filter storage file format.
@@ -369,17 +368,13 @@ let FilterStorage = exports.FilterStorage =
if (this._loading)
return;
- TimeLine.enter("Entered FilterStorage.loadFromDisk()");
this._loading = true;
let readFile = function(sourceFile, backupIndex)
{
- TimeLine.enter("FilterStorage.loadFromDisk() -> readFile()");
-
let parser = new INIParser();
IO.readFromFile(sourceFile, parser, function(e)
{
- TimeLine.enter("FilterStorage.loadFromDisk() read callback");
if (!e && parser.subscriptions.length == 0)
{
// No filter subscriptions in the file, this isn't right.
@@ -407,14 +402,11 @@ let FilterStorage = exports.FilterStorage =
else
doneReading(parser);
});
- TimeLine.leave("FilterStorage.loadFromDisk() read callback done");
return;
}
}
doneReading(parser);
}.bind(this), "FilterStorageRead");
-
- TimeLine.leave("FilterStorage.loadFromDisk() <- readFile()", "FilterStorageRead");
}.bind(this);
var doneReading = function(parser)
@@ -445,7 +437,6 @@ let FilterStorage = exports.FilterStorage =
this.addFilter(filter, null, undefined, true);
}
}
- TimeLine.log("Initializing data done, triggering observers")
this._loading = false;
FilterNotifier.triggerListeners("load");
@@ -453,7 +444,6 @@ let FilterStorage = exports.FilterStorage =
if (sourceFile != this.sourceFile)
this.saveToDisk();
- TimeLine.leave("FilterStorage.loadFromDisk() read callback done");
}.bind(this);
let explicitFile;
@@ -474,8 +464,6 @@ let FilterStorage = exports.FilterStorage =
this.firstRun = true;
this._loading = false;
FilterNotifier.triggerListeners("load");
-
- TimeLine.leave("FilterStorage.loadFromDisk() read callback done");
}
else
readFile(sourceFile, 0);
@@ -486,8 +474,6 @@ let FilterStorage = exports.FilterStorage =
else
callback(true);
}
-
- TimeLine.leave("FilterStorage.loadFromDisk() done");
},
_generateFilterData: function(subscriptions)
@@ -569,8 +555,6 @@ let FilterStorage = exports.FilterStorage =
return;
}
- TimeLine.enter("Entered FilterStorage.saveToDisk()");
-
// Make sure the file's parent directory exists
try {
targetFile.parent.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
@@ -578,10 +562,8 @@ let FilterStorage = exports.FilterStorage =
let writeFilters = function()
{
- TimeLine.enter("FilterStorage.saveToDisk() -> writeFilters()");
IO.writeToFile(targetFile, this._generateFilterData(subscriptions), function(e)
{
- TimeLine.enter("FilterStorage.saveToDisk() write callback");
if (!explicitFile)
this._saving = false;
@@ -595,9 +577,7 @@ let FilterStorage = exports.FilterStorage =
}
else
FilterNotifier.triggerListeners("save");
- TimeLine.leave("FilterStorage.saveToDisk() write callback done");
}.bind(this), "FilterStorageWrite");
- TimeLine.leave("FilterStorage.saveToDisk() -> writeFilters()", "FilterStorageWrite");
}.bind(this);
let checkBackupRequired = function(callbackNotRequired, callbackRequired)
@@ -629,16 +609,13 @@ let FilterStorage = exports.FilterStorage =
let removeLastBackup = function(part1, part2)
{
- TimeLine.enter("FilterStorage.saveToDisk() -> removeLastBackup()");
let file = targetFile.clone();
file.leafName = part1 + "-backup" + Prefs.patternsbackups + part2;
IO.removeFile(file, (e) => renameBackup(part1, part2, Prefs.patternsbackups - 1));
- TimeLine.leave("FilterStorage.saveToDisk() <- removeLastBackup()");
}.bind(this);
let renameBackup = function(part1, part2, index)
{
- TimeLine.enter("FilterStorage.saveToDisk() -> renameBackup()");
if (index > 0)
{
let fromFile = targetFile.clone();
@@ -655,7 +632,6 @@ let FilterStorage = exports.FilterStorage =
IO.copyFile(targetFile, toFile, writeFilters);
}
- TimeLine.leave("FilterStorage.saveToDisk() <- renameBackup()");
}.bind(this);
// Do not persist external subscriptions
@@ -664,8 +640,6 @@ let FilterStorage = exports.FilterStorage =
this._saving = true;
checkBackupRequired(writeFilters, removeLastBackup);
-
- TimeLine.leave("FilterStorage.saveToDisk() done");
},
/**
diff --git a/lib/io.js b/lib/io.js
index 915b5c1..f054fb3 100644
--- a/lib/io.js
+++ b/lib/io.js
@@ -24,7 +24,6 @@ let {FileUtils} = Cu.import("resource://gre/modules/FileUtils.jsm", null);
let {OS} = Cu.import("resource://gre/modules/osfile.jsm", null);
let {Task} = Cu.import("resource://gre/modules/Task.jsm", null);
-let {TimeLine} = require("timeline");
let {Prefs} = require("prefs");
let {Utils} = require("utils");
@@ -70,7 +69,7 @@ let IO = exports.IO =
* each line read and with a null parameter once the read operation is done.
* The callback will be called when the operation is done.
*/
- readFromFile: function(/**nsIFile*/ file, /**Object*/ listener, /**Function*/ callback, /**String*/ timeLineID)
+ readFromFile: function(/**nsIFile*/ file, /**Object*/ listener, /**Function*/ callback)
{
try
{
@@ -81,11 +80,6 @@ let IO = exports.IO =
let onProgress = function(data)
{
- if (timeLineID)
- {
- TimeLine.asyncStart(timeLineID);
- }
-
let index = (processing ? -1 : Math.max(data.lastIndexOf("\n"), data.lastIndexOf("\r")));
if (index >= 0)
{
@@ -125,11 +119,6 @@ let IO = exports.IO =
}
else
buffer += data;
-
- if (timeLineID)
- {
- TimeLine.asyncEnd(timeLineID);
- }
};
let onSuccess = function()
@@ -141,21 +130,10 @@ let IO = exports.IO =
return;
}
- if (timeLineID)
- {
- TimeLine.asyncStart(timeLineID);
- }
-
if (buffer !== "")
listener.process(buffer);
listener.process(null);
- if (timeLineID)
- {
- TimeLine.asyncEnd(timeLineID);
- TimeLine.asyncDone(timeLineID);
- }
-
callback(null);
};
@@ -169,11 +147,6 @@ let IO = exports.IO =
}
callback(e);
-
- if (timeLineID)
- {
- TimeLine.asyncDone(timeLineID);
- }
};
let decoder = new TextDecoder();
@@ -226,7 +199,7 @@ let IO = exports.IO =
* Writes string data to a file in UTF-8 format asynchronously. The callback
* will be called when the write operation is done.
*/
- writeToFile: function(/**nsIFile*/ file, /**Iterator*/ data, /**Function*/ callback, /**String*/ timeLineID)
+ writeToFile: function(/**nsIFile*/ file, /**Iterator*/ data, /**Function*/ callback)
{
try
{
diff --git a/lib/main.js b/lib/main.js
index f18cc05..a065de0 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -22,24 +22,13 @@
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
-let {TimeLine} = require("timeline");
-
-TimeLine.enter("Adblock Plus startup");
registerPublicAPI();
-TimeLine.log("Done registering public API");
require("filterListener");
-TimeLine.log("Done loading filter listener");
require("contentPolicy");
-TimeLine.log("Done loading content policy");
require("synchronizer");
-TimeLine.log("Done loading subscription synchronizer");
require("notification");
-TimeLine.log("Done loading notification downloader");
require("sync");
-TimeLine.log("Done loading sync support");
require("ui");
-TimeLine.log("Done loading UI integration code");
-TimeLine.leave("Started up");
function registerPublicAPI()
{
diff --git a/lib/notification.js b/lib/notification.js
index 06e949e..b00d24c 100644
--- a/lib/notification.js
+++ b/lib/notification.js
@@ -21,7 +21,6 @@
Cu.import("resource://gre/modules/Services.jsm");
-let {TimeLine} = require("timeline");
let {Prefs} = require("prefs");
let {Downloader, Downloadable, MILLIS_IN_MINUTE, MILLIS_IN_HOUR, MILLIS_IN_DAY} = require("downloader");
let {Utils} = require("utils");
@@ -81,8 +80,6 @@ let Notification = exports.Notification =
*/
init: function()
{
- TimeLine.enter("Entered Notification.init()");
-
downloader = new Downloader(this._getDownloadables.bind(this), INITIAL_DELAY, CHECK_INTERVAL);
onShutdown.add(function()
{
@@ -92,8 +89,6 @@ let Notification = exports.Notification =
downloader.onExpirationChange = this._onExpirationChange.bind(this);
downloader.onDownloadSuccess = this._onDownloadSuccess.bind(this);
downloader.onDownloadError = this._onDownloadError.bind(this);
-
- TimeLine.leave("Notification.init() done");
},
/**
diff --git a/lib/synchronizer.js b/lib/synchronizer.js
index 619270c..4c822f0 100644
--- a/lib/synchronizer.js
+++ b/lib/synchronizer.js
@@ -22,7 +22,6 @@
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
-let {TimeLine} = require("timeline");
let {Downloader, Downloadable,
MILLIS_IN_SECOND, MILLIS_IN_MINUTE, MILLIS_IN_HOUR, MILLIS_IN_DAY} = require("downloader");
let {Filter, CommentFilter} = require("filterClasses");
@@ -54,8 +53,6 @@ let Synchronizer = exports.Synchronizer =
*/
init: function()
{
- TimeLine.enter("Entered Synchronizer.init()");
-
downloader = new Downloader(this._getDownloadables.bind(this), INITIAL_DELAY, CHECK_INTERVAL);
onShutdown.add(function()
{
@@ -66,8 +63,6 @@ let Synchronizer = exports.Synchronizer =
downloader.onDownloadStarted = this._onDownloadStarted.bind(this);
downloader.onDownloadSuccess = this._onDownloadSuccess.bind(this);
downloader.onDownloadError = this._onDownloadError.bind(this);
-
- TimeLine.leave("Synchronizer.init() done");
},
/**
diff --git a/lib/timeline.js b/lib/timeline.js
deleted file mode 100644
index fba2098..0000000
--- a/lib/timeline.js
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * This file is part of Adblock Plus <http://adblockplus.org/>,
- * Copyright (C) 2006-2014 Eyeo GmbH
- *
- * Adblock Plus is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * Adblock Plus 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 Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * @fileOverview Debugging module used for load time measurements.
- */
-
-let nestingCounter = 0;
-let firstTimeStamp = null;
-let lastTimeStamp = null;
-
-let asyncActions = Object.create(null);
-
-/**
- * Time logging module, used to measure startup time of Adblock Plus (development builds only).
- * @class
- */
-let TimeLine = exports.TimeLine = {
- /**
- * Logs an event to console together with the time it took to get there.
- */
- log: function(/**String*/ message, /**Boolean*/ _forceDisplay)
- {
- if (!_forceDisplay && nestingCounter <= 0)
- return;
-
- let now = Date.now();
- let diff = lastTimeStamp ? Math.round(now - lastTimeStamp) : "first event";
- lastTimeStamp = now;
-
- // Indent message depending on current nesting level
- for (let i = 0; i < nestingCounter; i++)
- message = "* " + message;
-
- // Pad message with spaces
- let padding = [];
- for (let i = message.toString().length; i < 80; i++)
- padding.push(" ");
- dump("[" + now + "] ABP timeline: " + message + padding.join("") + "\t (" + diff + ")\n");
- },
-
- /**
- * Called to indicate that application entered a block that needs to be timed.
- */
- enter: function(/**String*/ message)
- {
- if (nestingCounter <= 0)
- firstTimeStamp = Date.now();
-
- this.log(message, true);
- nestingCounter = (nestingCounter <= 0 ? 1 : nestingCounter + 1);
- },
-
- /**
- * Called when application exited a block that TimeLine.enter() was called for.
- * @param {String} message message to be logged
- * @param {String} [asyncAction] identifier of a pending async action
- */
- leave: function(message, asyncAction)
- {
- if (typeof asyncAction != "undefined")
- message += " (async action pending)";
-
- nestingCounter--;
- this.log(message, true);
-
- if (nestingCounter <= 0)
- {
- if (firstTimeStamp !== null)
- dump("ABP timeline: Total time elapsed: " + Math.round(Date.now() - firstTimeStamp) + "\n");
- firstTimeStamp = null;
- lastTimeStamp = null;
- }
-
- if (typeof asyncAction != "undefined")
- {
- if (asyncAction in asyncActions)
- dump("ABP timeline: Warning: Async action " + asyncAction + " already executing\n");
- asyncActions[asyncAction] = {start: Date.now(), total: 0};
- }
- },
-
- /**
- * Called when the application starts processing of an async action.
- */
- asyncStart: function(/**String*/ asyncAction)
- {
- if (asyncAction in asyncActions)
- {
- let action = asyncActions[asyncAction];
- if ("currentStart" in action)
- dump("ABP timeline: Warning: Processing reentered for async action " + asyncAction + "\n");
- action.currentStart = Date.now();
- }
- else
- dump("ABP timeline: Warning: Async action " + asyncAction + " is unknown\n");
- },
-
- /**
- * Called when the application finishes processing of an async action.
- */
- asyncEnd: function(/**String*/ asyncAction)
- {
- if (asyncAction in asyncActions)
- {
- let action = asyncActions[asyncAction];
- if ("currentStart" in action)
- {
- action.total += Date.now() - action.currentStart;
- delete action.currentStart;
- }
- else
- dump("ABP timeline: Warning: Processing not entered for async action " + asyncAction + "\n");
- }
- else
- dump("ABP timeline: Warning: Async action " + asyncAction + " is unknown\n");
- },
-
- /**
- * Called when an async action is done and its time can be logged.
- */
- asyncDone: function(/**String*/ asyncAction)
- {
- if (asyncAction in asyncActions)
- {
- let action = asyncActions[asyncAction];
- let now = Date.now();
- let diff = now - action.start;
- if ("currentStart" in action)
- dump("ABP timeline: Warning: Still processing for async action " + asyncAction + "\n");
-
- let message = "Async action " + asyncAction + " done";
- let padding = [];
- for (let i = message.toString().length; i < 80; i++)
- padding.push(" ");
- dump("[" + now + "] ABP timeline: " + message + padding.join("") + "\t (" + action.total + "/" + diff + ")\n");
- }
- else
- dump("ABP timeline: Warning: Async action " + asyncAction + " is unknown\n");
- }
-};
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git
More information about the Pkg-mozext-commits
mailing list