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

Unified Diff: tracing/tracing/model/helpers/chrome_browser_helper.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 side-by-side diff with in-line comments
Download patch
Index: tracing/tracing/model/helpers/chrome_browser_helper.html
diff --git a/tracing/tracing/model/helpers/chrome_browser_helper.html b/tracing/tracing/model/helpers/chrome_browser_helper.html
index 0e6d295a471f1639c06528ca317fe0c579a3ee9a..90e29feb774afb39f8b8974a4e683174511a6c18 100644
--- a/tracing/tracing/model/helpers/chrome_browser_helper.html
+++ b/tracing/tracing/model/helpers/chrome_browser_helper.html
@@ -56,18 +56,12 @@ tr.exportTo('tr.model.helpers', function() {
},
get hasLatencyEvents() {
- var hasLatency = false;
- this.modelHelper.model.getAllThreads().some(function(thread) {
- thread.iterateAllEvents(function(event) {
- if (!event.isTopLevel)
- return;
- if (!(event instanceof tr.e.cc.InputLatencyAsyncSlice))
- return;
- hasLatency = true;
- });
- return hasLatency;
- });
- return hasLatency;
+ for (var thread of this.modelHelper.model.getAllThreads())
charliea (OOO until 10-5) 2016/06/29 18:08:44 see note earlier: in a CL this big, we should do a
alexandermont 2016/06/29 20:47:11 Done
+ for (var event of thread.descendantEvents())
+ if (event.isTopLevel)
+ if (event instanceof tr.e.cc.InputLatencyAsyncSlice)
+ return true;
+ return false;
},
getLatencyEventsInRange: function(rangeOfInterest) {
@@ -81,10 +75,9 @@ tr.exportTo('tr.model.helpers', function() {
getAllAsyncSlicesMatching: function(pred, opt_this) {
var events = [];
this.iterAllThreads(function(thread) {
- thread.iterateAllEvents(function(slice) {
+ for (var slice of thread.descendantEvents())
if (pred.call(opt_this, slice))
events.push(slice);
- });
});
return events;
},

Powered by Google App Engine
This is Rietveld 408576698