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

Unified Diff: tracing/tracing/model/cpu.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/cpu.html
diff --git a/tracing/tracing/model/cpu.html b/tracing/tracing/model/cpu.html
index 0ded8a7a76a8139699ca99a024ebf97f2d9fb8fe..32ad367ffed1b6798ffeb8de50898b50abe11568 100644
--- a/tracing/tracing/model/cpu.html
+++ b/tracing/tracing/model/cpu.html
@@ -51,7 +51,7 @@ tr.exportTo('tr.model', function() {
};
Cpu.prototype = {
- __proto__: tr.model.ProcessBase.prototype,
+ __proto__: tr.model.EventContainer.prototype,
get samples() {
return this.samples_;
@@ -61,23 +61,23 @@ tr.exportTo('tr.model', function() {
return 'CPU ' + this.cpuNumber;
},
- findTopmostSlicesInThisContainer: function(eventPredicate, callback,
- opt_this) {
+ // Inherit these functions from EventContainer, since this isn't
charliea (OOO until 10-5) 2016/06/29 18:08:44 nit: this comment no longer applies, right?
alexandermont 2016/06/29 20:47:11 That is correct. Removed comment
+ // actually a subclass of EventContainer but we need to treat
+ // it like one for iteration methods.
+
+ findTopmostSlicesInThisContainer: function*(eventPredicate, opt_this) {
// All CpuSlices are toplevel since CpuSlices do not nest.
- this.slices.forEach(function(s) {
- s.findTopmostSlicesRelativeToThisSlice(eventPredicate, callback,
- opt_this);
- });
+ for (var s of slices) {
+ yield * s.findTopmostSlicesRelativeToThisSlice(
+ eventPredicate, opt_this);
+ }
},
- childEvents: function*(eventTypePredicate, opt_this) {
- if (eventTypePredicate.call(opt_this, tr.model.CpuSlice))
- yield * this.slices;
+ childEvents: function*() {
+ yield * this.slices;
- if (this.samples_) {
- if (eventTypePredicate.call(opt_this, tr.model.Sample))
- yield * this.samples_;
- }
+ if (this.samples_)
+ yield * this.samples_;
},
childEventContainers: function*() {

Powered by Google App Engine
This is Rietveld 408576698