| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 13 matching lines...) Expand all Loading... |
| 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 * @unrestricted | 32 * @unrestricted |
| 33 */ | 33 */ |
| 34 WebInspector.PaintProfilerView = class extends WebInspector.HBox { | 34 LayerViewer.PaintProfilerView = class extends UI.HBox { |
| 35 /** | 35 /** |
| 36 * @param {function(string=)} showImageCallback | 36 * @param {function(string=)} showImageCallback |
| 37 */ | 37 */ |
| 38 constructor(showImageCallback) { | 38 constructor(showImageCallback) { |
| 39 super(true); | 39 super(true); |
| 40 this.registerRequiredCSS('layer_viewer/paintProfiler.css'); | 40 this.registerRequiredCSS('layer_viewer/paintProfiler.css'); |
| 41 this.contentElement.classList.add('paint-profiler-overview'); | 41 this.contentElement.classList.add('paint-profiler-overview'); |
| 42 this._canvasContainer = this.contentElement.createChild('div', 'paint-profil
er-canvas-container'); | 42 this._canvasContainer = this.contentElement.createChild('div', 'paint-profil
er-canvas-container'); |
| 43 this._progressBanner = this.contentElement.createChild('div', 'full-widget-d
immed-banner hidden'); | 43 this._progressBanner = this.contentElement.createChild('div', 'full-widget-d
immed-banner hidden'); |
| 44 this._progressBanner.textContent = WebInspector.UIString('Profiling\u2026'); | 44 this._progressBanner.textContent = Common.UIString('Profiling\u2026'); |
| 45 this._pieChart = new WebInspector.PieChart(55, this._formatPieChartTime.bind
(this), true); | 45 this._pieChart = new UI.PieChart(55, this._formatPieChartTime.bind(this), tr
ue); |
| 46 this._pieChart.element.classList.add('paint-profiler-pie-chart'); | 46 this._pieChart.element.classList.add('paint-profiler-pie-chart'); |
| 47 this.contentElement.appendChild(this._pieChart.element); | 47 this.contentElement.appendChild(this._pieChart.element); |
| 48 | 48 |
| 49 this._showImageCallback = showImageCallback; | 49 this._showImageCallback = showImageCallback; |
| 50 | 50 |
| 51 this._canvas = this._canvasContainer.createChild('canvas', 'fill'); | 51 this._canvas = this._canvasContainer.createChild('canvas', 'fill'); |
| 52 this._context = this._canvas.getContext('2d'); | 52 this._context = this._canvas.getContext('2d'); |
| 53 this._selectionWindow = new WebInspector.OverviewGrid.Window(this._canvasCon
tainer); | 53 this._selectionWindow = new UI.OverviewGrid.Window(this._canvasContainer); |
| 54 this._selectionWindow.addEventListener(WebInspector.OverviewGrid.Events.Wind
owChanged, this._onWindowChanged, this); | 54 this._selectionWindow.addEventListener(UI.OverviewGrid.Events.WindowChanged,
this._onWindowChanged, this); |
| 55 | 55 |
| 56 this._innerBarWidth = 4 * window.devicePixelRatio; | 56 this._innerBarWidth = 4 * window.devicePixelRatio; |
| 57 this._minBarHeight = window.devicePixelRatio; | 57 this._minBarHeight = window.devicePixelRatio; |
| 58 this._barPaddingWidth = 2 * window.devicePixelRatio; | 58 this._barPaddingWidth = 2 * window.devicePixelRatio; |
| 59 this._outerBarWidth = this._innerBarWidth + this._barPaddingWidth; | 59 this._outerBarWidth = this._innerBarWidth + this._barPaddingWidth; |
| 60 this._pendingScale = 1; | 60 this._pendingScale = 1; |
| 61 this._scale = this._pendingScale; | 61 this._scale = this._pendingScale; |
| 62 | 62 |
| 63 this._reset(); | 63 this._reset(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 /** | 66 /** |
| 67 * @return {!Object.<string, !WebInspector.PaintProfilerCategory>} | 67 * @return {!Object.<string, !LayerViewer.PaintProfilerCategory>} |
| 68 */ | 68 */ |
| 69 static categories() { | 69 static categories() { |
| 70 if (WebInspector.PaintProfilerView._categories) | 70 if (LayerViewer.PaintProfilerView._categories) |
| 71 return WebInspector.PaintProfilerView._categories; | 71 return LayerViewer.PaintProfilerView._categories; |
| 72 WebInspector.PaintProfilerView._categories = { | 72 LayerViewer.PaintProfilerView._categories = { |
| 73 shapes: new WebInspector.PaintProfilerCategory('shapes', WebInspector.UISt
ring('Shapes'), 'rgb(255, 161, 129)'), | 73 shapes: new LayerViewer.PaintProfilerCategory('shapes', Common.UIString('S
hapes'), 'rgb(255, 161, 129)'), |
| 74 bitmap: new WebInspector.PaintProfilerCategory('bitmap', WebInspector.UISt
ring('Bitmap'), 'rgb(136, 196, 255)'), | 74 bitmap: new LayerViewer.PaintProfilerCategory('bitmap', Common.UIString('B
itmap'), 'rgb(136, 196, 255)'), |
| 75 text: new WebInspector.PaintProfilerCategory('text', WebInspector.UIString
('Text'), 'rgb(180, 255, 137)'), | 75 text: new LayerViewer.PaintProfilerCategory('text', Common.UIString('Text'
), 'rgb(180, 255, 137)'), |
| 76 misc: new WebInspector.PaintProfilerCategory('misc', WebInspector.UIString
('Misc'), 'rgb(206, 160, 255)') | 76 misc: new LayerViewer.PaintProfilerCategory('misc', Common.UIString('Misc'
), 'rgb(206, 160, 255)') |
| 77 }; | 77 }; |
| 78 return WebInspector.PaintProfilerView._categories; | 78 return LayerViewer.PaintProfilerView._categories; |
| 79 } | 79 } |
| 80 | 80 |
| 81 /** | 81 /** |
| 82 * @return {!Object.<string, !WebInspector.PaintProfilerCategory>} | 82 * @return {!Object.<string, !LayerViewer.PaintProfilerCategory>} |
| 83 */ | 83 */ |
| 84 static _initLogItemCategories() { | 84 static _initLogItemCategories() { |
| 85 if (WebInspector.PaintProfilerView._logItemCategoriesMap) | 85 if (LayerViewer.PaintProfilerView._logItemCategoriesMap) |
| 86 return WebInspector.PaintProfilerView._logItemCategoriesMap; | 86 return LayerViewer.PaintProfilerView._logItemCategoriesMap; |
| 87 | 87 |
| 88 var categories = WebInspector.PaintProfilerView.categories(); | 88 var categories = LayerViewer.PaintProfilerView.categories(); |
| 89 | 89 |
| 90 var logItemCategories = {}; | 90 var logItemCategories = {}; |
| 91 logItemCategories['Clear'] = categories['misc']; | 91 logItemCategories['Clear'] = categories['misc']; |
| 92 logItemCategories['DrawPaint'] = categories['misc']; | 92 logItemCategories['DrawPaint'] = categories['misc']; |
| 93 logItemCategories['DrawData'] = categories['misc']; | 93 logItemCategories['DrawData'] = categories['misc']; |
| 94 logItemCategories['SetMatrix'] = categories['misc']; | 94 logItemCategories['SetMatrix'] = categories['misc']; |
| 95 logItemCategories['PushCull'] = categories['misc']; | 95 logItemCategories['PushCull'] = categories['misc']; |
| 96 logItemCategories['PopCull'] = categories['misc']; | 96 logItemCategories['PopCull'] = categories['misc']; |
| 97 logItemCategories['Translate'] = categories['misc']; | 97 logItemCategories['Translate'] = categories['misc']; |
| 98 logItemCategories['Scale'] = categories['misc']; | 98 logItemCategories['Scale'] = categories['misc']; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 118 logItemCategories['DrawBitmapRectToRect'] = categories['bitmap']; | 118 logItemCategories['DrawBitmapRectToRect'] = categories['bitmap']; |
| 119 logItemCategories['DrawBitmapMatrix'] = categories['bitmap']; | 119 logItemCategories['DrawBitmapMatrix'] = categories['bitmap']; |
| 120 logItemCategories['DrawBitmapNine'] = categories['bitmap']; | 120 logItemCategories['DrawBitmapNine'] = categories['bitmap']; |
| 121 logItemCategories['DrawSprite'] = categories['bitmap']; | 121 logItemCategories['DrawSprite'] = categories['bitmap']; |
| 122 logItemCategories['DrawPicture'] = categories['bitmap']; | 122 logItemCategories['DrawPicture'] = categories['bitmap']; |
| 123 logItemCategories['DrawText'] = categories['text']; | 123 logItemCategories['DrawText'] = categories['text']; |
| 124 logItemCategories['DrawPosText'] = categories['text']; | 124 logItemCategories['DrawPosText'] = categories['text']; |
| 125 logItemCategories['DrawPosTextH'] = categories['text']; | 125 logItemCategories['DrawPosTextH'] = categories['text']; |
| 126 logItemCategories['DrawTextOnPath'] = categories['text']; | 126 logItemCategories['DrawTextOnPath'] = categories['text']; |
| 127 | 127 |
| 128 WebInspector.PaintProfilerView._logItemCategoriesMap = logItemCategories; | 128 LayerViewer.PaintProfilerView._logItemCategoriesMap = logItemCategories; |
| 129 return logItemCategories; | 129 return logItemCategories; |
| 130 } | 130 } |
| 131 | 131 |
| 132 /** | 132 /** |
| 133 * @param {!Object} logItem | 133 * @param {!Object} logItem |
| 134 * @return {!WebInspector.PaintProfilerCategory} | 134 * @return {!LayerViewer.PaintProfilerCategory} |
| 135 */ | 135 */ |
| 136 static _categoryForLogItem(logItem) { | 136 static _categoryForLogItem(logItem) { |
| 137 var method = logItem.method.toTitleCase(); | 137 var method = logItem.method.toTitleCase(); |
| 138 | 138 |
| 139 var logItemCategories = WebInspector.PaintProfilerView._initLogItemCategorie
s(); | 139 var logItemCategories = LayerViewer.PaintProfilerView._initLogItemCategories
(); |
| 140 var result = logItemCategories[method]; | 140 var result = logItemCategories[method]; |
| 141 if (!result) { | 141 if (!result) { |
| 142 result = WebInspector.PaintProfilerView.categories()['misc']; | 142 result = LayerViewer.PaintProfilerView.categories()['misc']; |
| 143 logItemCategories[method] = result; | 143 logItemCategories[method] = result; |
| 144 } | 144 } |
| 145 return result; | 145 return result; |
| 146 } | 146 } |
| 147 | 147 |
| 148 /** | 148 /** |
| 149 * @override | 149 * @override |
| 150 */ | 150 */ |
| 151 onResize() { | 151 onResize() { |
| 152 this._update(); | 152 this._update(); |
| 153 } | 153 } |
| 154 | 154 |
| 155 /** | 155 /** |
| 156 * @param {?WebInspector.PaintProfilerSnapshot} snapshot | 156 * @param {?SDK.PaintProfilerSnapshot} snapshot |
| 157 * @param {!Array.<!WebInspector.PaintProfilerLogItem>} log | 157 * @param {!Array.<!SDK.PaintProfilerLogItem>} log |
| 158 * @param {?Protocol.DOM.Rect} clipRect | 158 * @param {?Protocol.DOM.Rect} clipRect |
| 159 */ | 159 */ |
| 160 setSnapshotAndLog(snapshot, log, clipRect) { | 160 setSnapshotAndLog(snapshot, log, clipRect) { |
| 161 this._reset(); | 161 this._reset(); |
| 162 this._snapshot = snapshot; | 162 this._snapshot = snapshot; |
| 163 if (this._snapshot) | 163 if (this._snapshot) |
| 164 this._snapshot.addReference(); | 164 this._snapshot.addReference(); |
| 165 this._log = log; | 165 this._log = log; |
| 166 this._logCategories = this._log.map(WebInspector.PaintProfilerView._category
ForLogItem); | 166 this._logCategories = this._log.map(LayerViewer.PaintProfilerView._categoryF
orLogItem); |
| 167 | 167 |
| 168 if (!this._snapshot) { | 168 if (!this._snapshot) { |
| 169 this._update(); | 169 this._update(); |
| 170 this._pieChart.setTotal(0); | 170 this._pieChart.setTotal(0); |
| 171 this._selectionWindow.setEnabled(false); | 171 this._selectionWindow.setEnabled(false); |
| 172 return; | 172 return; |
| 173 } | 173 } |
| 174 this._selectionWindow.setEnabled(true); | 174 this._selectionWindow.setEnabled(true); |
| 175 this._progressBanner.classList.remove('hidden'); | 175 this._progressBanner.classList.remove('hidden'); |
| 176 this._updateImage(); | 176 this._updateImage(); |
| 177 snapshot.profile(clipRect, onProfileDone.bind(this)); | 177 snapshot.profile(clipRect, onProfileDone.bind(this)); |
| 178 /** | 178 /** |
| 179 * @param {!Array.<!Protocol.LayerTree.PaintProfile>=} profiles | 179 * @param {!Array.<!Protocol.LayerTree.PaintProfile>=} profiles |
| 180 * @this {WebInspector.PaintProfilerView} | 180 * @this {LayerViewer.PaintProfilerView} |
| 181 */ | 181 */ |
| 182 function onProfileDone(profiles) { | 182 function onProfileDone(profiles) { |
| 183 this._progressBanner.classList.add('hidden'); | 183 this._progressBanner.classList.add('hidden'); |
| 184 this._profiles = profiles; | 184 this._profiles = profiles; |
| 185 this._update(); | 185 this._update(); |
| 186 this._updatePieChart(); | 186 this._updatePieChart(); |
| 187 } | 187 } |
| 188 } | 188 } |
| 189 | 189 |
| 190 /** | 190 /** |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 barHeightByCategory[i][categoryName] *= (barTimes[i] * scale + this._min
BarHeight) / barTimes[i]; | 247 barHeightByCategory[i][categoryName] *= (barTimes[i] * scale + this._min
BarHeight) / barTimes[i]; |
| 248 this._renderBar(i, barHeightByCategory[i]); | 248 this._renderBar(i, barHeightByCategory[i]); |
| 249 } | 249 } |
| 250 } | 250 } |
| 251 | 251 |
| 252 /** | 252 /** |
| 253 * @param {number} index | 253 * @param {number} index |
| 254 * @param {!Object.<string, number>} heightByCategory | 254 * @param {!Object.<string, number>} heightByCategory |
| 255 */ | 255 */ |
| 256 _renderBar(index, heightByCategory) { | 256 _renderBar(index, heightByCategory) { |
| 257 var categories = WebInspector.PaintProfilerView.categories(); | 257 var categories = LayerViewer.PaintProfilerView.categories(); |
| 258 var currentHeight = 0; | 258 var currentHeight = 0; |
| 259 var x = this._barPaddingWidth + index * this._outerBarWidth; | 259 var x = this._barPaddingWidth + index * this._outerBarWidth; |
| 260 for (var categoryName in categories) { | 260 for (var categoryName in categories) { |
| 261 if (!heightByCategory[categoryName]) | 261 if (!heightByCategory[categoryName]) |
| 262 continue; | 262 continue; |
| 263 currentHeight += heightByCategory[categoryName]; | 263 currentHeight += heightByCategory[categoryName]; |
| 264 var y = this._canvas.height - currentHeight; | 264 var y = this._canvas.height - currentHeight; |
| 265 this._context.fillStyle = categories[categoryName].color; | 265 this._context.fillStyle = categories[categoryName].color; |
| 266 this._context.fillRect(x, y, this._innerBarWidth, heightByCategory[categor
yName]); | 266 this._context.fillRect(x, y, this._innerBarWidth, heightByCategory[categor
yName]); |
| 267 } | 267 } |
| 268 } | 268 } |
| 269 | 269 |
| 270 _onWindowChanged() { | 270 _onWindowChanged() { |
| 271 this.dispatchEventToListeners(WebInspector.PaintProfilerView.Events.WindowCh
anged); | 271 this.dispatchEventToListeners(LayerViewer.PaintProfilerView.Events.WindowCha
nged); |
| 272 this._updatePieChart(); | 272 this._updatePieChart(); |
| 273 if (this._updateImageTimer) | 273 if (this._updateImageTimer) |
| 274 return; | 274 return; |
| 275 this._updateImageTimer = setTimeout(this._updateImage.bind(this), 100); | 275 this._updateImageTimer = setTimeout(this._updateImage.bind(this), 100); |
| 276 } | 276 } |
| 277 | 277 |
| 278 _updatePieChart() { | 278 _updatePieChart() { |
| 279 var window = this.selectionWindow(); | 279 var window = this.selectionWindow(); |
| 280 if (!this._profiles || !this._profiles.length || !window) | 280 if (!this._profiles || !this._profiles.length || !window) |
| 281 return; | 281 return; |
| 282 var totalTime = 0; | 282 var totalTime = 0; |
| 283 var timeByCategory = {}; | 283 var timeByCategory = {}; |
| 284 for (var i = window.left; i < window.right; ++i) { | 284 for (var i = window.left; i < window.right; ++i) { |
| 285 var logEntry = this._log[i]; | 285 var logEntry = this._log[i]; |
| 286 var category = WebInspector.PaintProfilerView._categoryForLogItem(logEntry
); | 286 var category = LayerViewer.PaintProfilerView._categoryForLogItem(logEntry)
; |
| 287 timeByCategory[category.color] = timeByCategory[category.color] || 0; | 287 timeByCategory[category.color] = timeByCategory[category.color] || 0; |
| 288 for (var j = 0; j < this._profiles.length; ++j) { | 288 for (var j = 0; j < this._profiles.length; ++j) { |
| 289 var time = this._profiles[j][logEntry.commandIndex]; | 289 var time = this._profiles[j][logEntry.commandIndex]; |
| 290 totalTime += time; | 290 totalTime += time; |
| 291 timeByCategory[category.color] += time; | 291 timeByCategory[category.color] += time; |
| 292 } | 292 } |
| 293 } | 293 } |
| 294 this._pieChart.setTotal(totalTime / this._profiles.length); | 294 this._pieChart.setTotal(totalTime / this._profiles.length); |
| 295 for (var color in timeByCategory) | 295 for (var color in timeByCategory) |
| 296 this._pieChart.addSlice(timeByCategory[color] / this._profiles.length, col
or); | 296 this._pieChart.addSlice(timeByCategory[color] / this._profiles.length, col
or); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 if (this._snapshot) | 343 if (this._snapshot) |
| 344 this._snapshot.release(); | 344 this._snapshot.release(); |
| 345 this._snapshot = null; | 345 this._snapshot = null; |
| 346 this._profiles = null; | 346 this._profiles = null; |
| 347 this._selectionWindow.reset(); | 347 this._selectionWindow.reset(); |
| 348 this._selectionWindow.setEnabled(false); | 348 this._selectionWindow.setEnabled(false); |
| 349 } | 349 } |
| 350 }; | 350 }; |
| 351 | 351 |
| 352 /** @enum {symbol} */ | 352 /** @enum {symbol} */ |
| 353 WebInspector.PaintProfilerView.Events = { | 353 LayerViewer.PaintProfilerView.Events = { |
| 354 WindowChanged: Symbol('WindowChanged') | 354 WindowChanged: Symbol('WindowChanged') |
| 355 }; | 355 }; |
| 356 | 356 |
| 357 /** | 357 /** |
| 358 * @unrestricted | 358 * @unrestricted |
| 359 */ | 359 */ |
| 360 WebInspector.PaintProfilerCommandLogView = class extends WebInspector.ThrottledW
idget { | 360 LayerViewer.PaintProfilerCommandLogView = class extends UI.ThrottledWidget { |
| 361 constructor() { | 361 constructor() { |
| 362 super(); | 362 super(); |
| 363 this.setMinimumSize(100, 25); | 363 this.setMinimumSize(100, 25); |
| 364 this.element.classList.add('overflow-auto'); | 364 this.element.classList.add('overflow-auto'); |
| 365 | 365 |
| 366 this._treeOutline = new TreeOutlineInShadow(); | 366 this._treeOutline = new TreeOutlineInShadow(); |
| 367 this.element.appendChild(this._treeOutline.element); | 367 this.element.appendChild(this._treeOutline.element); |
| 368 | 368 |
| 369 this._log = []; | 369 this._log = []; |
| 370 } | 370 } |
| 371 | 371 |
| 372 /** | 372 /** |
| 373 * @param {?WebInspector.Target} target | 373 * @param {?SDK.Target} target |
| 374 * @param {!Array.<!WebInspector.PaintProfilerLogItem>} log | 374 * @param {!Array.<!SDK.PaintProfilerLogItem>} log |
| 375 */ | 375 */ |
| 376 setCommandLog(target, log) { | 376 setCommandLog(target, log) { |
| 377 this._target = target; | 377 this._target = target; |
| 378 this._log = log; | 378 this._log = log; |
| 379 /** @type {!Map<!WebInspector.PaintProfilerLogItem>} */ | 379 /** @type {!Map<!SDK.PaintProfilerLogItem>} */ |
| 380 this._treeItemCache = new Map(); | 380 this._treeItemCache = new Map(); |
| 381 this.updateWindow({left: 0, right: this._log.length}); | 381 this.updateWindow({left: 0, right: this._log.length}); |
| 382 } | 382 } |
| 383 | 383 |
| 384 /** | 384 /** |
| 385 * @param {!WebInspector.PaintProfilerLogItem} logItem | 385 * @param {!SDK.PaintProfilerLogItem} logItem |
| 386 */ | 386 */ |
| 387 _appendLogItem(logItem) { | 387 _appendLogItem(logItem) { |
| 388 var treeElement = this._treeItemCache.get(logItem); | 388 var treeElement = this._treeItemCache.get(logItem); |
| 389 if (!treeElement) { | 389 if (!treeElement) { |
| 390 treeElement = new WebInspector.LogTreeElement(this, logItem); | 390 treeElement = new LayerViewer.LogTreeElement(this, logItem); |
| 391 this._treeItemCache.set(logItem, treeElement); | 391 this._treeItemCache.set(logItem, treeElement); |
| 392 } else if (treeElement.parent) { | 392 } else if (treeElement.parent) { |
| 393 return; | 393 return; |
| 394 } | 394 } |
| 395 this._treeOutline.appendChild(treeElement); | 395 this._treeOutline.appendChild(treeElement); |
| 396 } | 396 } |
| 397 | 397 |
| 398 /** | 398 /** |
| 399 * @param {?{left: number, right: number}} selectionWindow | 399 * @param {?{left: number, right: number}} selectionWindow |
| 400 */ | 400 */ |
| (...skipping 26 matching lines...) Expand all Loading... |
| 427 } | 427 } |
| 428 for (var i = this._selectionWindow.left, right = this._selectionWindow.right
; i < right; ++i) | 428 for (var i = this._selectionWindow.left, right = this._selectionWindow.right
; i < right; ++i) |
| 429 this._appendLogItem(this._log[i]); | 429 this._appendLogItem(this._log[i]); |
| 430 return Promise.resolve(); | 430 return Promise.resolve(); |
| 431 } | 431 } |
| 432 }; | 432 }; |
| 433 | 433 |
| 434 /** | 434 /** |
| 435 * @unrestricted | 435 * @unrestricted |
| 436 */ | 436 */ |
| 437 WebInspector.LogTreeElement = class extends TreeElement { | 437 LayerViewer.LogTreeElement = class extends TreeElement { |
| 438 /** | 438 /** |
| 439 * @param {!WebInspector.PaintProfilerCommandLogView} ownerView | 439 * @param {!LayerViewer.PaintProfilerCommandLogView} ownerView |
| 440 * @param {!WebInspector.PaintProfilerLogItem} logItem | 440 * @param {!SDK.PaintProfilerLogItem} logItem |
| 441 */ | 441 */ |
| 442 constructor(ownerView, logItem) { | 442 constructor(ownerView, logItem) { |
| 443 super('', !!logItem.params); | 443 super('', !!logItem.params); |
| 444 this._logItem = logItem; | 444 this._logItem = logItem; |
| 445 this._ownerView = ownerView; | 445 this._ownerView = ownerView; |
| 446 this._filled = false; | 446 this._filled = false; |
| 447 } | 447 } |
| 448 | 448 |
| 449 /** | 449 /** |
| 450 * @override | 450 * @override |
| 451 */ | 451 */ |
| 452 onattach() { | 452 onattach() { |
| 453 this._update(); | 453 this._update(); |
| 454 } | 454 } |
| 455 | 455 |
| 456 /** | 456 /** |
| 457 * @override | 457 * @override |
| 458 */ | 458 */ |
| 459 onpopulate() { | 459 onpopulate() { |
| 460 for (var param in this._logItem.params) | 460 for (var param in this._logItem.params) |
| 461 WebInspector.LogPropertyTreeElement._appendLogPropertyItem(this, param, th
is._logItem.params[param]); | 461 LayerViewer.LogPropertyTreeElement._appendLogPropertyItem(this, param, thi
s._logItem.params[param]); |
| 462 } | 462 } |
| 463 | 463 |
| 464 /** | 464 /** |
| 465 * @param {*} param | 465 * @param {*} param |
| 466 * @param {string} name | 466 * @param {string} name |
| 467 * @return {string} | 467 * @return {string} |
| 468 */ | 468 */ |
| 469 _paramToString(param, name) { | 469 _paramToString(param, name) { |
| 470 if (typeof param !== 'object') | 470 if (typeof param !== 'object') |
| 471 return typeof param === 'string' && param.length > 100 ? name : JSON.strin
gify(param); | 471 return typeof param === 'string' && param.length > 100 ? name : JSON.strin
gify(param); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 499 _update() { | 499 _update() { |
| 500 var title = createDocumentFragment(); | 500 var title = createDocumentFragment(); |
| 501 title.createTextChild(this._logItem.method + '(' + this._paramsToString(this
._logItem.params) + ')'); | 501 title.createTextChild(this._logItem.method + '(' + this._paramsToString(this
._logItem.params) + ')'); |
| 502 this.title = title; | 502 this.title = title; |
| 503 } | 503 } |
| 504 }; | 504 }; |
| 505 | 505 |
| 506 /** | 506 /** |
| 507 * @unrestricted | 507 * @unrestricted |
| 508 */ | 508 */ |
| 509 WebInspector.LogPropertyTreeElement = class extends TreeElement { | 509 LayerViewer.LogPropertyTreeElement = class extends TreeElement { |
| 510 /** | 510 /** |
| 511 * @param {!{name: string, value}} property | 511 * @param {!{name: string, value}} property |
| 512 */ | 512 */ |
| 513 constructor(property) { | 513 constructor(property) { |
| 514 super(); | 514 super(); |
| 515 this._property = property; | 515 this._property = property; |
| 516 } | 516 } |
| 517 | 517 |
| 518 /** | 518 /** |
| 519 * @param {!TreeElement} element | 519 * @param {!TreeElement} element |
| 520 * @param {string} name | 520 * @param {string} name |
| 521 * @param {*} value | 521 * @param {*} value |
| 522 */ | 522 */ |
| 523 static _appendLogPropertyItem(element, name, value) { | 523 static _appendLogPropertyItem(element, name, value) { |
| 524 var treeElement = new WebInspector.LogPropertyTreeElement({name: name, value
: value}); | 524 var treeElement = new LayerViewer.LogPropertyTreeElement({name: name, value:
value}); |
| 525 element.appendChild(treeElement); | 525 element.appendChild(treeElement); |
| 526 if (value && typeof value === 'object') { | 526 if (value && typeof value === 'object') { |
| 527 for (var property in value) | 527 for (var property in value) |
| 528 WebInspector.LogPropertyTreeElement._appendLogPropertyItem(treeElement,
property, value[property]); | 528 LayerViewer.LogPropertyTreeElement._appendLogPropertyItem(treeElement, p
roperty, value[property]); |
| 529 } | 529 } |
| 530 } | 530 } |
| 531 | 531 |
| 532 /** | 532 /** |
| 533 * @override | 533 * @override |
| 534 */ | 534 */ |
| 535 onattach() { | 535 onattach() { |
| 536 var title = createDocumentFragment(); | 536 var title = createDocumentFragment(); |
| 537 var nameElement = title.createChild('span', 'name'); | 537 var nameElement = title.createChild('span', 'name'); |
| 538 nameElement.textContent = this._property.name; | 538 nameElement.textContent = this._property.name; |
| 539 var separatorElement = title.createChild('span', 'separator'); | 539 var separatorElement = title.createChild('span', 'separator'); |
| 540 separatorElement.textContent = ': '; | 540 separatorElement.textContent = ': '; |
| 541 if (this._property.value === null || typeof this._property.value !== 'object
') { | 541 if (this._property.value === null || typeof this._property.value !== 'object
') { |
| 542 var valueElement = title.createChild('span', 'value'); | 542 var valueElement = title.createChild('span', 'value'); |
| 543 valueElement.textContent = JSON.stringify(this._property.value); | 543 valueElement.textContent = JSON.stringify(this._property.value); |
| 544 valueElement.classList.add('cm-js-' + (this._property.value === null ? 'nu
ll' : typeof this._property.value)); | 544 valueElement.classList.add('cm-js-' + (this._property.value === null ? 'nu
ll' : typeof this._property.value)); |
| 545 } | 545 } |
| 546 this.title = title; | 546 this.title = title; |
| 547 } | 547 } |
| 548 }; | 548 }; |
| 549 | 549 |
| 550 | 550 |
| 551 /** | 551 /** |
| 552 * @unrestricted | 552 * @unrestricted |
| 553 */ | 553 */ |
| 554 WebInspector.PaintProfilerCategory = class { | 554 LayerViewer.PaintProfilerCategory = class { |
| 555 /** | 555 /** |
| 556 * @param {string} name | 556 * @param {string} name |
| 557 * @param {string} title | 557 * @param {string} title |
| 558 * @param {string} color | 558 * @param {string} color |
| 559 */ | 559 */ |
| 560 constructor(name, title, color) { | 560 constructor(name, title, color) { |
| 561 this.name = name; | 561 this.name = name; |
| 562 this.title = title; | 562 this.title = title; |
| 563 this.color = color; | 563 this.color = color; |
| 564 } | 564 } |
| 565 }; | 565 }; |
| OLD | NEW |