OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 11 matching lines...) Expand all Loading... |
22 Cu.import("resource://gre/modules/Services.jsm"); | 22 Cu.import("resource://gre/modules/Services.jsm"); |
23 Cu.import("resource://gre/modules/FileUtils.jsm"); | 23 Cu.import("resource://gre/modules/FileUtils.jsm"); |
24 Cu.import("resource://gre/modules/XPCOMUtils.jsm"); | 24 Cu.import("resource://gre/modules/XPCOMUtils.jsm"); |
25 | 25 |
26 let {IO} = require("io"); | 26 let {IO} = require("io"); |
27 let {Prefs} = require("prefs"); | 27 let {Prefs} = require("prefs"); |
28 let {Filter, ActiveFilter} = require("filterClasses"); | 28 let {Filter, ActiveFilter} = require("filterClasses"); |
29 let {Subscription, SpecialSubscription, ExternalSubscription} = require("subscri
ptionClasses"); | 29 let {Subscription, SpecialSubscription, ExternalSubscription} = require("subscri
ptionClasses"); |
30 let {FilterNotifier} = require("filterNotifier"); | 30 let {FilterNotifier} = require("filterNotifier"); |
31 let {Utils} = require("utils"); | 31 let {Utils} = require("utils"); |
| 32 let {FilterHits} = require("filterHits"); |
32 | 33 |
33 /** | 34 /** |
34 * Version number of the filter storage file format. | 35 * Version number of the filter storage file format. |
35 * @type Integer | 36 * @type Integer |
36 */ | 37 */ |
37 let formatVersion = 4; | 38 let formatVersion = 4; |
38 | 39 |
39 /** | 40 /** |
40 * This class reads user's filters from disk, manages them in memory and writes
them back. | 41 * This class reads user's filters from disk, manages them in memory and writes
them back. |
41 * @class | 42 * @class |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 increaseHitCount: function(filter, wnd) | 330 increaseHitCount: function(filter, wnd) |
330 { | 331 { |
331 if (!Prefs.savestats || PrivateBrowsing.enabledForWindow(wnd) || | 332 if (!Prefs.savestats || PrivateBrowsing.enabledForWindow(wnd) || |
332 PrivateBrowsing.enabled || !(filter instanceof ActiveFilter)) | 333 PrivateBrowsing.enabled || !(filter instanceof ActiveFilter)) |
333 { | 334 { |
334 return; | 335 return; |
335 } | 336 } |
336 | 337 |
337 filter.hitCount++; | 338 filter.hitCount++; |
338 filter.lastHit = Date.now(); | 339 filter.lastHit = Date.now(); |
| 340 if (Prefs.sendstats) |
| 341 FilterHits.increaseFilterHits(filter, wnd); |
339 }, | 342 }, |
340 | 343 |
341 /** | 344 /** |
342 * Resets hit count for some filters | 345 * Resets hit count for some filters |
343 * @param {Array of Filter} filters filters to be reset, if null all filters
will be reset | 346 * @param {Array of Filter} filters filters to be reset, if null all filters
will be reset |
344 */ | 347 */ |
345 resetHitCounts: function(filters) | 348 resetHitCounts: function(filters) |
346 { | 349 { |
347 if (!filters) | 350 if (!filters) |
348 { | 351 { |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 Subscription.knownSubscriptions = origKnownSubscriptions; | 866 Subscription.knownSubscriptions = origKnownSubscriptions; |
864 } | 867 } |
865 | 868 |
866 // Allow events to be processed every now and then. | 869 // Allow events to be processed every now and then. |
867 // Note: IO.readFromFile() will deal with the potential reentrance here. | 870 // Note: IO.readFromFile() will deal with the potential reentrance here. |
868 this.linesProcessed++; | 871 this.linesProcessed++; |
869 if (this.linesProcessed % 1000 == 0) | 872 if (this.linesProcessed % 1000 == 0) |
870 Utils.yield(); | 873 Utils.yield(); |
871 } | 874 } |
872 }; | 875 }; |
OLD | NEW |