From 25b4f9a68d204b4b6b30c75f9b103ea290c1c734 Mon Sep 17 00:00:00 2001 From: Zeynep Cankara Date: Thu, 16 Jul 2020 20:38:43 +0100 Subject: [PATCH] [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/+/2302894 Reviewed-by: Sathya Gunasekaran Commit-Queue: Zeynep Cankara Cr-Commit-Position: refs/heads/master@{#68918} --- tools/system-analyzer/index.mjs | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/tools/system-analyzer/index.mjs b/tools/system-analyzer/index.mjs index 4acc2f3cd1..b78a02fbb4 100644 --- a/tools/system-analyzer/index.mjs +++ b/tools/system-analyzer/index.mjs @@ -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); }