| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @unrestricted | 6 * @unrestricted |
| 7 */ | 7 */ |
| 8 Timeline.TimelineFlameChartNetworkDataProvider = class extends Timeline.Timeline
FlameChartDataProviderBase { | 8 Timeline.TimelineFlameChartNetworkDataProvider = class extends Timeline.Timeline
FlameChartDataProviderBase { |
| 9 /** | 9 /** |
| 10 * @param {!TimelineModel.TimelineModel} model | 10 * @param {!TimelineModel.TimelineModel} model |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 if (color) { | 191 if (color) { |
| 192 context.fillStyle = color; | 192 context.fillStyle = color; |
| 193 context.fillRect(sendStart + 0.5, barY + 0.5, 3.5, 3.5); | 193 context.fillRect(sendStart + 0.5, barY + 0.5, 3.5, 3.5); |
| 194 } | 194 } |
| 195 } | 195 } |
| 196 | 196 |
| 197 const textStart = Math.max(sendStart, 0); | 197 const textStart = Math.max(sendStart, 0); |
| 198 const textWidth = finish - textStart; | 198 const textWidth = finish - textStart; |
| 199 const minTextWidthPx = 20; | 199 const minTextWidthPx = 20; |
| 200 const textPadding = 6; | 200 const textPadding = 6; |
| 201 var gearPadding = 0; |
| 201 if (textWidth >= minTextWidthPx) { | 202 if (textWidth >= minTextWidthPx) { |
| 202 const text = this.entryTitle(index); | 203 const text = this.entryTitle(index); |
| 203 if (text && text.length) { | 204 if (text && text.length) { |
| 204 context.fillStyle = '#333'; | 205 context.fillStyle = '#333'; |
| 205 const trimmedText = UI.trimTextMiddle(context, text, textWidth - 2 * tex
tPadding); | |
| 206 const textBaseHeight = barHeight - this.textBaseline(); | 206 const textBaseHeight = barHeight - this.textBaseline(); |
| 207 context.fillText(trimmedText, textStart + textPadding, barY + textBaseHe
ight); | 207 if (request.fromServiceWorker) { |
| 208 context.fillText('⚙', textStart + textPadding, barY + textBaseHeight); |
| 209 gearPadding = UI.measureTextWidth(context, '⚙ '); |
| 210 } |
| 211 const trimmedText = UI.trimTextMiddle(context, text, textWidth - 2 * tex
tPadding - gearPadding); |
| 212 context.fillText(trimmedText, textStart + textPadding + gearPadding, bar
Y + textBaseHeight); |
| 208 } | 213 } |
| 209 } | 214 } |
| 210 | 215 |
| 211 return true; | 216 return true; |
| 212 } | 217 } |
| 213 | 218 |
| 214 /** | 219 /** |
| 215 * @override | 220 * @override |
| 216 * @param {number} index | 221 * @param {number} index |
| 217 * @return {boolean} | 222 * @return {boolean} |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 this._timelineData.entryLevels.push(this._requests.length - 1); | 321 this._timelineData.entryLevels.push(this._requests.length - 1); |
| 317 } | 322 } |
| 318 | 323 |
| 319 /** | 324 /** |
| 320 * @return {number} | 325 * @return {number} |
| 321 */ | 326 */ |
| 322 preferredHeight() { | 327 preferredHeight() { |
| 323 return this._style.height * (this._group.expanded ? Number.constrain(this._c
urrentLevel + 1, 4, 8) : 2) + 2; | 328 return this._style.height * (this._group.expanded ? Number.constrain(this._c
urrentLevel + 1, 4, 8) : 2) + 2; |
| 324 } | 329 } |
| 325 }; | 330 }; |
| OLD | NEW |