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

Unified Diff: lib/filterStorage.js

Issue 29935568: Issue 7096 - Make it possible to lazy initialize a filter's subscriptions (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Small update Created Nov. 3, 2018, 9:34 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
« lib/filterClasses.js ('K') | « lib/filterListener.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/filterStorage.js
===================================================================
--- a/lib/filterStorage.js
+++ b/lib/filterStorage.js
@@ -123,16 +123,31 @@
* @type {number}
*/
get subscriptionCount()
{
return this.knownSubscriptions.size;
}
/**
+ * Adds any subscriptions to which a filter belongs to the filter.
+ * @param {Filter} filter
+ */
+ addSubscriptionsToFilter(filter)
+ {
+ for (let subscription of this.subscriptions())
+ {
+ if (subscription.filters.indexOf(filter) != -1)
hub 2018/11/10 04:33:21 this is quite an expensive search, isn't it?
Manish Jethani 2018/11/15 22:58:52 Yes, so here's the thing: 1. This function will
hub 2018/11/16 17:04:39 So shall we make sure the review 29934588 lands fi
Manish Jethani 2018/11/17 19:49:17 OK, let's do this one first instead, it's easier:
+ filter.addSubscription(subscription);
+ }
+
+ filter.subscriptionsAssigned = true;
+ }
+
+ /**
* Finds the filter group that a filter should be added to by default. Will
* return <code>null</code> if this group doesn't exist yet.
* @param {Filter} filter
* @returns {?SpecialSubscription}
*/
getGroupForFilter(filter)
{
let generalSubscription = null;
« lib/filterClasses.js ('K') | « lib/filterListener.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld