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

Side by Side Diff: lib/filterStorage.js

Issue 4911914341629952: Issue 2233 - Adapted some more array type annotations for JsDoc 3 (Closed)
Patch Set: Created April 1, 2015, 9:35 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/contentPolicy.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 firstRun: false, 96 firstRun: false,
97 97
98 /** 98 /**
99 * Map of properties listed in the filter storage file before the sections 99 * Map of properties listed in the filter storage file before the sections
100 * start. Right now this should be only the format version. 100 * start. Right now this should be only the format version.
101 */ 101 */
102 fileProperties: Object.create(null), 102 fileProperties: Object.create(null),
103 103
104 /** 104 /**
105 * List of filter subscriptions containing all filters 105 * List of filter subscriptions containing all filters
106 * @type Array of Subscription 106 * @type Subscription[]
107 */ 107 */
108 subscriptions: [], 108 subscriptions: [],
109 109
110 /** 110 /**
111 * Map of subscriptions already on the list, by their URL/identifier 111 * Map of subscriptions already on the list, by their URL/identifier
112 * @type Object 112 * @type Object
113 */ 113 */
114 knownSubscriptions: Object.create(null), 114 knownSubscriptions: Object.create(null),
115 115
116 /** 116 /**
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 return; 198 return;
199 199
200 FilterStorage.subscriptions.splice(currentPos, 1); 200 FilterStorage.subscriptions.splice(currentPos, 1);
201 FilterStorage.subscriptions.splice(newPos, 0, subscription); 201 FilterStorage.subscriptions.splice(newPos, 0, subscription);
202 FilterNotifier.triggerListeners("subscription.moved", subscription); 202 FilterNotifier.triggerListeners("subscription.moved", subscription);
203 }, 203 },
204 204
205 /** 205 /**
206 * Replaces the list of filters in a subscription by a new list 206 * Replaces the list of filters in a subscription by a new list
207 * @param {Subscription} subscription filter subscription to be updated 207 * @param {Subscription} subscription filter subscription to be updated
208 * @param {Array of Filter} filters new filter lsit 208 * @param {Filter[]} filters new filter list
209 */ 209 */
210 updateSubscriptionFilters: function(subscription, filters) 210 updateSubscriptionFilters: function(subscription, filters)
211 { 211 {
212 removeSubscriptionFilters(subscription); 212 removeSubscriptionFilters(subscription);
213 subscription.oldFilters = subscription.filters; 213 subscription.oldFilters = subscription.filters;
214 subscription.filters = filters; 214 subscription.filters = filters;
215 addSubscriptionFilters(subscription); 215 addSubscriptionFilters(subscription);
216 FilterNotifier.triggerListeners("subscription.updated", subscription); 216 FilterNotifier.triggerListeners("subscription.updated", subscription);
217 delete subscription.oldFilters; 217 delete subscription.oldFilters;
218 }, 218 },
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 { 333 {
334 return; 334 return;
335 } 335 }
336 336
337 filter.hitCount++; 337 filter.hitCount++;
338 filter.lastHit = Date.now(); 338 filter.lastHit = Date.now();
339 }, 339 },
340 340
341 /** 341 /**
342 * Resets hit count for some filters 342 * Resets hit count for some filters
343 * @param {Array of Filter} filters filters to be reset, if null all filters will be reset 343 * @param {Filter[]} filters filters to be reset, if null all filters will be reset
344 */ 344 */
345 resetHitCounts: function(filters) 345 resetHitCounts: function(filters)
346 { 346 {
347 if (!filters) 347 if (!filters)
348 { 348 {
349 filters = []; 349 filters = [];
350 for (let text in Filter.knownFilters) 350 for (let text in Filter.knownFilters)
351 filters.push(Filter.knownFilters[text]); 351 filters.push(Filter.knownFilters[text]);
352 } 352 }
353 for (let filter of filters) 353 for (let filter of filters)
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 Subscription.knownSubscriptions = origKnownSubscriptions; 863 Subscription.knownSubscriptions = origKnownSubscriptions;
864 } 864 }
865 865
866 // Allow events to be processed every now and then. 866 // Allow events to be processed every now and then.
867 // Note: IO.readFromFile() will deal with the potential reentrance here. 867 // Note: IO.readFromFile() will deal with the potential reentrance here.
868 this.linesProcessed++; 868 this.linesProcessed++;
869 if (this.linesProcessed % 1000 == 0) 869 if (this.linesProcessed % 1000 == 0)
870 Utils.yield(); 870 Utils.yield();
871 } 871 }
872 }; 872 };
OLDNEW
« no previous file with comments | « lib/contentPolicy.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld