Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: chrome/common/extensions/docs/templates/intros/events.html

Issue 13523005: Performance guidelines for decl. WebRequest API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/docs/templates/intros/declarativeWebRequest.html ('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 <p> 1 <p>
2 An <code>Event</code> is an object 2 An <code>Event</code> is an object
3 that allows you to be notified 3 that allows you to be notified
4 when something interesting happens. 4 when something interesting happens.
5 Here's an example of using the 5 Here's an example of using the
6 <code>chrome.tabs.onCreated</code> event 6 <code>chrome.tabs.onCreated</code> event
7 to be notified whenever there's a new tab: 7 to be notified whenever there's a new tab:
8 </p> 8 </p>
9 9
10 <pre> 10 <pre>
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 157
158 <pre> 158 <pre>
159 var rule_ids = ["id1", "id2", ...]; 159 var rule_ids = ["id1", "id2", ...];
160 function getRules(rule_ids, function callback(details) {...}); 160 function getRules(rule_ids, function callback(details) {...});
161 </pre> 161 </pre>
162 162
163 <p> 163 <p>
164 The <code>details</code> parameter passed to the <code>callback()</code> functio n 164 The <code>details</code> parameter passed to the <code>callback()</code> functio n
165 refers to an array of rules including filled optional parameters. 165 refers to an array of rules including filled optional parameters.
166 </p> 166 </p>
167
168 <h3 id="performance">Performance</h3>
169
170 <p>
171 To achieve maximum performance, you should keep the following guidelines in
172 mind:
Mike West 2013/04/08 13:52:53 These are excellent tips: I think they'd be even m
battre 2013/04/08 14:42:55 Done.
173 <ul>
174 <li>Register and unregister rules in bulk. After each
175 registration or unregistration, Chrome needs to update internal data
176 structures. This update is an expensive operation.
177 <li>Prefer substring matching over matching using regular expressions in a
178 $ref:events.UrlFilter. Substring based matching is extremely fast.
179 <li>If you have many rules that all share the same actions, you may merge
180 the rules into one because rules trigger their actions as soon as a single
181 condition is fulfilled. This speeds up the matching and reduces memory
182 consumption for duplicate action sets.
183 </ul>
184 </p>
167 </div> 185 </div>
168 {{/is_apps}} 186 {{/is_apps}}
169 187
170 {{^is_apps}} 188 {{^is_apps}}
171 <div class="doc-family extensions"> 189 <div class="doc-family extensions">
172 <h2 id="filtered">Filtered events</h2> 190 <h2 id="filtered">Filtered events</h2>
173 191
174 <p>Filtered events are a mechanism that allows listeners to specify a subset of 192 <p>Filtered events are a mechanism that allows listeners to specify a subset of
175 events that they are interested in. A listener that makes use of a filter won't 193 events that they are interested in. A listener that makes use of a filter won't
176 be invoked for events that don't pass the filter, which makes the listening 194 be invoked for events that don't pass the filter, which makes the listening
(...skipping 26 matching lines...) Expand all
203 of filters that an event supports will be listed in the documentation for that 221 of filters that an event supports will be listed in the documentation for that
204 event in the "filters" section.</p> 222 event in the "filters" section.</p>
205 223
206 <p>When matching URLs (as in the example above), event filters support the same 224 <p>When matching URLs (as in the example above), event filters support the same
207 URL matching capabilities as expressible with a 225 URL matching capabilities as expressible with a
208 $ref:events.UrlFilter, except for scheme and port 226 $ref:events.UrlFilter, except for scheme and port
209 matching.</p> 227 matching.</p>
210 228
211 </div> 229 </div>
212 {{/is_apps}} 230 {{/is_apps}}
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/templates/intros/declarativeWebRequest.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698