Commit ca3f16d0 authored by Zeynep Cankara's avatar Zeynep Cankara Committed by Commit Bot

[tools][system-analyzer] Timeline track dblclick for selecting entries

Add functionality to emit an event upon double
clicking on an event type on the timeline track
selected entries panel.

Bug: v8:10644

Change-Id: I54d4397abfeab471f01c2b24bae4eb1ff705afcd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2328787Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Zeynep Cankara <zcankara@google.com>
Cr-Commit-Position: refs/heads/master@{#69222}
parent 967773dc
...@@ -71,9 +71,9 @@ defineCustomElement('./timeline/timeline-track', (templateText) => ...@@ -71,9 +71,9 @@ defineCustomElement('./timeline/timeline-track', (templateText) =>
let unique = new Map(); let unique = new Map();
for (const entry of this.data.all) { for (const entry of this.data.all) {
if(!unique.has(entry.type)) { if(!unique.has(entry.type)) {
unique.set(entry.type, 1); unique.set(entry.type, [entry]);
} else { } else {
unique.set(entry.type, unique.get(entry.type) + 1); unique.get(entry.type).push(entry);
} }
} }
this.renderStatsWindow(unique); this.renderStatsWindow(unique);
...@@ -84,20 +84,31 @@ defineCustomElement('./timeline/timeline-track', (templateText) => ...@@ -84,20 +84,31 @@ defineCustomElement('./timeline/timeline-track', (templateText) =>
this.removeAllChildren(timelineLegendContent); this.removeAllChildren(timelineLegendContent);
let fragment = document.createDocumentFragment(); let fragment = document.createDocumentFragment();
let colorIterator = 0; let colorIterator = 0;
unique.forEach((key, val) => { unique.forEach((entries, type) => {
let dt = document.createElement("dt"); let dt = document.createElement("dt");
dt.innerHTML = key; dt.innerHTML = entries.length;
dt.style.backgroundColor = transitionTypeToColor(val); dt.style.backgroundColor = transitionTypeToColor(type);
dt.style.color = CSSColor.surfaceColor; dt.style.color = CSSColor.surfaceColor;
fragment.appendChild(dt); fragment.appendChild(dt);
let dd = document.createElement("dd"); let dd = document.createElement("dd");
dd.innerHTML = val; dd.innerHTML = type;
dd.entries = entries;
dd.addEventListener('dblclick', e => this.handleEntryTypeDblClick(e));
fragment.appendChild(dd); fragment.appendChild(dd);
colorIterator += 1; colorIterator += 1;
}); });
timelineLegendContent.appendChild(fragment); timelineLegendContent.appendChild(fragment);
} }
handleEntryTypeDblClick(e){
let selectedEvent = {
entries: e.target.entries
}
this.dispatchEvent(new CustomEvent(
'selectionevent', {bubbles: true, composed: true,
detail: selectedEvent}));
}
// TODO(zcankara) Emit event and handle data in timeline track // TODO(zcankara) Emit event and handle data in timeline track
handleTimelineIndicatorMove(offset) { handleTimelineIndicatorMove(offset) {
this.timeline.scrollLeft += offset; this.timeline.scrollLeft += offset;
......
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