Commit 022b2d49 authored by Franziska Hinkelmann's avatar Franziska Hinkelmann Committed by Commit Bot

[profview] Use identity operator

Use !== instead of !=.

Bug: 
Change-Id: I3f8127d54b80973f9ea7bb6ddf25afd928cb3045
Reviewed-on: https://chromium-review.googlesource.com/753733Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Franziska Hinkelmann <franzih@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49210}
parent ba76ad68
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
"use strict" "use strict";
let codeKinds = [ let codeKinds = [
"UNKNOWN", "UNKNOWN",
...@@ -80,13 +80,13 @@ function resolveCodeKindAndVmState(code, vmState) { ...@@ -80,13 +80,13 @@ function resolveCodeKindAndVmState(code, vmState) {
function codeEquals(code1, code2, allowDifferentKinds = false) { function codeEquals(code1, code2, allowDifferentKinds = false) {
if (!code1 || !code2) return false; if (!code1 || !code2) return false;
if (code1.name != code2.name || code1.type != code2.type) return false; if (code1.name !== code2.name || code1.type !== code2.type) return false;
if (code1.type == 'CODE') { if (code1.type === 'CODE') {
if (!allowDifferentKinds && code1.kind != code2.kind) return false; if (!allowDifferentKinds && code1.kind !== code2.kind) return false;
} else if (code1.type == 'JS') { } else if (code1.type === 'JS') {
if (!allowDifferentKinds && code1.kind != code2.kind) return false; if (!allowDifferentKinds && code1.kind !== code2.kind) return false;
if (code1.func != code2.func) return false; if (code1.func !== code2.func) return false;
} }
return true; return true;
} }
...@@ -409,7 +409,7 @@ class CategorySampler { ...@@ -409,7 +409,7 @@ class CategorySampler {
let { tm : timestamp, vm : vmState, s : stack } = file.ticks[tickIndex]; let { tm : timestamp, vm : vmState, s : stack } = file.ticks[tickIndex];
let i = Math.floor((timestamp - this.firstTime) / this.step); let i = Math.floor((timestamp - this.firstTime) / this.step);
if (i == this.buckets.length) i--; if (i === this.buckets.length) i--;
console.assert(i >= 0 && i < this.buckets.length); console.assert(i >= 0 && i < this.buckets.length);
let bucket = this.buckets[i]; let bucket = this.buckets[i];
...@@ -440,7 +440,7 @@ class FunctionTimelineProcessor { ...@@ -440,7 +440,7 @@ class FunctionTimelineProcessor {
// ignoring any filtered entries. // ignoring any filtered entries.
let stackCode = undefined; let stackCode = undefined;
let functionPosInStack = -1; let functionPosInStack = -1;
let filteredI = 0 let filteredI = 0;
for (let i = 0; i < stack.length - 1; i += 2) { for (let i = 0; i < stack.length - 1; i += 2) {
let codeId = stack[i]; let codeId = stack[i];
let code = codeId >= 0 ? file.code[codeId] : undefined; let code = codeId >= 0 ? file.code[codeId] : undefined;
...@@ -461,7 +461,7 @@ class FunctionTimelineProcessor { ...@@ -461,7 +461,7 @@ class FunctionTimelineProcessor {
if (functionPosInStack >= 0) { if (functionPosInStack >= 0) {
let stackKind = resolveCodeKindAndVmState(stackCode, vmState); let stackKind = resolveCodeKindAndVmState(stackCode, vmState);
let codeIsTopOfStack = (functionPosInStack == 0); let codeIsTopOfStack = (functionPosInStack === 0);
if (this.currentBlock !== null) { if (this.currentBlock !== null) {
this.currentBlock.end = timestamp; this.currentBlock.end = timestamp;
......
...@@ -49,7 +49,7 @@ let main = { ...@@ -49,7 +49,7 @@ let main = {
currentState : emptyState(), currentState : emptyState(),
setMode(mode) { setMode(mode) {
if (mode != main.currentState.mode) { if (mode !== main.currentState.mode) {
function setCallTreeModifiers(attribution, categories, sort) { function setCallTreeModifiers(attribution, categories, sort) {
let callTreeState = Object.assign({}, main.currentState.callTree); let callTreeState = Object.assign({}, main.currentState.callTree);
...@@ -84,7 +84,7 @@ let main = { ...@@ -84,7 +84,7 @@ let main = {
}, },
setCallTreeAttribution(attribution) { setCallTreeAttribution(attribution) {
if (attribution != main.currentState.attribution) { if (attribution !== main.currentState.attribution) {
let callTreeState = Object.assign({}, main.currentState.callTree); let callTreeState = Object.assign({}, main.currentState.callTree);
callTreeState.attribution = attribution; callTreeState.attribution = attribution;
main.currentState = setCallTreeState(main.currentState, callTreeState); main.currentState = setCallTreeState(main.currentState, callTreeState);
...@@ -93,7 +93,7 @@ let main = { ...@@ -93,7 +93,7 @@ let main = {
}, },
setCallTreeSort(sort) { setCallTreeSort(sort) {
if (sort != main.currentState.sort) { if (sort !== main.currentState.sort) {
let callTreeState = Object.assign({}, main.currentState.callTree); let callTreeState = Object.assign({}, main.currentState.callTree);
callTreeState.sort = sort; callTreeState.sort = sort;
main.currentState = setCallTreeState(main.currentState, callTreeState); main.currentState = setCallTreeState(main.currentState, callTreeState);
...@@ -102,7 +102,7 @@ let main = { ...@@ -102,7 +102,7 @@ let main = {
}, },
setCallTreeCategories(categories) { setCallTreeCategories(categories) {
if (categories != main.currentState.categories) { if (categories !== main.currentState.categories) {
let callTreeState = Object.assign({}, main.currentState.callTree); let callTreeState = Object.assign({}, main.currentState.callTree);
callTreeState.categories = categories; callTreeState.categories = categories;
main.currentState = setCallTreeState(main.currentState, callTreeState); main.currentState = setCallTreeState(main.currentState, callTreeState);
...@@ -111,8 +111,8 @@ let main = { ...@@ -111,8 +111,8 @@ let main = {
}, },
setViewInterval(start, end) { setViewInterval(start, end) {
if (start != main.currentState.start || if (start !== main.currentState.start ||
end != main.currentState.end) { end !== main.currentState.end) {
main.currentState = Object.assign({}, main.currentState); main.currentState = Object.assign({}, main.currentState);
main.currentState.start = start; main.currentState.start = start;
main.currentState.end = end; main.currentState.end = end;
...@@ -121,8 +121,8 @@ let main = { ...@@ -121,8 +121,8 @@ let main = {
}, },
setTimeLineDimensions(width, height) { setTimeLineDimensions(width, height) {
if (width != main.currentState.timeLine.width || if (width !== main.currentState.timeLine.width ||
height != main.currentState.timeLine.height) { height !== main.currentState.timeLine.height) {
let timeLine = Object.assign({}, main.currentState.timeLine); let timeLine = Object.assign({}, main.currentState.timeLine);
timeLine.width = width; timeLine.width = width;
timeLine.height = height; timeLine.height = height;
...@@ -133,7 +133,7 @@ let main = { ...@@ -133,7 +133,7 @@ let main = {
}, },
setFile(file) { setFile(file) {
if (file != main.currentState.file) { if (file !== main.currentState.file) {
main.currentState = Object.assign({}, main.currentState); main.currentState = Object.assign({}, main.currentState);
main.currentState.file = file; main.currentState.file = file;
main.delayRender(); main.delayRender();
...@@ -141,7 +141,7 @@ let main = { ...@@ -141,7 +141,7 @@ let main = {
}, },
setCurrentCode(codeId) { setCurrentCode(codeId) {
if (codeId != main.currentState.currentCodeId) { if (codeId !== main.currentState.currentCodeId) {
main.currentState = Object.assign({}, main.currentState); main.currentState = Object.assign({}, main.currentState);
main.currentState.currentCodeId = codeId; main.currentState.currentCodeId = codeId;
main.delayRender(); main.delayRender();
...@@ -235,7 +235,7 @@ let bucketDescriptors = ...@@ -235,7 +235,7 @@ let bucketDescriptors =
text : "Unknown" } text : "Unknown" }
]; ];
let kindToBucketDescriptor = {} let kindToBucketDescriptor = {};
for (let i = 0; i < bucketDescriptors.length; i++) { for (let i = 0; i < bucketDescriptors.length; i++) {
let bucket = bucketDescriptors[i]; let bucket = bucketDescriptors[i];
for (let j = 0; j < bucket.kinds.length; j++) { for (let j = 0; j < bucket.kinds.length; j++) {
...@@ -335,11 +335,11 @@ function createTableExpander(indent) { ...@@ -335,11 +335,11 @@ function createTableExpander(indent) {
} }
function createFunctionNode(name, codeId) { function createFunctionNode(name, codeId) {
if (codeId == -1) { if (codeId === -1) {
return document.createTextNode(name); return document.createTextNode(name);
} }
let nameElement = document.createElement("span"); let nameElement = document.createElement("span");
nameElement.classList.add("codeid-link") nameElement.classList.add("codeid-link");
nameElement.onclick = function() { nameElement.onclick = function() {
main.setCurrentCode(codeId); main.setCurrentCode(codeId);
}; };
...@@ -377,13 +377,13 @@ class CallTreeView { ...@@ -377,13 +377,13 @@ class CallTreeView {
if (c1.ticks < c2.ticks) return 1; if (c1.ticks < c2.ticks) return 1;
else if (c1.ticks > c2.ticks) return -1; else if (c1.ticks > c2.ticks) return -1;
return c2.ownTicks - c1.ownTicks; return c2.ownTicks - c1.ownTicks;
} };
case "own-time": case "own-time":
return (c1, c2) => { return (c1, c2) => {
if (c1.ownTicks < c2.ownTicks) return 1; if (c1.ownTicks < c2.ownTicks) return 1;
else if (c1.ownTicks > c2.ownTicks) return -1; else if (c1.ownTicks > c2.ownTicks) return -1;
return c2.ticks - c1.ticks; return c2.ticks - c1.ticks;
} };
case "category-time": case "category-time":
return (c1, c2) => { return (c1, c2) => {
if (c1.type === c2.type) return c2.ticks - c1.ticks; if (c1.type === c2.type) return c2.ticks - c1.ticks;
...@@ -439,7 +439,7 @@ class CallTreeView { ...@@ -439,7 +439,7 @@ class CallTreeView {
let row = this.rows.insertRow(index); let row = this.rows.insertRow(index);
row.id = id + i + "/"; row.id = id + i + "/";
if (node.type != "CAT") { if (node.type !== "CAT") {
row.style.backgroundColor = bucketFromKind(node.type).backgroundColor; row.style.backgroundColor = bucketFromKind(node.type).backgroundColor;
} }
...@@ -631,7 +631,7 @@ class CallTreeView { ...@@ -631,7 +631,7 @@ class CallTreeView {
} else { } else {
console.assert(mode === "bottom-up"); console.assert(mode === "bottom-up");
if (this.currentState.callTree.categories == "none") { if (this.currentState.callTree.categories === "none") {
stackProcessor = stackProcessor =
new PlainCallTreeProcessor(filter, true); new PlainCallTreeProcessor(filter, true);
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment