OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * Copyright (C) 2012 Intel Inc. All rights reserved. | 3 * Copyright (C) 2012 Intel Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 16 matching lines...) Expand all Loading... |
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 */ | 30 */ |
31 | 31 |
32 /** | 32 /** |
33 * @constructor | 33 * @constructor |
34 * @extends {WebInspector.View} | 34 * @extends {WebInspector.View} |
35 * @implements {WebInspector.TimelineModeView} | 35 * @implements {WebInspector.TimelineModeView} |
36 * @param {!WebInspector.TimelineModeViewDelegate} delegate | 36 * @param {!WebInspector.TimelineModeViewDelegate} delegate |
| 37 * @param {!WebInspector.TimelineModel} model |
37 * @param {!WebInspector.TimelinePresentationModel} presentationModel | 38 * @param {!WebInspector.TimelinePresentationModel} presentationModel |
38 * @param {?WebInspector.TimelineFrameModel} frameModel | 39 * @param {?WebInspector.TimelineFrameModel} frameModel |
39 */ | 40 */ |
40 WebInspector.TimelineView = function(delegate, presentationModel, frameModel) | 41 WebInspector.TimelineView = function(delegate, model, presentationModel, frameMo
del) |
41 { | 42 { |
42 WebInspector.View.call(this); | 43 WebInspector.View.call(this); |
43 this.element.classList.add("timeline-view"); | 44 this.element.classList.add("timeline-view"); |
44 this.element.classList.add("hbox"); | 45 this.element.classList.add("hbox"); |
45 | 46 |
46 this._delegate = delegate; | 47 this._delegate = delegate; |
| 48 this._model = model; |
47 this._presentationModel = presentationModel; | 49 this._presentationModel = presentationModel; |
48 this._frameModel = frameModel; | 50 this._frameModel = frameModel; |
49 this._calculator = new WebInspector.TimelineCalculator(this._presentationMod
el); | 51 this._calculator = new WebInspector.TimelineCalculator(this._presentationMod
el); |
50 this._linkifier = new WebInspector.Linkifier(); | 52 this._linkifier = new WebInspector.Linkifier(); |
51 | 53 |
52 this._boundariesAreValid = true; | 54 this._boundariesAreValid = true; |
53 this._scrollTop = 0; | 55 this._scrollTop = 0; |
54 | 56 |
55 this._recordsView = this._createRecordsView(); | 57 this._recordsView = this._createRecordsView(); |
56 this._recordsView.addEventListener(WebInspector.SplitView.Events.SidebarSize
Changed, this._sidebarResized, this); | 58 this._recordsView.addEventListener(WebInspector.SplitView.Events.SidebarSize
Changed, this._sidebarResized, this); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 var clientWidth = this._graphRowsElementWidth; | 127 var clientWidth = this._graphRowsElementWidth; |
126 var dividers = []; | 128 var dividers = []; |
127 var eventDividerRecords = this._presentationModel.eventDividerRecords(); | 129 var eventDividerRecords = this._presentationModel.eventDividerRecords(); |
128 | 130 |
129 for (var i = 0; i < eventDividerRecords.length; ++i) { | 131 for (var i = 0; i < eventDividerRecords.length; ++i) { |
130 var record = eventDividerRecords[i]; | 132 var record = eventDividerRecords[i]; |
131 var positions = this._calculator.computeBarGraphWindowPosition(recor
d); | 133 var positions = this._calculator.computeBarGraphWindowPosition(recor
d); |
132 var dividerPosition = Math.round(positions.left); | 134 var dividerPosition = Math.round(positions.left); |
133 if (dividerPosition < 0 || dividerPosition >= clientWidth || divider
s[dividerPosition]) | 135 if (dividerPosition < 0 || dividerPosition >= clientWidth || divider
s[dividerPosition]) |
134 continue; | 136 continue; |
135 var divider = WebInspector.TimelineUIUtils.createEventDivider(record
.type, WebInspector.TimelineUIUtils.recordTitle(this._presentationModel, record)
); | 137 var divider = WebInspector.TimelineUIUtils.createEventDivider(record
.type, WebInspector.TimelineUIUtils.recordTitle(this._model, record)); |
136 divider.style.left = dividerPosition + "px"; | 138 divider.style.left = dividerPosition + "px"; |
137 dividers[dividerPosition] = divider; | 139 dividers[dividerPosition] = divider; |
138 } | 140 } |
139 this._timelineGrid.addEventDividers(dividers); | 141 this._timelineGrid.addEventDividers(dividers); |
140 }, | 142 }, |
141 | 143 |
142 _updateFrameBars: function(frames) | 144 _updateFrameBars: function(frames) |
143 { | 145 { |
144 var clientWidth = this._graphRowsElementWidth; | 146 var clientWidth = this._graphRowsElementWidth; |
145 if (this._frameContainer) | 147 if (this._frameContainer) |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 */ | 798 */ |
797 _showPopover: function(anchor, popover) | 799 _showPopover: function(anchor, popover) |
798 { | 800 { |
799 if (anchor.classList.contains("timeline-frame-strip")) { | 801 if (anchor.classList.contains("timeline-frame-strip")) { |
800 var frame = anchor._frame; | 802 var frame = anchor._frame; |
801 popover.show(WebInspector.TimelineUIUtils.generatePopupContentForFra
me(frame), anchor); | 803 popover.show(WebInspector.TimelineUIUtils.generatePopupContentForFra
me(frame), anchor); |
802 } else { | 804 } else { |
803 if (anchor.row && anchor.row._record) | 805 if (anchor.row && anchor.row._record) |
804 anchor.row._record.generatePopupContent(this._linkifier, showCal
lback); | 806 anchor.row._record.generatePopupContent(this._linkifier, showCal
lback); |
805 else if (anchor._tasksInfo) | 807 else if (anchor._tasksInfo) |
806 popover.show(WebInspector.TimelineUIUtils.generateMainThreadBarP
opupContent(this._presentationModel, anchor._tasksInfo), anchor, null, null, Web
Inspector.Popover.Orientation.Bottom); | 808 popover.show(WebInspector.TimelineUIUtils.generateMainThreadBarP
opupContent(this._model, anchor._tasksInfo), anchor, null, null, WebInspector.Po
pover.Orientation.Bottom); |
807 } | 809 } |
808 | 810 |
809 function showCallback(popupContent) | 811 function showCallback(popupContent) |
810 { | 812 { |
811 popover.show(popupContent, anchor); | 813 popover.show(popupContent, anchor); |
812 } | 814 } |
813 }, | 815 }, |
814 | 816 |
815 _closeRecordDetails: function() | 817 _closeRecordDetails: function() |
816 { | 818 { |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 this._element.classList.remove("hidden"); | 1242 this._element.classList.remove("hidden"); |
1241 } else | 1243 } else |
1242 this._element.classList.add("hidden"); | 1244 this._element.classList.add("hidden"); |
1243 }, | 1245 }, |
1244 | 1246 |
1245 _dispose: function() | 1247 _dispose: function() |
1246 { | 1248 { |
1247 this._element.remove(); | 1249 this._element.remove(); |
1248 } | 1250 } |
1249 } | 1251 } |
OLD | NEW |