| 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 * @implements {Timeline.TimelineModeView} | 6 * @implements {Timeline.TimelineModeView} |
| 7 * @implements {PerfUI.FlameChartDelegate} | 7 * @implements {PerfUI.FlameChartDelegate} |
| 8 * @implements {UI.Searchable} | 8 * @implements {UI.Searchable} |
| 9 * @unrestricted | 9 * @unrestricted |
| 10 */ | 10 */ |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 * @return {string} | 118 * @return {string} |
| 119 */ | 119 */ |
| 120 function colorByProduct(event) { | 120 function colorByProduct(event) { |
| 121 if (event.name !== TimelineModel.TimelineModel.RecordType.JSFrame) | 121 if (event.name !== TimelineModel.TimelineModel.RecordType.JSFrame) |
| 122 return Timeline.TimelineUIUtils.eventStyle(event).category.color; | 122 return Timeline.TimelineUIUtils.eventStyle(event).category.color; |
| 123 var frame = event.args['data']; | 123 var frame = event.args['data']; |
| 124 if (!Timeline.TimelineUIUtils.isUserFrame(frame)) | 124 if (!Timeline.TimelineUIUtils.isUserFrame(frame)) |
| 125 return Timeline.TimelineUIUtils.eventStyle(event).category.color; | 125 return Timeline.TimelineUIUtils.eventStyle(event).category.color; |
| 126 var color = this._urlToColorCache.get(frame.url); | 126 var color = this._urlToColorCache.get(frame.url); |
| 127 if (!color) { | 127 if (!color) { |
| 128 var defaultColor = '#f2ecdc'; | |
| 129 if (!this._productRegistry) | 128 if (!this._productRegistry) |
| 130 return defaultColor; | 129 return Timeline.TimelineUIUtils.colorForId(''); |
| 131 var parsedURL = frame.url.asParsedURL(); | 130 var parsedURL = frame.url.asParsedURL(); |
| 132 var name = parsedURL && this._productRegistry.nameForUrl(parsedURL); | 131 var name = parsedURL && this._productRegistry.nameForUrl(parsedURL) || '
'; |
| 133 color = name ? Timeline.TimelineUIUtils.colorForId(name) : defaultColor; | 132 color = Timeline.TimelineUIUtils.colorForId(name); |
| 134 this._urlToColorCache.set(frame.url, color); | 133 this._urlToColorCache.set(frame.url, color); |
| 135 } | 134 } |
| 136 return color; | 135 return color; |
| 137 } | 136 } |
| 138 } | 137 } |
| 139 | 138 |
| 140 /** | 139 /** |
| 141 * @override | 140 * @override |
| 142 * @return {?Element} | 141 * @return {?Element} |
| 143 */ | 142 */ |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 } | 587 } |
| 589 context.restore(); | 588 context.restore(); |
| 590 } | 589 } |
| 591 }; | 590 }; |
| 592 | 591 |
| 593 /** @enum {string} */ | 592 /** @enum {string} */ |
| 594 Timeline.TimelineFlameChartView._ColorBy = { | 593 Timeline.TimelineFlameChartView._ColorBy = { |
| 595 URL: 'URL', | 594 URL: 'URL', |
| 596 Product: 'Product' | 595 Product: 'Product' |
| 597 }; | 596 }; |
| OLD | NEW |