| 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 14 matching lines...) Expand all Loading... |
| 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 * @constructor | 32 * @constructor |
| 33 * @extends {WebInspector.TimelineOverviewBase} | 33 * @extends {WebInspector.TimelineOverviewBase} |
| 34 * @param {!WebInspector.TimelineModel} model | 34 * @param {!WebInspector.TimelineModel} model |
| 35 * @param {!WebInspector.TimelineUIUtils} uiUtils | |
| 36 */ | 35 */ |
| 37 WebInspector.TimelineEventOverview = function(model, uiUtils) | 36 WebInspector.TimelineEventOverview = function(model) |
| 38 { | 37 { |
| 39 WebInspector.TimelineOverviewBase.call(this, model); | 38 WebInspector.TimelineOverviewBase.call(this, model); |
| 40 this._uiUtils = uiUtils; | |
| 41 this.element.id = "timeline-overview-events"; | 39 this.element.id = "timeline-overview-events"; |
| 42 | 40 |
| 43 this._fillStyles = {}; | 41 this._fillStyles = {}; |
| 44 var categories = WebInspector.TimelineUIUtils.categories(); | 42 var categories = WebInspector.TimelineUIUtils.categories(); |
| 45 for (var category in categories) { | 43 for (var category in categories) { |
| 46 this._fillStyles[category] = WebInspector.TimelineUIUtils.createFillStyl
eForCategory(this._context, 0, WebInspector.TimelineEventOverview._stripGradient
Height, categories[category]); | 44 this._fillStyles[category] = WebInspector.TimelineUIUtils.createFillStyl
eForCategory(this._context, 0, WebInspector.TimelineEventOverview._stripGradient
Height, categories[category]); |
| 47 categories[category].addEventListener(WebInspector.TimelineCategory.Even
ts.VisibilityChanged, this._onCategoryVisibilityChanged, this); | 45 categories[category].addEventListener(WebInspector.TimelineCategory.Even
ts.VisibilityChanged, this._onCategoryVisibilityChanged, this); |
| 48 } | 46 } |
| 49 | 47 |
| 50 this._disabledCategoryFillStyle = WebInspector.TimelineUIUtils.createFillSty
le(this._context, 0, WebInspector.TimelineEventOverview._stripGradientHeight, | 48 this._disabledCategoryFillStyle = WebInspector.TimelineUIUtils.createFillSty
le(this._context, 0, WebInspector.TimelineEventOverview._stripGradientHeight, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 81 this._context.fillStyle = "rgba(0, 0, 0, 0.05)"; | 79 this._context.fillStyle = "rgba(0, 0, 0, 0.05)"; |
| 82 for (var i = 1; i < WebInspector.TimelineEventOverview._numberOfStrips;
i += 2) | 80 for (var i = 1; i < WebInspector.TimelineEventOverview._numberOfStrips;
i += 2) |
| 83 this._context.fillRect(0.5, i * stripHeight + 0.5, this._canvas.widt
h, stripHeight); | 81 this._context.fillRect(0.5, i * stripHeight + 0.5, this._canvas.widt
h, stripHeight); |
| 84 | 82 |
| 85 /** | 83 /** |
| 86 * @param {!WebInspector.TimelineModel.Record} record | 84 * @param {!WebInspector.TimelineModel.Record} record |
| 87 * @this {WebInspector.TimelineEventOverview} | 85 * @this {WebInspector.TimelineEventOverview} |
| 88 */ | 86 */ |
| 89 function appendRecord(record) | 87 function appendRecord(record) |
| 90 { | 88 { |
| 91 if (this._uiUtils.isBeginFrame(record)) | 89 if (record.type() === WebInspector.TracingTimelineModel.RecordType.B
eginFrame) |
| 92 return; | 90 return; |
| 93 var recordStart = Math.floor((record.startTime() - timeOffset) * sca
le); | 91 var recordStart = Math.floor((record.startTime() - timeOffset) * sca
le); |
| 94 var recordEnd = Math.ceil((record.endTime() - timeOffset) * scale); | 92 var recordEnd = Math.ceil((record.endTime() - timeOffset) * scale); |
| 95 var category = this._uiUtils.categoryForRecord(record); | 93 var category = WebInspector.TimelineUIUtils.categoryForRecord(record
); |
| 96 if (category.overviewStripGroupIndex < 0) | 94 if (category.overviewStripGroupIndex < 0) |
| 97 return; | 95 return; |
| 98 var bar = lastBarByGroup[category.overviewStripGroupIndex]; | 96 var bar = lastBarByGroup[category.overviewStripGroupIndex]; |
| 99 // This bar may be merged with previous -- so just adjust the previo
us bar. | 97 // This bar may be merged with previous -- so just adjust the previo
us bar. |
| 100 if (bar) { | 98 if (bar) { |
| 101 // If record fits entirely into previous bar just absorb it igno
ring the category match. | 99 // If record fits entirely into previous bar just absorb it igno
ring the category match. |
| 102 if (recordEnd <= bar.end) | 100 if (recordEnd <= bar.end) |
| 103 return; | 101 return; |
| 104 if (bar.category === category && recordStart <= bar.end) { | 102 if (bar.category === category && recordStart <= bar.end) { |
| 105 bar.end = recordEnd; | 103 bar.end = recordEnd; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 this._context.moveTo(0, 0); | 144 this._context.moveTo(0, 0); |
| 147 this._context.lineTo(width, 0); | 145 this._context.lineTo(width, 0); |
| 148 this._context.moveTo(0, WebInspector.TimelineEventOverview._stripGradien
tHeight); | 146 this._context.moveTo(0, WebInspector.TimelineEventOverview._stripGradien
tHeight); |
| 149 this._context.lineTo(width, WebInspector.TimelineEventOverview._stripGra
dientHeight); | 147 this._context.lineTo(width, WebInspector.TimelineEventOverview._stripGra
dientHeight); |
| 150 this._context.stroke(); | 148 this._context.stroke(); |
| 151 this._context.restore(); | 149 this._context.restore(); |
| 152 }, | 150 }, |
| 153 | 151 |
| 154 __proto__: WebInspector.TimelineOverviewBase.prototype | 152 __proto__: WebInspector.TimelineOverviewBase.prototype |
| 155 } | 153 } |
| OLD | NEW |