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

Unified Diff: tracing/tracing/model/slice.html

Issue 2162963002: [polymer] Merge of master into polymer10-migration (Closed) Base URL: git@github.com:catapult-project/catapult.git@polymer10-migration
Patch Set: Merge polymer10-migration int polymer10-merge 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tracing/tracing/model/process_memory_dump_test.html ('k') | tracing/tracing/model/slice_group.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/model/slice.html
diff --git a/tracing/tracing/model/slice.html b/tracing/tracing/model/slice.html
index 633dcd98611d9c672f4bbaf846eeccfa74a5539c..21df158c6a3b23ff9a71f30cf930627fd04ac0de 100644
--- a/tracing/tracing/model/slice.html
+++ b/tracing/tracing/model/slice.html
@@ -135,17 +135,13 @@ tr.exportTo('tr.model', function() {
* [ D ]
* [C1] [C2]
*/
- findTopmostSlicesRelativeToThisSlice: function(eventPredicate, callback,
- opt_this) {
+ findTopmostSlicesRelativeToThisSlice: function*(eventPredicate) {
if (eventPredicate(this)) {
- callback.call(opt_this, this);
+ yield this;
return;
}
-
- this.subSlices.forEach(function(s) {
- s.findTopmostSlicesRelativeToThisSlice(eventPredicate, callback,
- opt_this);
- });
+ for (var s of this.subSlices)
+ yield * s.findTopmostSlicesRelativeToThisSlice(eventPredicate);
},
/**
@@ -206,29 +202,25 @@ tr.exportTo('tr.model', function() {
/**
* Obtains the parents of a slice, from the most immediate to the root.
*
- * For instance, E.iterateAllAncestors() in the following example:
+ * For instance, E.enumerateAllAncestors() in the following example:
* [ A ]
* [ B][ D ][ G ]
* [C] [E][F] [H]
- * will pass D, then A to the provided callback, in the order from the
- * leaves to the root.
+ * will yield D, then A, in the order from the leaves to the root.
*/
- iterateAllAncestors: function(callback, opt_this) {
+ enumerateAllAncestors: function*() {
var curSlice = this;
while (curSlice.parentSlice) {
curSlice = curSlice.parentSlice;
- callback.call(opt_this, curSlice);
+ yield curSlice;
}
},
get ancestorSlices() {
var res = [];
-
- this.iterateAllAncestors(function(ancestor) {
- res.push(ancestor);
- });
-
+ for (var slice of this.enumerateAllAncestors())
+ res.push(slice);
return res;
},
@@ -263,9 +255,8 @@ tr.exportTo('tr.model', function() {
res.push(this);
- this.iterateAllAncestors(function(aSlice) {
+ for (var aSlice of this.enumerateAllAncestors())
res.push(aSlice);
- });
this.iterateAllSubsequentSlices(function(sSlice) {
res.push(sSlice);
@@ -274,20 +265,17 @@ tr.exportTo('tr.model', function() {
return res;
},
- iterateAllDescendents: function(callback, opt_this) {
- this.subSlices.forEach(callback, opt_this);
- this.subSlices.forEach(function(subSlice) {
- subSlice.iterateAllDescendents(callback, opt_this);
- }, opt_this);
+ enumerateAllDescendents: function*() {
+ for (var slice of this.subSlices)
+ yield slice;
+ for (var slice of this.subSlices)
+ yield * slice.enumerateAllDescendents();
},
get descendentSlices() {
var res = [];
-
- this.iterateAllDescendents(function(des) {
- res.push(des);
- });
-
+ for (var slice of this.enumerateAllDescendents())
+ res.push(slice);
return res;
}
« no previous file with comments | « tracing/tracing/model/process_memory_dump_test.html ('k') | tracing/tracing/model/slice_group.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698