Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Side by Side Diff: Source/devtools/front_end/timeline/TimelineEventOverview.js

Issue 344443007: Encapsulate implementation-specific timeline record handling in TimelineUIUtils (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
35 */ 36 */
36 WebInspector.TimelineEventOverview = function(model) 37 WebInspector.TimelineEventOverview = function(model, uiUtils)
37 { 38 {
38 WebInspector.TimelineOverviewBase.call(this, model); 39 WebInspector.TimelineOverviewBase.call(this, model);
39 40 this._uiUtils = uiUtils;
40 this.element.id = "timeline-overview-events"; 41 this.element.id = "timeline-overview-events";
41 42
42 this._fillStyles = {}; 43 this._fillStyles = {};
43 var categories = WebInspector.TimelineUIUtils.categories(); 44 var categories = WebInspector.TimelineUIUtils.categories();
44 for (var category in categories) { 45 for (var category in categories) {
45 this._fillStyles[category] = WebInspector.TimelineUIUtils.createFillStyl eForCategory(this._context, 0, WebInspector.TimelineEventOverview._stripGradient Height, categories[category]); 46 this._fillStyles[category] = WebInspector.TimelineUIUtils.createFillStyl eForCategory(this._context, 0, WebInspector.TimelineEventOverview._stripGradient Height, categories[category]);
46 categories[category].addEventListener(WebInspector.TimelineCategory.Even ts.VisibilityChanged, this._onCategoryVisibilityChanged, this); 47 categories[category].addEventListener(WebInspector.TimelineCategory.Even ts.VisibilityChanged, this._onCategoryVisibilityChanged, this);
47 } 48 }
48 49
49 this._disabledCategoryFillStyle = WebInspector.TimelineUIUtils.createFillSty le(this._context, 0, WebInspector.TimelineEventOverview._stripGradientHeight, 50 this._disabledCategoryFillStyle = WebInspector.TimelineUIUtils.createFillSty le(this._context, 0, WebInspector.TimelineEventOverview._stripGradientHeight,
(...skipping 30 matching lines...) Expand all
80 this._context.fillStyle = "rgba(0, 0, 0, 0.05)"; 81 this._context.fillStyle = "rgba(0, 0, 0, 0.05)";
81 for (var i = 1; i < WebInspector.TimelineEventOverview._numberOfStrips; i += 2) 82 for (var i = 1; i < WebInspector.TimelineEventOverview._numberOfStrips; i += 2)
82 this._context.fillRect(0.5, i * stripHeight + 0.5, this._canvas.widt h, stripHeight); 83 this._context.fillRect(0.5, i * stripHeight + 0.5, this._canvas.widt h, stripHeight);
83 84
84 /** 85 /**
85 * @param {!WebInspector.TimelineModel.Record} record 86 * @param {!WebInspector.TimelineModel.Record} record
86 * @this {WebInspector.TimelineEventOverview} 87 * @this {WebInspector.TimelineEventOverview}
87 */ 88 */
88 function appendRecord(record) 89 function appendRecord(record)
89 { 90 {
90 if (record.type() === WebInspector.TimelineModel.RecordType.BeginFra me) 91 if (this._uiUtils.isBeginFrame(record))
91 return; 92 return;
92 var recordStart = Math.floor((record.startTime() - timeOffset) * sca le); 93 var recordStart = Math.floor((record.startTime() - timeOffset) * sca le);
93 var recordEnd = Math.ceil((record.endTime() - timeOffset) * scale); 94 var recordEnd = Math.ceil((record.endTime() - timeOffset) * scale);
94 var category = record.category(); 95 var category = record.category();
95 if (category.overviewStripGroupIndex < 0) 96 if (category.overviewStripGroupIndex < 0)
96 return; 97 return;
97 var bar = lastBarByGroup[category.overviewStripGroupIndex]; 98 var bar = lastBarByGroup[category.overviewStripGroupIndex];
98 // This bar may be merged with previous -- so just adjust the previo us bar. 99 // This bar may be merged with previous -- so just adjust the previo us bar.
99 if (bar) { 100 if (bar) {
100 // If record fits entirely into previous bar just absorb it igno ring the category match. 101 // If record fits entirely into previous bar just absorb it igno ring the category match.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 this._context.moveTo(0, 0); 146 this._context.moveTo(0, 0);
146 this._context.lineTo(width, 0); 147 this._context.lineTo(width, 0);
147 this._context.moveTo(0, WebInspector.TimelineEventOverview._stripGradien tHeight); 148 this._context.moveTo(0, WebInspector.TimelineEventOverview._stripGradien tHeight);
148 this._context.lineTo(width, WebInspector.TimelineEventOverview._stripGra dientHeight); 149 this._context.lineTo(width, WebInspector.TimelineEventOverview._stripGra dientHeight);
149 this._context.stroke(); 150 this._context.stroke();
150 this._context.restore(); 151 this._context.restore();
151 }, 152 },
152 153
153 __proto__: WebInspector.TimelineOverviewBase.prototype 154 __proto__: WebInspector.TimelineOverviewBase.prototype
154 } 155 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698