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

Side by Side Diff: lib/filterListener.js

Issue 4875173639487488: Optmize filter list in elemHide.js for memory usage (Closed)
Patch Set: So I think I found a good solution. In filterListener.js we already have the concept of flushing el… Created May 5, 2014, 3:47 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 | « lib/elemHide.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 <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 TimeLine.leave("Filter listener initialization done"); 134 TimeLine.leave("Filter listener initialization done");
135 } 135 }
136 init(); 136 init();
137 137
138 /** 138 /**
139 * Calls ElemHide.apply() if necessary. 139 * Calls ElemHide.apply() if necessary.
140 */ 140 */
141 function flushElemHide() 141 function flushElemHide()
142 { 142 {
143 ElemHide.compact();
143 if (!batchMode && ElemHide.isDirty) 144 if (!batchMode && ElemHide.isDirty)
144 ElemHide.apply(); 145 ElemHide.apply();
145 } 146 }
146 147
147 /** 148 /**
148 * Notifies Matcher instances or ElemHide object about a new filter 149 * Notifies Matcher instances or ElemHide object about a new filter
149 * if necessary. 150 * if necessary.
150 * @param {Filter} filter filter that has been added 151 * @param {Filter} filter filter that has been added
151 */ 152 */
152 function addFilter(filter) 153 function addFilter(filter)
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 defaultMatcher.clear(); 269 defaultMatcher.clear();
269 ElemHide.clear(); 270 ElemHide.clear();
270 for (let subscription of FilterStorage.subscriptions) 271 for (let subscription of FilterStorage.subscriptions)
271 if (!subscription.disabled) 272 if (!subscription.disabled)
272 subscription.filters.forEach(addFilter); 273 subscription.filters.forEach(addFilter);
273 flushElemHide(); 274 flushElemHide();
274 } 275 }
275 else if (action == "save") 276 else if (action == "save")
276 isDirty = 0; 277 isDirty = 0;
277 } 278 }
OLDNEW
« no previous file with comments | « lib/elemHide.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld