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

Unified Diff: tracing/tracing/importer/context_processor.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/extras/vsync/vsync_auditor_test.html ('k') | tracing/tracing/importer/empty_importer.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/importer/context_processor.html
diff --git a/tracing/tracing/importer/context_processor.html b/tracing/tracing/importer/context_processor.html
index dae983fa97f912c572f6a163333ac5d5bc7a495f..b02d04a4b4cc88a53f2160ef72bfd20eed93c79a 100644
--- a/tracing/tracing/importer/context_processor.html
+++ b/tracing/tracing/importer/context_processor.html
@@ -82,8 +82,9 @@ tr.exportTo('tr.importer', function() {
// If we left this context, remove it from the active set and
// restore any previous context of the same type.
var previousContext = this.popContext_(oldContext.type);
- if (previousContext)
+ if (previousContext) {
newActiveContexts.push(previousContext);
+ }
} else {
newActiveContexts.push(oldContext);
}
@@ -101,8 +102,9 @@ tr.exportTo('tr.importer', function() {
}
};
var key = this.getContextKey_(context);
- if (key in this.contextCache_)
+ if (key in this.contextCache_) {
return this.contextCache_[key];
+ }
this.contextCache_[key] = context;
var snapshotKey = this.getSnapshotKey_(scopedId);
this.seenSnapshots_[snapshotKey] = true;
@@ -110,14 +112,16 @@ tr.exportTo('tr.importer', function() {
},
pushContext_: function(context) {
- if (!(context.type in this.stackPerType_))
+ if (!(context.type in this.stackPerType_)) {
this.stackPerType_[context.type] = [];
+ }
this.stackPerType_[context.type].push(context);
},
popContext_: function(contextType) {
- if (!(contextType in this.stackPerType_))
+ if (!(contextType in this.stackPerType_)) {
return undefined;
+ }
return this.stackPerType_[contextType].pop();
},
@@ -141,8 +145,9 @@ tr.exportTo('tr.importer', function() {
// reduce memory usage.
if (this.cachedEntryForActiveContexts_ === undefined) {
var key = [];
- for (var context of this.activeContexts_)
+ for (var context of this.activeContexts_) {
key.push(this.getContextKey_(context));
+ }
key.sort();
key = key.join('\x00');
if (key in this.contextSetCache_) {
@@ -151,10 +156,12 @@ tr.exportTo('tr.importer', function() {
this.activeContexts_.sort(function(a, b) {
var keyA = this.getContextKey_(a);
var keyB = this.getContextKey_(b);
- if (keyA < keyB)
+ if (keyA < keyB) {
return -1;
- if (keyA > keyB)
+ }
+ if (keyA > keyB) {
return 1;
+ }
return 0;
}.bind(this));
this.contextSetCache_[key] = Object.freeze(this.activeContexts_);
@@ -166,16 +173,17 @@ tr.exportTo('tr.importer', function() {
invalidateContextCacheForSnapshot: function(scopedId) {
var snapshotKey = this.getSnapshotKey_(scopedId);
- if (!(snapshotKey in this.seenSnapshots_))
- return;
+ if (!(snapshotKey in this.seenSnapshots_)) return;
+
this.contextCache_ = {};
this.contextSetCache_ = {};
this.cachedEntryForActiveContexts_ = undefined;
this.activeContexts_ = this.activeContexts_.map(function(context) {
// Do not alter unrelated contexts.
if (context.snapshot.scope !== scopedId.scope ||
- context.snapshot.idRef !== scopedId.id)
+ context.snapshot.idRef !== scopedId.id) {
return context;
+ }
// Replace the invalidated context by a deep copy.
return {
type: context.type,
« no previous file with comments | « tracing/tracing/extras/vsync/vsync_auditor_test.html ('k') | tracing/tracing/importer/empty_importer.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698