Commit 25b4f9a6 authored by Zeynep Cankara's avatar Zeynep Cankara Committed by Commit Bot

[tools][system-analyzer] Remove duplicate states in App

This CL removes the duplicated code for handling global
state of the app. Increases readability of the app
class.

Bug: v8:10673, v8:10644

Change-Id: I08e0bfdc67e023264fce22a96bfd3ef94644e70c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2302894Reviewed-by: 's avatarSathya Gunasekaran  <gsathya@chromium.org>
Commit-Queue: Zeynep Cankara <zcankara@google.com>
Cr-Commit-Position: refs/heads/master@{#68918}
parent 7887ae6f
......@@ -16,7 +16,6 @@ class App {
this.timelinePanelId_ = timelinePanelId;
this.icPanelId_ = icPanelId;
this.icPanel_ = this.$(icPanelId);
this.state_ = Object.create(null);
document.addEventListener('keydown', e => this.handleKeyDown(e));
}
......@@ -56,17 +55,6 @@ class App {
}
}
// Update application state
updateDocumentState(){
document.state = this.state_.state;
try {
document.state.timeline = this.state_.timeline;
} catch (error) {
console.log(error);
console.log("cannot assign timeline to state!");
}
}
// Map event log processing
handleLoadTextMapProcessor(text) {
let mapProcessor = new MapProcessor();
......@@ -93,9 +81,12 @@ class App {
this.$('#container').style.display = 'block';
// instantiate the app logic
let fileData = e.detail;
this.state_.state = new State('#map-panel','#timeline-panel');
this.state_.timeline = this.handleLoadTextMapProcessor(fileData.chunk);
this.updateDocumentState();
document.state = new State(this.mapPanelId_, this.timelinePanelId_);
try {
document.state.timeline = this.handleLoadTextMapProcessor(fileData.chunk);
} catch (error) {
console.log(error);
}
this.loadICLogFile(fileData);
}
......
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