| OLD | NEW |
| 1 /** | 1 /** |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @implements {WebInspector.FlameChartDataProvider} | 32 * @implements {UI.FlameChartDataProvider} |
| 33 * @unrestricted | 33 * @unrestricted |
| 34 */ | 34 */ |
| 35 WebInspector.ProfileFlameChartDataProvider = class { | 35 Profiler.ProfileFlameChartDataProvider = class { |
| 36 /** | 36 /** |
| 37 * @param {?WebInspector.Target} target | 37 * @param {?SDK.Target} target |
| 38 */ | 38 */ |
| 39 constructor(target) { | 39 constructor(target) { |
| 40 WebInspector.FlameChartDataProvider.call(this); | 40 UI.FlameChartDataProvider.call(this); |
| 41 this._target = target; | 41 this._target = target; |
| 42 this._colorGenerator = WebInspector.ProfileFlameChartDataProvider.colorGener
ator(); | 42 this._colorGenerator = Profiler.ProfileFlameChartDataProvider.colorGenerator
(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 /** | 45 /** |
| 46 * @return {!WebInspector.FlameChart.ColorGenerator} | 46 * @return {!UI.FlameChart.ColorGenerator} |
| 47 */ | 47 */ |
| 48 static colorGenerator() { | 48 static colorGenerator() { |
| 49 if (!WebInspector.ProfileFlameChartDataProvider._colorGenerator) { | 49 if (!Profiler.ProfileFlameChartDataProvider._colorGenerator) { |
| 50 var colorGenerator = new WebInspector.FlameChart.ColorGenerator( | 50 var colorGenerator = new UI.FlameChart.ColorGenerator( |
| 51 {min: 30, max: 330}, {min: 50, max: 80, count: 5}, {min: 80, max: 90,
count: 3}); | 51 {min: 30, max: 330}, {min: 50, max: 80, count: 5}, {min: 80, max: 90,
count: 3}); |
| 52 | 52 |
| 53 colorGenerator.setColorForID('(idle)', 'hsl(0, 0%, 94%)'); | 53 colorGenerator.setColorForID('(idle)', 'hsl(0, 0%, 94%)'); |
| 54 colorGenerator.setColorForID('(program)', 'hsl(0, 0%, 80%)'); | 54 colorGenerator.setColorForID('(program)', 'hsl(0, 0%, 80%)'); |
| 55 colorGenerator.setColorForID('(garbage collector)', 'hsl(0, 0%, 80%)'); | 55 colorGenerator.setColorForID('(garbage collector)', 'hsl(0, 0%, 80%)'); |
| 56 WebInspector.ProfileFlameChartDataProvider._colorGenerator = colorGenerato
r; | 56 Profiler.ProfileFlameChartDataProvider._colorGenerator = colorGenerator; |
| 57 } | 57 } |
| 58 return WebInspector.ProfileFlameChartDataProvider._colorGenerator; | 58 return Profiler.ProfileFlameChartDataProvider._colorGenerator; |
| 59 } | 59 } |
| 60 | 60 |
| 61 /** | 61 /** |
| 62 * @override | 62 * @override |
| 63 * @return {number} | 63 * @return {number} |
| 64 */ | 64 */ |
| 65 barHeight() { | 65 barHeight() { |
| 66 return 15; | 66 return 15; |
| 67 } | 67 } |
| 68 | 68 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 /** | 111 /** |
| 112 * @override | 112 * @override |
| 113 * @return {number} | 113 * @return {number} |
| 114 */ | 114 */ |
| 115 maxStackDepth() { | 115 maxStackDepth() { |
| 116 return this._maxStackDepth; | 116 return this._maxStackDepth; |
| 117 } | 117 } |
| 118 | 118 |
| 119 /** | 119 /** |
| 120 * @override | 120 * @override |
| 121 * @return {?WebInspector.FlameChart.TimelineData} | 121 * @return {?UI.FlameChart.TimelineData} |
| 122 */ | 122 */ |
| 123 timelineData() { | 123 timelineData() { |
| 124 return this._timelineData || this._calculateTimelineData(); | 124 return this._timelineData || this._calculateTimelineData(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 /** | 127 /** |
| 128 * @return {!WebInspector.FlameChart.TimelineData} | 128 * @return {!UI.FlameChart.TimelineData} |
| 129 */ | 129 */ |
| 130 _calculateTimelineData() { | 130 _calculateTimelineData() { |
| 131 throw 'Not implemented.'; | 131 throw 'Not implemented.'; |
| 132 } | 132 } |
| 133 | 133 |
| 134 /** | 134 /** |
| 135 * @override | 135 * @override |
| 136 * @param {number} entryIndex | 136 * @param {number} entryIndex |
| 137 * @return {?Element} | 137 * @return {?Element} |
| 138 */ | 138 */ |
| (...skipping 10 matching lines...) Expand all Loading... |
| 149 return this._entryNodes[entryIndex].scriptId !== '0'; | 149 return this._entryNodes[entryIndex].scriptId !== '0'; |
| 150 } | 150 } |
| 151 | 151 |
| 152 /** | 152 /** |
| 153 * @override | 153 * @override |
| 154 * @param {number} entryIndex | 154 * @param {number} entryIndex |
| 155 * @return {string} | 155 * @return {string} |
| 156 */ | 156 */ |
| 157 entryTitle(entryIndex) { | 157 entryTitle(entryIndex) { |
| 158 var node = this._entryNodes[entryIndex]; | 158 var node = this._entryNodes[entryIndex]; |
| 159 return WebInspector.beautifyFunctionName(node.functionName); | 159 return UI.beautifyFunctionName(node.functionName); |
| 160 } | 160 } |
| 161 | 161 |
| 162 /** | 162 /** |
| 163 * @override | 163 * @override |
| 164 * @param {number} entryIndex | 164 * @param {number} entryIndex |
| 165 * @return {?string} | 165 * @return {?string} |
| 166 */ | 166 */ |
| 167 entryFont(entryIndex) { | 167 entryFont(entryIndex) { |
| 168 if (!this._font) { | 168 if (!this._font) { |
| 169 this._font = (this.barHeight() - 4) + 'px ' + WebInspector.fontFamily(); | 169 this._font = (this.barHeight() - 4) + 'px ' + Host.fontFamily(); |
| 170 this._boldFont = 'bold ' + this._font; | 170 this._boldFont = 'bold ' + this._font; |
| 171 } | 171 } |
| 172 var node = this._entryNodes[entryIndex]; | 172 var node = this._entryNodes[entryIndex]; |
| 173 return node.deoptReason ? this._boldFont : this._font; | 173 return node.deoptReason ? this._boldFont : this._font; |
| 174 } | 174 } |
| 175 | 175 |
| 176 /** | 176 /** |
| 177 * @override | 177 * @override |
| 178 * @param {number} entryIndex | 178 * @param {number} entryIndex |
| 179 * @return {string} | 179 * @return {string} |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 * @param {number} entryIndex | 222 * @param {number} entryIndex |
| 223 * @return {string} | 223 * @return {string} |
| 224 */ | 224 */ |
| 225 textColor(entryIndex) { | 225 textColor(entryIndex) { |
| 226 return '#333'; | 226 return '#333'; |
| 227 } | 227 } |
| 228 }; | 228 }; |
| 229 | 229 |
| 230 | 230 |
| 231 /** | 231 /** |
| 232 * @implements {WebInspector.Searchable} | 232 * @implements {UI.Searchable} |
| 233 * @unrestricted | 233 * @unrestricted |
| 234 */ | 234 */ |
| 235 WebInspector.CPUProfileFlameChart = class extends WebInspector.VBox { | 235 Profiler.CPUProfileFlameChart = class extends UI.VBox { |
| 236 /** | 236 /** |
| 237 * @param {!WebInspector.SearchableView} searchableView | 237 * @param {!UI.SearchableView} searchableView |
| 238 * @param {!WebInspector.FlameChartDataProvider} dataProvider | 238 * @param {!UI.FlameChartDataProvider} dataProvider |
| 239 */ | 239 */ |
| 240 constructor(searchableView, dataProvider) { | 240 constructor(searchableView, dataProvider) { |
| 241 super(); | 241 super(); |
| 242 this.element.id = 'cpu-flame-chart'; | 242 this.element.id = 'cpu-flame-chart'; |
| 243 | 243 |
| 244 this._searchableView = searchableView; | 244 this._searchableView = searchableView; |
| 245 this._overviewPane = new WebInspector.CPUProfileFlameChart.OverviewPane(data
Provider); | 245 this._overviewPane = new Profiler.CPUProfileFlameChart.OverviewPane(dataProv
ider); |
| 246 this._overviewPane.show(this.element); | 246 this._overviewPane.show(this.element); |
| 247 | 247 |
| 248 this._mainPane = new WebInspector.FlameChart(dataProvider, this._overviewPan
e); | 248 this._mainPane = new UI.FlameChart(dataProvider, this._overviewPane); |
| 249 this._mainPane.show(this.element); | 249 this._mainPane.show(this.element); |
| 250 this._mainPane.addEventListener(WebInspector.FlameChart.Events.EntrySelected
, this._onEntrySelected, this); | 250 this._mainPane.addEventListener(UI.FlameChart.Events.EntrySelected, this._on
EntrySelected, this); |
| 251 this._overviewPane.addEventListener(WebInspector.OverviewGrid.Events.WindowC
hanged, this._onWindowChanged, this); | 251 this._overviewPane.addEventListener(UI.OverviewGrid.Events.WindowChanged, th
is._onWindowChanged, this); |
| 252 this._dataProvider = dataProvider; | 252 this._dataProvider = dataProvider; |
| 253 this._searchResults = []; | 253 this._searchResults = []; |
| 254 } | 254 } |
| 255 | 255 |
| 256 /** | 256 /** |
| 257 * @override | 257 * @override |
| 258 */ | 258 */ |
| 259 focus() { | 259 focus() { |
| 260 this._mainPane.focus(); | 260 this._mainPane.focus(); |
| 261 } | 261 } |
| 262 | 262 |
| 263 /** | 263 /** |
| 264 * @param {!WebInspector.Event} event | 264 * @param {!Common.Event} event |
| 265 */ | 265 */ |
| 266 _onWindowChanged(event) { | 266 _onWindowChanged(event) { |
| 267 var windowLeft = event.data.windowTimeLeft; | 267 var windowLeft = event.data.windowTimeLeft; |
| 268 var windowRight = event.data.windowTimeRight; | 268 var windowRight = event.data.windowTimeRight; |
| 269 this._mainPane.setWindowTimes(windowLeft, windowRight); | 269 this._mainPane.setWindowTimes(windowLeft, windowRight); |
| 270 } | 270 } |
| 271 | 271 |
| 272 /** | 272 /** |
| 273 * @param {number} timeLeft | 273 * @param {number} timeLeft |
| 274 * @param {number} timeRight | 274 * @param {number} timeRight |
| 275 */ | 275 */ |
| 276 selectRange(timeLeft, timeRight) { | 276 selectRange(timeLeft, timeRight) { |
| 277 this._overviewPane._selectRange(timeLeft, timeRight); | 277 this._overviewPane._selectRange(timeLeft, timeRight); |
| 278 } | 278 } |
| 279 | 279 |
| 280 /** | 280 /** |
| 281 * @param {!WebInspector.Event} event | 281 * @param {!Common.Event} event |
| 282 */ | 282 */ |
| 283 _onEntrySelected(event) { | 283 _onEntrySelected(event) { |
| 284 this.dispatchEventToListeners(WebInspector.FlameChart.Events.EntrySelected,
event.data); | 284 this.dispatchEventToListeners(UI.FlameChart.Events.EntrySelected, event.data
); |
| 285 } | 285 } |
| 286 | 286 |
| 287 update() { | 287 update() { |
| 288 this._overviewPane.update(); | 288 this._overviewPane.update(); |
| 289 this._mainPane.update(); | 289 this._mainPane.update(); |
| 290 } | 290 } |
| 291 | 291 |
| 292 /** | 292 /** |
| 293 * @override | 293 * @override |
| 294 * @param {!WebInspector.SearchableView.SearchConfig} searchConfig | 294 * @param {!UI.SearchableView.SearchConfig} searchConfig |
| 295 * @param {boolean} shouldJump | 295 * @param {boolean} shouldJump |
| 296 * @param {boolean=} jumpBackwards | 296 * @param {boolean=} jumpBackwards |
| 297 */ | 297 */ |
| 298 performSearch(searchConfig, shouldJump, jumpBackwards) { | 298 performSearch(searchConfig, shouldJump, jumpBackwards) { |
| 299 var matcher = createPlainTextSearchRegex(searchConfig.query, searchConfig.ca
seSensitive ? '' : 'i'); | 299 var matcher = createPlainTextSearchRegex(searchConfig.query, searchConfig.ca
seSensitive ? '' : 'i'); |
| 300 | 300 |
| 301 var selectedEntryIndex = this._searchResultIndex !== -1 ? this._searchResult
s[this._searchResultIndex] : -1; | 301 var selectedEntryIndex = this._searchResultIndex !== -1 ? this._searchResult
s[this._searchResultIndex] : -1; |
| 302 this._searchResults = []; | 302 this._searchResults = []; |
| 303 var entriesCount = this._dataProvider._entryNodes.length; | 303 var entriesCount = this._dataProvider._entryNodes.length; |
| 304 for (var index = 0; index < entriesCount; ++index) { | 304 for (var index = 0; index < entriesCount; ++index) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 /** | 356 /** |
| 357 * @override | 357 * @override |
| 358 * @return {boolean} | 358 * @return {boolean} |
| 359 */ | 359 */ |
| 360 supportsRegexSearch() { | 360 supportsRegexSearch() { |
| 361 return false; | 361 return false; |
| 362 } | 362 } |
| 363 }; | 363 }; |
| 364 | 364 |
| 365 /** | 365 /** |
| 366 * @implements {WebInspector.TimelineGrid.Calculator} | 366 * @implements {UI.TimelineGrid.Calculator} |
| 367 * @unrestricted | 367 * @unrestricted |
| 368 */ | 368 */ |
| 369 WebInspector.CPUProfileFlameChart.OverviewCalculator = class { | 369 Profiler.CPUProfileFlameChart.OverviewCalculator = class { |
| 370 constructor(dataProvider) { | 370 constructor(dataProvider) { |
| 371 this._dataProvider = dataProvider; | 371 this._dataProvider = dataProvider; |
| 372 } | 372 } |
| 373 | 373 |
| 374 /** | 374 /** |
| 375 * @override | 375 * @override |
| 376 * @return {number} | 376 * @return {number} |
| 377 */ | 377 */ |
| 378 paddingLeft() { | 378 paddingLeft() { |
| 379 return 0; | 379 return 0; |
| 380 } | 380 } |
| 381 | 381 |
| 382 /** | 382 /** |
| 383 * @param {!WebInspector.CPUProfileFlameChart.OverviewPane} overviewPane | 383 * @param {!Profiler.CPUProfileFlameChart.OverviewPane} overviewPane |
| 384 */ | 384 */ |
| 385 _updateBoundaries(overviewPane) { | 385 _updateBoundaries(overviewPane) { |
| 386 this._minimumBoundaries = overviewPane._dataProvider.minimumBoundary(); | 386 this._minimumBoundaries = overviewPane._dataProvider.minimumBoundary(); |
| 387 var totalTime = overviewPane._dataProvider.totalTime(); | 387 var totalTime = overviewPane._dataProvider.totalTime(); |
| 388 this._maximumBoundaries = this._minimumBoundaries + totalTime; | 388 this._maximumBoundaries = this._minimumBoundaries + totalTime; |
| 389 this._xScaleFactor = overviewPane._overviewContainer.clientWidth / totalTime
; | 389 this._xScaleFactor = overviewPane._overviewContainer.clientWidth / totalTime
; |
| 390 } | 390 } |
| 391 | 391 |
| 392 /** | 392 /** |
| 393 * @override | 393 * @override |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 /** | 435 /** |
| 436 * @override | 436 * @override |
| 437 * @return {number} | 437 * @return {number} |
| 438 */ | 438 */ |
| 439 boundarySpan() { | 439 boundarySpan() { |
| 440 return this._maximumBoundaries - this._minimumBoundaries; | 440 return this._maximumBoundaries - this._minimumBoundaries; |
| 441 } | 441 } |
| 442 }; | 442 }; |
| 443 | 443 |
| 444 /** | 444 /** |
| 445 * @implements {WebInspector.FlameChartDelegate} | 445 * @implements {UI.FlameChartDelegate} |
| 446 * @unrestricted | 446 * @unrestricted |
| 447 */ | 447 */ |
| 448 WebInspector.CPUProfileFlameChart.OverviewPane = class extends WebInspector.VBox
{ | 448 Profiler.CPUProfileFlameChart.OverviewPane = class extends UI.VBox { |
| 449 /** | 449 /** |
| 450 * @param {!WebInspector.FlameChartDataProvider} dataProvider | 450 * @param {!UI.FlameChartDataProvider} dataProvider |
| 451 */ | 451 */ |
| 452 constructor(dataProvider) { | 452 constructor(dataProvider) { |
| 453 super(); | 453 super(); |
| 454 this.element.classList.add('cpu-profile-flame-chart-overview-pane'); | 454 this.element.classList.add('cpu-profile-flame-chart-overview-pane'); |
| 455 this._overviewContainer = this.element.createChild('div', 'cpu-profile-flame
-chart-overview-container'); | 455 this._overviewContainer = this.element.createChild('div', 'cpu-profile-flame
-chart-overview-container'); |
| 456 this._overviewGrid = new WebInspector.OverviewGrid('cpu-profile-flame-chart'
); | 456 this._overviewGrid = new UI.OverviewGrid('cpu-profile-flame-chart'); |
| 457 this._overviewGrid.element.classList.add('fill'); | 457 this._overviewGrid.element.classList.add('fill'); |
| 458 this._overviewCanvas = this._overviewContainer.createChild('canvas', 'cpu-pr
ofile-flame-chart-overview-canvas'); | 458 this._overviewCanvas = this._overviewContainer.createChild('canvas', 'cpu-pr
ofile-flame-chart-overview-canvas'); |
| 459 this._overviewContainer.appendChild(this._overviewGrid.element); | 459 this._overviewContainer.appendChild(this._overviewGrid.element); |
| 460 this._overviewCalculator = new WebInspector.CPUProfileFlameChart.OverviewCal
culator(dataProvider); | 460 this._overviewCalculator = new Profiler.CPUProfileFlameChart.OverviewCalcula
tor(dataProvider); |
| 461 this._dataProvider = dataProvider; | 461 this._dataProvider = dataProvider; |
| 462 this._overviewGrid.addEventListener(WebInspector.OverviewGrid.Events.WindowC
hanged, this._onWindowChanged, this); | 462 this._overviewGrid.addEventListener(UI.OverviewGrid.Events.WindowChanged, th
is._onWindowChanged, this); |
| 463 } | 463 } |
| 464 | 464 |
| 465 /** | 465 /** |
| 466 * @override | 466 * @override |
| 467 * @param {number} windowStartTime | 467 * @param {number} windowStartTime |
| 468 * @param {number} windowEndTime | 468 * @param {number} windowEndTime |
| 469 */ | 469 */ |
| 470 requestWindowTimes(windowStartTime, windowEndTime) { | 470 requestWindowTimes(windowStartTime, windowEndTime) { |
| 471 this._selectRange(windowStartTime, windowEndTime); | 471 this._selectRange(windowStartTime, windowEndTime); |
| 472 } | 472 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 483 * @param {number} timeLeft | 483 * @param {number} timeLeft |
| 484 * @param {number} timeRight | 484 * @param {number} timeRight |
| 485 */ | 485 */ |
| 486 _selectRange(timeLeft, timeRight) { | 486 _selectRange(timeLeft, timeRight) { |
| 487 var startTime = this._dataProvider.minimumBoundary(); | 487 var startTime = this._dataProvider.minimumBoundary(); |
| 488 var totalTime = this._dataProvider.totalTime(); | 488 var totalTime = this._dataProvider.totalTime(); |
| 489 this._overviewGrid.setWindow((timeLeft - startTime) / totalTime, (timeRight
- startTime) / totalTime); | 489 this._overviewGrid.setWindow((timeLeft - startTime) / totalTime, (timeRight
- startTime) / totalTime); |
| 490 } | 490 } |
| 491 | 491 |
| 492 /** | 492 /** |
| 493 * @param {!WebInspector.Event} event | 493 * @param {!Common.Event} event |
| 494 */ | 494 */ |
| 495 _onWindowChanged(event) { | 495 _onWindowChanged(event) { |
| 496 var startTime = this._dataProvider.minimumBoundary(); | 496 var startTime = this._dataProvider.minimumBoundary(); |
| 497 var totalTime = this._dataProvider.totalTime(); | 497 var totalTime = this._dataProvider.totalTime(); |
| 498 var data = { | 498 var data = { |
| 499 windowTimeLeft: startTime + this._overviewGrid.windowLeft() * totalTime, | 499 windowTimeLeft: startTime + this._overviewGrid.windowLeft() * totalTime, |
| 500 windowTimeRight: startTime + this._overviewGrid.windowRight() * totalTime | 500 windowTimeRight: startTime + this._overviewGrid.windowRight() * totalTime |
| 501 }; | 501 }; |
| 502 this.dispatchEventToListeners(WebInspector.OverviewGrid.Events.WindowChanged
, data); | 502 this.dispatchEventToListeners(UI.OverviewGrid.Events.WindowChanged, data); |
| 503 } | 503 } |
| 504 | 504 |
| 505 /** | 505 /** |
| 506 * @return {?WebInspector.FlameChart.TimelineData} | 506 * @return {?UI.FlameChart.TimelineData} |
| 507 */ | 507 */ |
| 508 _timelineData() { | 508 _timelineData() { |
| 509 return this._dataProvider.timelineData(); | 509 return this._dataProvider.timelineData(); |
| 510 } | 510 } |
| 511 | 511 |
| 512 /** | 512 /** |
| 513 * @override | 513 * @override |
| 514 */ | 514 */ |
| 515 onResize() { | 515 onResize() { |
| 516 this._scheduleUpdate(); | 516 this._scheduleUpdate(); |
| 517 } | 517 } |
| 518 | 518 |
| 519 _scheduleUpdate() { | 519 _scheduleUpdate() { |
| 520 if (this._updateTimerId) | 520 if (this._updateTimerId) |
| 521 return; | 521 return; |
| 522 this._updateTimerId = this.element.window().requestAnimationFrame(this.updat
e.bind(this)); | 522 this._updateTimerId = this.element.window().requestAnimationFrame(this.updat
e.bind(this)); |
| 523 } | 523 } |
| 524 | 524 |
| 525 update() { | 525 update() { |
| 526 this._updateTimerId = 0; | 526 this._updateTimerId = 0; |
| 527 var timelineData = this._timelineData(); | 527 var timelineData = this._timelineData(); |
| 528 if (!timelineData) | 528 if (!timelineData) |
| 529 return; | 529 return; |
| 530 this._resetCanvas( | 530 this._resetCanvas( |
| 531 this._overviewContainer.clientWidth, | 531 this._overviewContainer.clientWidth, |
| 532 this._overviewContainer.clientHeight - WebInspector.FlameChart.DividersB
arHeight); | 532 this._overviewContainer.clientHeight - UI.FlameChart.DividersBarHeight); |
| 533 this._overviewCalculator._updateBoundaries(this); | 533 this._overviewCalculator._updateBoundaries(this); |
| 534 this._overviewGrid.updateDividers(this._overviewCalculator); | 534 this._overviewGrid.updateDividers(this._overviewCalculator); |
| 535 this._drawOverviewCanvas(); | 535 this._drawOverviewCanvas(); |
| 536 } | 536 } |
| 537 | 537 |
| 538 _drawOverviewCanvas() { | 538 _drawOverviewCanvas() { |
| 539 var canvasWidth = this._overviewCanvas.width; | 539 var canvasWidth = this._overviewCanvas.width; |
| 540 var canvasHeight = this._overviewCanvas.height; | 540 var canvasHeight = this._overviewCanvas.height; |
| 541 var drawData = this._calculateDrawData(canvasWidth); | 541 var drawData = this._calculateDrawData(canvasWidth); |
| 542 var context = this._overviewCanvas.getContext('2d'); | 542 var context = this._overviewCanvas.getContext('2d'); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 * @param {number} height | 593 * @param {number} height |
| 594 */ | 594 */ |
| 595 _resetCanvas(width, height) { | 595 _resetCanvas(width, height) { |
| 596 var ratio = window.devicePixelRatio; | 596 var ratio = window.devicePixelRatio; |
| 597 this._overviewCanvas.width = width * ratio; | 597 this._overviewCanvas.width = width * ratio; |
| 598 this._overviewCanvas.height = height * ratio; | 598 this._overviewCanvas.height = height * ratio; |
| 599 this._overviewCanvas.style.width = width + 'px'; | 599 this._overviewCanvas.style.width = width + 'px'; |
| 600 this._overviewCanvas.style.height = height + 'px'; | 600 this._overviewCanvas.style.height = height + 'px'; |
| 601 } | 601 } |
| 602 }; | 602 }; |
| OLD | NEW |