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

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

Issue 2776653002: [ESLint] Fix violations when enabling curly rule in eslint. (Closed)
Patch Set: rebase Created 3 years, 9 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/event_registry.html ('k') | tracing/tracing/model/event_set_test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/model/event_set.html
diff --git a/tracing/tracing/model/event_set.html b/tracing/tracing/model/event_set.html
index d2dfd526045b75dfeab19e9d9cb081a52531fb0f..c4e88de539f679e1628ffebed63af9d61953f752 100644
--- a/tracing/tracing/model/event_set.html
+++ b/tracing/tracing/model/event_set.html
@@ -31,8 +31,9 @@ tr.exportTo('tr.model', function() {
if (opt_events) {
if (opt_events instanceof Array) {
- for (var event of opt_events)
+ for (var event of opt_events) {
this.push(event);
+ }
} else if (opt_events instanceof EventSet) {
this.addEventSet(opt_events);
} else {
@@ -49,8 +50,7 @@ tr.exportTo('tr.model', function() {
},
get duration() {
- if (this.bounds_.isEmpty)
- return 0;
+ if (this.bounds_.isEmpty) return 0;
return this.bounds_.max - this.bounds_.min;
},
@@ -63,8 +63,9 @@ tr.exportTo('tr.model', function() {
},
* [Symbol.iterator]() {
- for (var event of this.events_)
+ for (var event of this.events_) {
yield event;
+ }
},
clear: function() {
@@ -79,17 +80,20 @@ tr.exportTo('tr.model', function() {
push: function(...events) {
var numPushed;
for (var event of events) {
- if (event.guid === undefined)
+ if (event.guid === undefined) {
throw new Error('Event must have a GUID');
+ }
if (!this.events_.has(event)) {
this.events_.add(event);
// Some uses of eventSet (e.g. in tests) have Events as objects that
// don't have addBoundsToRange as a function. Thus we need to handle
// this case.
- if (event.addBoundsToRange)
- if (this.bounds_ !== undefined)
+ if (event.addBoundsToRange) {
+ if (this.bounds_ !== undefined) {
event.addBoundsToRange(this.bounds_);
+ }
+ }
}
numPushed++;
}
@@ -97,14 +101,14 @@ tr.exportTo('tr.model', function() {
},
contains: function(event) {
- if (this.events_.has(event))
- return event;
+ if (this.events_.has(event)) return event;
return undefined;
},
addEventSet: function(eventSet) {
- for (var event of eventSet)
+ for (var event of eventSet) {
this.push(event);
+ }
},
intersectionIsEmpty: function(otherEventSet) {
@@ -112,8 +116,7 @@ tr.exportTo('tr.model', function() {
},
equals: function(that) {
- if (this.length !== that.length)
- return false;
+ if (this.length !== that.length) return false;
return this.every(event => that.contains(event));
},
@@ -123,8 +126,9 @@ tr.exportTo('tr.model', function() {
ary.sort(compare);
this.clear();
- for (var event of ary)
+ for (var event of ary) {
this.push(event);
+ }
},
getEventsOrganizedByBaseType: function(opt_pruneEmpty) {
@@ -135,8 +139,8 @@ tr.exportTo('tr.model', function() {
var maxEventTypeInfo = undefined;
allTypeInfos.forEach(function(eventTypeInfo, eventIndex) {
- if (!(event instanceof eventTypeInfo.constructor))
- return;
+ if (!(event instanceof eventTypeInfo.constructor)) return;
+
if (eventIndex > maxEventIndex) {
maxEventIndex = eventIndex;
maxEventTypeInfo = eventTypeInfo;
@@ -152,8 +156,9 @@ tr.exportTo('tr.model', function() {
if (!opt_pruneEmpty) {
allTypeInfos.forEach(function(eventTypeInfo) {
- if (events[eventTypeInfo.metadata.name] === undefined)
+ if (events[eventTypeInfo.metadata.name] === undefined) {
events[eventTypeInfo.metadata.name] = new EventSet();
+ }
});
}
@@ -162,8 +167,9 @@ tr.exportTo('tr.model', function() {
getEventsOrganizedByTitle: function() {
return this.getEventsOrganizedByCallback(function(event) {
- if (event.title === undefined)
+ if (event.title === undefined) {
throw new Error('An event didn\'t have a title!');
+ }
return event.title;
});
},
@@ -179,9 +185,11 @@ tr.exportTo('tr.model', function() {
},
enumEventsOfType: function(type, func) {
- for (var event of this)
- if (event instanceof type)
+ for (var event of this) {
+ if (event instanceof type) {
func(event);
+ }
+ }
},
get userFriendlyName() {
@@ -208,50 +216,60 @@ tr.exportTo('tr.model', function() {
filter: function(fn, opt_this) {
var res = new EventSet();
- for (var event of this)
- if (fn.call(opt_this, event))
+ for (var event of this) {
+ if (fn.call(opt_this, event)) {
res.push(event);
+ }
+ }
return res;
},
toArray: function() {
var ary = [];
- for (var event of this)
+ for (var event of this) {
ary.push(event);
+ }
return ary;
},
forEach: function(fn, opt_this) {
- for (var event of this)
+ for (var event of this) {
fn.call(opt_this, event);
+ }
},
map: function(fn, opt_this) {
var res = [];
- for (var event of this)
+ for (var event of this) {
res.push(fn.call(opt_this, event));
+ }
return res;
},
every: function(fn, opt_this) {
- for (var event of this)
- if (!fn.call(opt_this, event))
+ for (var event of this) {
+ if (!fn.call(opt_this, event)) {
return false;
+ }
+ }
return true;
},
some: function(fn, opt_this) {
- for (var event of this)
- if (fn.call(opt_this, event))
+ for (var event of this) {
+ if (fn.call(opt_this, event)) {
return true;
+ }
+ }
return false;
},
asDict: function() {
var stableIds = [];
- for (var event of this)
+ for (var event of this) {
stableIds.push(event.stableId);
+ }
return {'events': stableIds};
},
« no previous file with comments | « tracing/tracing/model/event_registry.html ('k') | tracing/tracing/model/event_set_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698