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

Side by Side Diff: tracing/tracing/model/slice_group.html

Issue 2083213002: Change call-sites in trace viewer to use generators instead of iteration functions. (Closed) Base URL: git@github.com:catapult-project/catapult@master
Patch Set: fix nits, rebase Created 4 years, 5 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
« no previous file with comments | « tracing/tracing/model/slice.html ('k') | tracing/tracing/model/slice_test.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright (c) 2013 The Chromium Authors. All rights reserved. 3 Copyright (c) 2013 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be 4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file. 5 found in the LICENSE file.
6 --> 6 -->
7 7
8 <link rel="import" href="/tracing/base/color_scheme.html"> 8 <link rel="import" href="/tracing/base/color_scheme.html">
9 <link rel="import" href="/tracing/base/guid.html"> 9 <link rel="import" href="/tracing/base/guid.html">
10 <link rel="import" href="/tracing/base/sorted_array_utils.html"> 10 <link rel="import" href="/tracing/base/sorted_array_utils.html">
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 }, 268 },
269 269
270 copySlice: function(slice) { 270 copySlice: function(slice) {
271 var newSlice = new this.sliceConstructor(slice.category, slice.title, 271 var newSlice = new this.sliceConstructor(slice.category, slice.title,
272 slice.colorId, slice.start, 272 slice.colorId, slice.start,
273 slice.args, slice.duration, slice.cpuStart, slice.cpuDuration); 273 slice.args, slice.duration, slice.cpuStart, slice.cpuDuration);
274 newSlice.didNotFinish = slice.didNotFinish; 274 newSlice.didNotFinish = slice.didNotFinish;
275 return newSlice; 275 return newSlice;
276 }, 276 },
277 277
278 findTopmostSlicesInThisContainer: function(eventPredicate, callback, 278 findTopmostSlicesInThisContainer: function*(eventPredicate, opt_this) {
279 opt_this) {
280 if (!this.haveTopLevelSlicesBeenBuilt) 279 if (!this.haveTopLevelSlicesBeenBuilt)
281 throw new Error('Nope'); 280 throw new Error('Nope');
282 281
283 this.topLevelSlices.forEach(function(s) { 282 for (var s of this.topLevelSlices)
284 s.findTopmostSlicesRelativeToThisSlice(eventPredicate, callback, 283 yield * s.findTopmostSlicesRelativeToThisSlice(eventPredicate);
285 opt_this);
286 });
287 }, 284 },
288 285
289 childEvents: function*(eventTypePredicate, opt_this) { 286 childEvents: function*() {
290 if (eventTypePredicate.call(opt_this, this.sliceConstructor)) 287 yield * this.slices;
291 yield * this.slices;
292 }, 288 },
293 289
294 childEventContainers: function*() { 290 childEventContainers: function*() {
295 }, 291 },
296 292
297 getSlicesOfName: function(title) { 293 getSlicesOfName: function(title) {
298 var slices = []; 294 var slices = [];
299 for (var i = 0; i < this.slices.length; i++) { 295 for (var i = 0; i < this.slices.length; i++) {
300 if (this.slices[i].title == title) { 296 if (this.slices[i].title == title) {
301 slices.push(this.slices[i]); 297 slices.push(this.slices[i]);
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 closeOpenSlices(); 653 closeOpenSlices();
658 654
659 return result; 655 return result;
660 }; 656 };
661 657
662 return { 658 return {
663 SliceGroup: SliceGroup 659 SliceGroup: SliceGroup
664 }; 660 };
665 }); 661 });
666 </script> 662 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/model/slice.html ('k') | tracing/tracing/model/slice_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698