| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  * This file is part of Adblock Plus <http://adblockplus.org/>, |    2  * This file is part of Adblock Plus <http://adblockplus.org/>, | 
|    3  * Copyright (C) 2006-2014 Eyeo GmbH |    3  * Copyright (C) 2006-2014 Eyeo GmbH | 
|    4  * |    4  * | 
|    5  * Adblock Plus is free software: you can redistribute it and/or modify |    5  * Adblock Plus is free software: you can redistribute it and/or modify | 
|    6  * it under the terms of the GNU General Public License version 3 as |    6  * it under the terms of the GNU General Public License version 3 as | 
|    7  * published by the Free Software Foundation. |    7  * published by the Free Software Foundation. | 
|    8  * |    8  * | 
|    9  * Adblock Plus is distributed in the hope that it will be useful, |    9  * Adblock Plus is distributed in the hope that it will be useful, | 
|   10  * but WITHOUT ANY WARRANTY; without even the implied warranty of |   10  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  366       return; |  366       return; | 
|  367  |  367  | 
|  368     TimeLine.enter("Entered FilterStorage.loadFromDisk()"); |  368     TimeLine.enter("Entered FilterStorage.loadFromDisk()"); | 
|  369     this._loading = true; |  369     this._loading = true; | 
|  370  |  370  | 
|  371     let readFile = function(sourceFile, backupIndex) |  371     let readFile = function(sourceFile, backupIndex) | 
|  372     { |  372     { | 
|  373       TimeLine.enter("FilterStorage.loadFromDisk() -> readFile()"); |  373       TimeLine.enter("FilterStorage.loadFromDisk() -> readFile()"); | 
|  374  |  374  | 
|  375       let parser = new INIParser(); |  375       let parser = new INIParser(); | 
|  376       IO.readFromFile(sourceFile, true, parser, function(e) |  376       IO.readFromFile(sourceFile, parser, function(e) | 
|  377       { |  377       { | 
|  378         TimeLine.enter("FilterStorage.loadFromDisk() read callback"); |  378         TimeLine.enter("FilterStorage.loadFromDisk() read callback"); | 
|  379         if (!e && parser.subscriptions.length == 0) |  379         if (!e && parser.subscriptions.length == 0) | 
|  380         { |  380         { | 
|  381           // No filter subscriptions in the file, this isn't right. |  381           // No filter subscriptions in the file, this isn't right. | 
|  382           e = new Error("No data in the file"); |  382           e = new Error("No data in the file"); | 
|  383         } |  383         } | 
|  384  |  384  | 
|  385         if (e) |  385         if (e) | 
|  386           Cu.reportError(e); |  386           Cu.reportError(e); | 
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  568     TimeLine.enter("Entered FilterStorage.saveToDisk()"); |  568     TimeLine.enter("Entered FilterStorage.saveToDisk()"); | 
|  569  |  569  | 
|  570     // Make sure the file's parent directory exists |  570     // Make sure the file's parent directory exists | 
|  571     try { |  571     try { | 
|  572       targetFile.parent.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECT
     ORY); |  572       targetFile.parent.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECT
     ORY); | 
|  573     } catch (e) {} |  573     } catch (e) {} | 
|  574  |  574  | 
|  575     let writeFilters = function() |  575     let writeFilters = function() | 
|  576     { |  576     { | 
|  577       TimeLine.enter("FilterStorage.saveToDisk() -> writeFilters()"); |  577       TimeLine.enter("FilterStorage.saveToDisk() -> writeFilters()"); | 
|  578       IO.writeToFile(targetFile, true, this._generateFilterData(subscriptions), 
     function(e) |  578       IO.writeToFile(targetFile, this._generateFilterData(subscriptions), functi
     on(e) | 
|  579       { |  579       { | 
|  580         TimeLine.enter("FilterStorage.saveToDisk() write callback"); |  580         TimeLine.enter("FilterStorage.saveToDisk() write callback"); | 
|  581         if (!explicitFile) |  581         if (!explicitFile) | 
|  582           this._saving = false; |  582           this._saving = false; | 
|  583  |  583  | 
|  584         if (e) |  584         if (e) | 
|  585           Cu.reportError(e); |  585           Cu.reportError(e); | 
|  586  |  586  | 
|  587         if (!explicitFile && this._needsSave) |  587         if (!explicitFile && this._needsSave) | 
|  588         { |  588         { | 
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  885       Subscription.knownSubscriptions = origKnownSubscriptions; |  885       Subscription.knownSubscriptions = origKnownSubscriptions; | 
|  886     } |  886     } | 
|  887  |  887  | 
|  888     // Allow events to be processed every now and then. |  888     // Allow events to be processed every now and then. | 
|  889     // Note: IO.readFromFile() will deal with the potential reentrance here. |  889     // Note: IO.readFromFile() will deal with the potential reentrance here. | 
|  890     this.linesProcessed++; |  890     this.linesProcessed++; | 
|  891     if (this.linesProcessed % 1000 == 0) |  891     if (this.linesProcessed % 1000 == 0) | 
|  892       Utils.yield(); |  892       Utils.yield(); | 
|  893   } |  893   } | 
|  894 }; |  894 }; | 
| OLD | NEW |