 Chromium Code Reviews
 Chromium Code Reviews Issue 2314173003:
  Timeline: make prepareHighlightedEntryInfo return ?Promise<!Element>  (Closed)
    
  
    Issue 2314173003:
  Timeline: make prepareHighlightedEntryInfo return ?Promise<!Element>  (Closed) 
  | Index: third_party/WebKit/Source/devtools/front_end/ui_lazy/FlameChart.js | 
| diff --git a/third_party/WebKit/Source/devtools/front_end/ui_lazy/FlameChart.js b/third_party/WebKit/Source/devtools/front_end/ui_lazy/FlameChart.js | 
| index 3355cc77f925ffa7be4dcfdc373b4a124ea060eb..bd20c6574e4459126b1f3d2cde355603c95e7f93 100644 | 
| --- a/third_party/WebKit/Source/devtools/front_end/ui_lazy/FlameChart.js | 
| +++ b/third_party/WebKit/Source/devtools/front_end/ui_lazy/FlameChart.js | 
| @@ -215,7 +215,7 @@ WebInspector.FlameChartDataProvider.prototype = { | 
| /** | 
| * @param {number} entryIndex | 
| - * @return {?Array.<!{title: string, value: (string|!Element)}>} | 
| + * @return {?Promise<!Element>} | 
| */ | 
| prepareHighlightedEntryInfo: function(entryIndex) { }, | 
| @@ -813,12 +813,18 @@ WebInspector.FlameChart.prototype = { | 
| */ | 
| _updatePopover: function(entryIndex) | 
| { | 
| - if (entryIndex !== this._highlightedEntryIndex) { | 
| - this._entryInfo.removeChildren(); | 
| - var entryInfo = this._dataProvider.prepareHighlightedEntryInfo(entryIndex); | 
| - if (entryInfo) | 
| - this._entryInfo.appendChild(this._buildEntryInfo(entryInfo)); | 
| + if (entryIndex === this._highlightedEntryIndex) { | 
| + this._updatePopoverOffset(); | 
| + return; | 
| } | 
| + this._entryInfo.removeChildren(); | 
| + var popoverElementPromise = this._dataProvider.prepareHighlightedEntryInfo(entryIndex); | 
| + if (popoverElementPromise) | 
| + popoverElementPromise.then(element => this._entryInfo.appendChild(element)).then(() => this._updatePopoverOffset); | 
| 
alph
2016/09/08 00:16:05
missing a call at the end.
 | 
| + }, | 
| + | 
| + _updatePopoverOffset: function() | 
| + { | 
| var mouseX = this._lastMouseOffsetX; | 
| var mouseY = this._lastMouseOffsetY; | 
| var parentWidth = this._entryInfo.parentElement.clientWidth; | 
| @@ -1842,24 +1848,6 @@ WebInspector.FlameChart.prototype = { | 
| }, | 
| /** | 
| - * @param {!Array<!{title: string, value: (string|!Element)}>} entryInfo | 
| - * @return {!Element} | 
| - */ | 
| - _buildEntryInfo: function(entryInfo) | 
| - { | 
| - var infoTable = createElementWithClass("table", "info-table"); | 
| - for (var entry of entryInfo) { | 
| - var row = infoTable.createChild("tr"); | 
| - row.createChild("td", "title").textContent = entry.title; | 
| - if (typeof entry.value === "string") | 
| - row.createChild("td").textContent = entry.value; | 
| - else | 
| - row.createChild("td").appendChild(entry.value); | 
| - } | 
| - return infoTable; | 
| - }, | 
| - | 
| - /** | 
| * @param {!CanvasRenderingContext2D} context | 
| * @param {string} text | 
| * @param {number} maxWidth |