Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/filterStorage.js

Issue 5731880649359360: Don't delay Firefox startup (Closed)
Patch Set: Created March 13, 2014, 1:52 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/io.js » ('j') | lib/io.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/filterStorage.js
===================================================================
--- a/lib/filterStorage.js
+++ b/lib/filterStorage.js
@@ -23,16 +23,17 @@ Cu.import("resource://gre/modules/Servic
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
let {IO} = require("io");
let {Prefs} = require("prefs");
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.
* @type Integer
*/
let formatVersion = 4;
@@ -785,19 +786,20 @@ function INIParser()
{
this.fileProperties = this.curObj = {};
this.subscriptions = [];
this.knownFilters = {__proto__: null};
this.knownSubscriptions = {__proto__: null};
}
INIParser.prototype =
{
+ linesProcessed: 0,
subscriptions: null,
knownFilters: null,
- knownSubscrptions : null,
+ knownSubscriptions : null,
wantObj: true,
fileProperties: null,
curObj: null,
curSection: null,
userFilters: null,
process: function(val)
{
@@ -872,10 +874,16 @@ INIParser.prototype =
else if (this.wantObj === false && val)
this.curObj.push(val.replace(/\\\[/g, "["));
}
finally
{
Filter.knownFilters = origKnownFilters;
Subscription.knownSubscriptions = origKnownSubscriptions;
}
+
+ // Allow events to be processed every now and then.
+ // Note: IO.readFromFile() will deal with the potential reentrance here.
+ this.linesProcessed++;
+ if (this.linesProcessed % 1000 == 0)
+ Utils.yield();
}
};
« no previous file with comments | « no previous file | lib/io.js » ('j') | lib/io.js » ('J')

Powered by Google App Engine
This is Rietveld