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

Side by Side Diff: lib/filterListener.js

Issue 29936555: Issue 7098 - Avoid writing to disk on each filter hit (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Nov. 4, 2018, 11:15 p.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 | « no previous file | 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-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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 FilterListener.setDirty(1); 276 FilterListener.setDirty(1);
277 277
278 if (!subscription.disabled && 278 if (!subscription.disabled &&
279 filterStorage.knownSubscriptions.has(subscription.url)) 279 filterStorage.knownSubscriptions.has(subscription.url))
280 { 280 {
281 oldFilters.forEach(removeFilter); 281 oldFilters.forEach(removeFilter);
282 addFilters(subscription.filters); 282 addFilters(subscription.filters);
283 } 283 }
284 } 284 }
285 285
286 function onFilterHitCount(filter, newValue) 286 function onFilterHitCount(filter, newValue, oldValue)
287 { 287 {
288 if (newValue == 0) 288 if (newValue == 0 && oldValue != 0)
289 FilterListener.setDirty(0); 289 FilterListener.setDirty(0);
290 else 290 else
291 FilterListener.setDirty(0.002); 291 FilterListener.setDirty(0.002);
292 } 292 }
293 293
294 function onFilterLastHit() 294 function onFilterLastHit()
295 { 295 {
296 FilterListener.setDirty(0.002); 296 FilterListener.setDirty(0.002);
297 } 297 }
298 298
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 { 340 {
341 if (!subscription.disabled) 341 if (!subscription.disabled)
342 addFilters(subscription.filters); 342 addFilters(subscription.filters);
343 } 343 }
344 } 344 }
345 345
346 function onSave() 346 function onSave()
347 { 347 {
348 isDirty = 0; 348 isDirty = 0;
349 } 349 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld