| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright 2016 The Chromium Authors. All rights reserved. | 3 Copyright 2016 The Chromium Authors. All rights reserved. |
| 4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
| 5 found in the LICENSE file. | 5 found in the LICENSE file. |
| 6 --> | 6 --> |
| 7 | 7 |
| 8 <link rel="import" href="/tracing/base/timing.html"> | 8 <link rel="import" href="/tracing/base/timing.html"> |
| 9 <link rel="import" href="/tracing/ui/base/table.html"> | 9 <link rel="import" href="/tracing/ui/base/table.html"> |
| 10 <link rel="import" href="/tracing/value/histogram_set.html"> | 10 <link rel="import" href="/tracing/value/histogram_set.html"> |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 this.groupedHistograms_); | 188 this.groupedHistograms_); |
| 189 this.tableRows_ = undefined; | 189 this.tableRows_ = undefined; |
| 190 } | 190 } |
| 191 | 191 |
| 192 const tableRowsDirty = this.tableRows_ === undefined; | 192 const tableRowsDirty = this.tableRows_ === undefined; |
| 193 const previousRowStates = this.viewState.tableRowStates; | 193 const previousRowStates = this.viewState.tableRowStates; |
| 194 | 194 |
| 195 if (tableRowsDirty) { | 195 if (tableRowsDirty) { |
| 196 await this.progress_('Filtering rows...'); | 196 await this.progress_('Filtering rows...'); |
| 197 | 197 |
| 198 let filteredHistograms = this.viewState.showAll ? | 198 const filteredHistogramNames = new Set(); |
| 199 this.histograms : this.sourceHistograms_; | 199 let query; |
| 200 if (this.viewState.searchQuery) { | 200 if (this.viewState.searchQuery) { |
| 201 let query = undefined; | |
| 202 try { | 201 try { |
| 203 query = new RegExp(this.viewState.searchQuery); | 202 query = new RegExp(this.viewState.searchQuery); |
| 204 } catch (e) { | 203 } catch (e) { |
| 205 } | 204 } |
| 206 if (query !== undefined) { | 205 } |
| 207 filteredHistograms = new tr.v.HistogramSet( | 206 for (const hist of this.viewState.showAll ? |
| 208 [...filteredHistograms].filter( | 207 this.histograms : this.sourceHistograms_) { |
| 209 hist => hist.name.match(query))); | 208 if (query === undefined || |
| 209 hist.name.match(query)) { |
| 210 filteredHistogramNames.add(hist.name); |
| 210 } | 211 } |
| 211 } | 212 } |
| 212 | 213 |
| 213 const filteredHierarchies = tr.v.HistogramSetHierarchy.filter( | 214 const filteredHierarchies = tr.v.HistogramSetHierarchy.filter( |
| 214 this.hierarchies_, filteredHistograms); | 215 this.hierarchies_, filteredHistogramNames); |
| 215 | 216 |
| 216 // Wait to set this.$.table.tableRows until we're ready for it to build | 217 // Wait to set this.$.table.tableRows until we're ready for it to build |
| 217 // DOM. When tableRows are set on it, tr-ui-b-table calls | 218 // DOM. When tableRows are set on it, tr-ui-b-table calls |
| 218 // setTimeout(..., 0) to schedule rebuild for the next interpreter tick, | 219 // setTimeout(..., 0) to schedule rebuild for the next interpreter tick, |
| 219 // but that can happen in between the next await, which is too early. | 220 // but that can happen in between the next await, which is too early. |
| 220 this.tableRows_ = filteredHierarchies.map(hierarchy => | 221 this.tableRows_ = filteredHierarchies.map(hierarchy => |
| 221 new tr.v.ui.HistogramSetTableRow( | 222 new tr.v.ui.HistogramSetTableRow( |
| 222 hierarchy, this.$.table, this.viewState)); | 223 hierarchy, this.$.table, this.histograms, this.viewState)); |
| 223 | 224 |
| 224 tr.b.Timing.instant('histogram-set-table', 'rootRowCount', | 225 tr.b.Timing.instant('histogram-set-table', 'rootRowCount', |
| 225 this.tableRows_.length); | 226 this.tableRows_.length); |
| 226 | 227 |
| 227 const namesToRowStates = new Map(); | 228 const namesToRowStates = new Map(); |
| 228 for (const row of this.tableRows_) { | 229 for (const row of this.tableRows_) { |
| 229 namesToRowStates.set(row.name, row.viewState); | 230 namesToRowStates.set(row.name, row.viewState); |
| 230 } | 231 } |
| 231 await this.viewState.update({tableRowStates: namesToRowStates}); | 232 await this.viewState.update({tableRowStates: namesToRowStates}); |
| 232 } | 233 } |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 } | 431 } |
| 431 return histograms; | 432 return histograms; |
| 432 } | 433 } |
| 433 }); | 434 }); |
| 434 | 435 |
| 435 return { | 436 return { |
| 436 MIDLINE_HORIZONTAL_ELLIPSIS, | 437 MIDLINE_HORIZONTAL_ELLIPSIS, |
| 437 }; | 438 }; |
| 438 }); | 439 }); |
| 439 </script> | 440 </script> |
| OLD | NEW |