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

Side by Side Diff: tracing/tracing/model/async_slice.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 break/continue Created 4 years, 6 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
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/extension_registry.html"> 8 <link rel="import" href="/tracing/base/extension_registry.html">
9 <link rel="import" href="/tracing/model/timed_event.html"> 9 <link rel="import" href="/tracing/model/timed_event.html">
10 <link rel="import" href="/tracing/value/unit.html"> 10 <link rel="import" href="/tracing/value/unit.html">
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 return 'Async slice ' + this.title + ' at ' + 96 return 'Async slice ' + this.title + ' at ' +
97 tr.v.Unit.byName.timeStampInMs.format(this.start); 97 tr.v.Unit.byName.timeStampInMs.format(this.start);
98 }, 98 },
99 99
100 get stableId() { 100 get stableId() {
101 var parentAsyncSliceGroup = this.parentContainer.asyncSliceGroup; 101 var parentAsyncSliceGroup = this.parentContainer.asyncSliceGroup;
102 return parentAsyncSliceGroup.stableId + '.' + 102 return parentAsyncSliceGroup.stableId + '.' +
103 parentAsyncSliceGroup.slices.indexOf(this); 103 parentAsyncSliceGroup.slices.indexOf(this);
104 }, 104 },
105 105
106 findTopmostSlicesRelativeToThisSlice: function(eventPredicate, callback, 106 findTopmostSlicesRelativeToThisSlice: function*(eventPredicate, opt_this) {
charliea (OOO until 10-5) 2016/06/29 18:08:44 What a weird function...
alexandermont 2016/06/29 20:47:11 Acknowledged, although I'm just translating the fu
107 opt_this) { 107 if (eventPredicate(this)) {
108 if (eventPredicate(this)) 108 yield this;
109 callback.call(opt_this, this); 109 return;
110 else {
111 this.subSlices.forEach(function(s) {
112 s.findTopmostSlicesRelativeToThisSlice(eventPredicate, callback,
113 opt_this);
114 });
115 } 110 }
111 for (var s of this.subSlices)
112 yield * s.findTopmostSlicesRelativeToThisSlice(eventPredicate);
116 }, 113 },
117 114
118 findDescendentSlice: function(targetTitle) { 115 findDescendentSlice: function(targetTitle) {
119 if (!this.subSlices) 116 if (!this.subSlices)
120 return undefined; 117 return undefined;
121 118
122 for (var i = 0; i < this.subSlices.length; i++) { 119 for (var i = 0; i < this.subSlices.length; i++) {
123 if (this.subSlices[i].title == targetTitle) 120 if (this.subSlices[i].title == targetTitle)
124 return this.subSlices[i]; 121 return this.subSlices[i];
125 var slice = this.subSlices[i].findDescendentSlice(targetTitle); 122 var slice = this.subSlices[i].findDescendentSlice(targetTitle);
(...skipping 28 matching lines...) Expand all
154 tr.b.TYPE_BASED_REGISTRY_MODE); 151 tr.b.TYPE_BASED_REGISTRY_MODE);
155 options.mandatoryBaseClass = AsyncSlice; 152 options.mandatoryBaseClass = AsyncSlice;
156 options.defaultConstructor = AsyncSlice; 153 options.defaultConstructor = AsyncSlice;
157 tr.b.decorateExtensionRegistry(AsyncSlice, options); 154 tr.b.decorateExtensionRegistry(AsyncSlice, options);
158 155
159 return { 156 return {
160 AsyncSlice: AsyncSlice 157 AsyncSlice: AsyncSlice
161 }; 158 };
162 }); 159 });
163 </script> 160 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698