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

Unified Diff: tracing/tracing/model/model.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, 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tracing/tracing/model/kernel.html ('k') | tracing/tracing/model/model_test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/model/model.html
diff --git a/tracing/tracing/model/model.html b/tracing/tracing/model/model.html
index 518722b6b06e5922a4d5a5082c62e2e55f2e2ccc..b1164f7ebf79dfa3e670ddd04f3b4ed1c8ad5617 100644
--- a/tracing/tracing/model/model.html
+++ b/tracing/tracing/model/model.html
@@ -119,9 +119,9 @@ tr.exportTo('tr', function() {
getEventByStableId: function(stableId) {
if (this.eventsByStableId_ === undefined) {
this.eventsByStableId_ = {};
- this.iterateAllEvents(function(event) {
+ for (var event of this.getDescendantEvents()) {
this.eventsByStableId_[event.stableId] = event;
- }, this);
+ }
}
return this.eventsByStableId_[stableId];
},
@@ -146,25 +146,12 @@ tr.exportTo('tr', function() {
return this.helpersByConstructorGUID_[constructor.guid];
},
- findTopmostSlicesInThisContainer: function(eventPredicate, callback,
- opt_this) {
- },
-
- childEvents: function*(eventTypePredicate, opt_this) {
- if (eventTypePredicate.call(opt_this, GlobalMemoryDump))
- yield * this.globalMemoryDumps;
-
- if (eventTypePredicate.call(opt_this, GlobalInstantEvent))
- yield * this.instantEvents;
-
- if (eventTypePredicate.call(opt_this, FlowEvent))
- yield * this.flowEvents;
-
- if (eventTypePredicate.call(opt_this, Alert))
- yield * this.alerts;
-
- if (eventTypePredicate.call(opt_this, Sample))
- yield * this.samples;
+ childEvents: function*() {
+ yield * this.globalMemoryDumps;
+ yield * this.instantEvents;
+ yield * this.flowEvents;
+ yield * this.alerts;
+ yield * this.samples;
},
childEventContainers: function*() {
@@ -188,29 +175,22 @@ tr.exportTo('tr', function() {
updateBounds: function() {
this.bounds.reset();
var bounds = this.bounds;
-
- this.iterateAllChildEventContainers(function(ec) {
+ for (var ec of this.childEventContainers()) {
ec.updateBounds();
bounds.addRange(ec.bounds);
- });
- this.iterateAllEventsInThisContainer(
- function(eventConstructor) { return true; },
- function(event) {
- event.addBoundsToRange(bounds);
- });
+ }
+ for (var event of this.childEvents())
+ event.addBoundsToRange(bounds);
},
shiftWorldToZero: function() {
var shiftAmount = -this.bounds.min;
this.timestampShiftToZeroAmount_ = shiftAmount;
- this.iterateAllChildEventContainers(function(ec) {
+ for (var ec of this.childEventContainers())
ec.shiftTimestampsForward(shiftAmount);
- });
- this.iterateAllEventsInThisContainer(
- function(eventConstructor) { return true; },
- function(event) {
- event.start += shiftAmount;
- });
+
+ for (var event of this.childEvents())
+ event.start += shiftAmount;
this.updateBounds();
},
« no previous file with comments | « tracing/tracing/model/kernel.html ('k') | tracing/tracing/model/model_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698