| Left: | ||
| Right: |
| 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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 /** | 121 /** |
| 122 * The number of subscriptions in the storage. | 122 * The number of subscriptions in the storage. |
| 123 * @type {number} | 123 * @type {number} |
| 124 */ | 124 */ |
| 125 get subscriptionCount() | 125 get subscriptionCount() |
| 126 { | 126 { |
| 127 return this.knownSubscriptions.size; | 127 return this.knownSubscriptions.size; |
| 128 } | 128 } |
| 129 | 129 |
| 130 /** | 130 /** |
| 131 * Adds any subscriptions to which a filter belongs to the filter. | |
| 132 * @param {Filter} filter | |
| 133 */ | |
| 134 addSubscriptionsToFilter(filter) | |
| 135 { | |
| 136 for (let subscription of this.subscriptions()) | |
| 137 { | |
| 138 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:
| |
| 139 filter.addSubscription(subscription); | |
| 140 } | |
| 141 | |
| 142 filter.subscriptionsAssigned = true; | |
| 143 } | |
| 144 | |
| 145 /** | |
| 131 * Finds the filter group that a filter should be added to by default. Will | 146 * Finds the filter group that a filter should be added to by default. Will |
| 132 * return <code>null</code> if this group doesn't exist yet. | 147 * return <code>null</code> if this group doesn't exist yet. |
| 133 * @param {Filter} filter | 148 * @param {Filter} filter |
| 134 * @returns {?SpecialSubscription} | 149 * @returns {?SpecialSubscription} |
| 135 */ | 150 */ |
| 136 getGroupForFilter(filter) | 151 getGroupForFilter(filter) |
| 137 { | 152 { |
| 138 let generalSubscription = null; | 153 let generalSubscription = null; |
| 139 for (let subscription of this.knownSubscriptions.values()) | 154 for (let subscription of this.knownSubscriptions.values()) |
| 140 { | 155 { |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 663 * disconnected from its filters. | 678 * disconnected from its filters. |
| 664 */ | 679 */ |
| 665 function disconnectSubscriptionFilters(subscription) | 680 function disconnectSubscriptionFilters(subscription) |
| 666 { | 681 { |
| 667 if (!filterStorage.knownSubscriptions.has(subscription.url)) | 682 if (!filterStorage.knownSubscriptions.has(subscription.url)) |
| 668 return; | 683 return; |
| 669 | 684 |
| 670 for (let filter of subscription.filters) | 685 for (let filter of subscription.filters) |
| 671 filter.removeSubscription(subscription); | 686 filter.removeSubscription(subscription); |
| 672 } | 687 } |
| OLD | NEW |