Commit 3899776f authored by danno's avatar danno Committed by Commit bot

[turbolizer] Fix selection bugs and performance problems

Review-Url: https://codereview.chromium.org/2234523002
Cr-Commit-Position: refs/heads/master@{#38520}
parent 6e8a2d27
......@@ -7,10 +7,6 @@
class DisassemblyView extends TextView {
constructor(id, broker, sortedPositionList) {
super(id, broker, null, false);
this.pos_start = -1;
this.pos_lines = null;
this.addr_event_counts = null;
this.total_event_counts = null;
let view = this;
let ADDRESS_STYLE = {
......@@ -153,6 +149,9 @@ class DisassemblyView extends TextView {
initializeCode(sourceText, sourcePosition) {
let view = this;
view.pos_start = -1;
view.addr_event_counts = null;
view.total_event_counts = null;
view.pos_lines = new Array();
// Comment lines for line 0 include sourcePosition already, only need to
// add sourcePosition for lines > 0.
......
......@@ -168,14 +168,16 @@ class TextView extends View {
selectLocations(locations, selected, makeVisible) {
let view = this;
let s = new Set();
for (let l of locations) {
for (let i = 0; i < view.textListNode.children.length; ++i) {
let child = view.textListNode.children[i];
if (child.location != undefined && view.sameLocation(l, child.location)) {
view.selectCommon(child, selected, makeVisible);
s.add(child);
}
}
}
view.selectCommon(s, selected, makeVisible);
}
getRanges(items) {
......@@ -301,7 +303,7 @@ class TextView extends View {
view.selection.select(child, selected);
}
}
} else if (s.length) {
} else if (typeof s[Symbol.iterator] === 'function') {
for (let i of s) {
if (firstSelect) {
makeContainerPosVisible(view.parentNode, i.offsetTop);
......@@ -312,7 +314,6 @@ class TextView extends View {
} else {
if (firstSelect) {
makeContainerPosVisible(view.parentNode, s.offsetTop);
firstSelect = false;
}
view.selection.select(s, selected);
}
......@@ -368,6 +369,7 @@ class TextView extends View {
initializeContent(data, rememberedSelection) {
let view = this;
view.selection.clear();
view.clearText();
view.processText(data);
var fillerSize = document.documentElement.clientHeight -
......
......@@ -168,6 +168,8 @@ document.onload = (function(d3){
try{
jsonObj = JSON.parse(txtRes);
hideCurrentPhase();
sourceView.initializeCode(jsonObj.source, jsonObj.sourcePosition);
disassemblyView.initializeCode(jsonObj.source, jsonObj.sourcePosition);
schedule.setNodePositionMap(jsonObj.nodePositions);
......
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