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 22 matching lines...) Expand all Loading... |
33 * @constructor | 33 * @constructor |
34 * @extends {WebInspector.HBox} | 34 * @extends {WebInspector.HBox} |
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.TimelineModel} model |
38 * @param {!WebInspector.TimelineUIUtils} uiUtils | 38 * @param {!WebInspector.TimelineUIUtils} uiUtils |
39 */ | 39 */ |
40 WebInspector.TimelineView = function(delegate, model, uiUtils) | 40 WebInspector.TimelineView = function(delegate, model, uiUtils) |
41 { | 41 { |
42 WebInspector.HBox.call(this); | 42 WebInspector.HBox.call(this); |
43 this._uiUtils = uiUtils; | |
44 this.element.classList.add("timeline-view"); | 43 this.element.classList.add("timeline-view"); |
45 | 44 |
46 this._delegate = delegate; | 45 this._delegate = delegate; |
47 this._model = model; | 46 this._model = model; |
| 47 this._uiUtils = uiUtils; |
48 this._presentationModel = new WebInspector.TimelinePresentationModel(model,
uiUtils); | 48 this._presentationModel = new WebInspector.TimelinePresentationModel(model,
uiUtils); |
49 this._calculator = new WebInspector.TimelineCalculator(model); | 49 this._calculator = new WebInspector.TimelineCalculator(model); |
50 this._linkifier = new WebInspector.Linkifier(); | 50 this._linkifier = new WebInspector.Linkifier(); |
51 this._frameStripByFrame = new Map(); | 51 this._frameStripByFrame = new Map(); |
52 | 52 |
53 this._boundariesAreValid = true; | 53 this._boundariesAreValid = true; |
54 this._scrollTop = 0; | 54 this._scrollTop = 0; |
55 | 55 |
56 this._recordsView = this._createRecordsView(); | 56 this._recordsView = this._createRecordsView(); |
57 this._recordsView.addEventListener(WebInspector.SplitView.Events.SidebarSize
Changed, this._sidebarResized, this); | 57 this._recordsView.addEventListener(WebInspector.SplitView.Events.SidebarSize
Changed, this._sidebarResized, this); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 var clientWidth = this._graphRowsElementWidth; | 128 var clientWidth = this._graphRowsElementWidth; |
129 var dividers = []; | 129 var dividers = []; |
130 var eventDividerRecords = this._model.eventDividerRecords(); | 130 var eventDividerRecords = this._model.eventDividerRecords(); |
131 | 131 |
132 for (var i = 0; i < eventDividerRecords.length; ++i) { | 132 for (var i = 0; i < eventDividerRecords.length; ++i) { |
133 var record = eventDividerRecords[i]; | 133 var record = eventDividerRecords[i]; |
134 var position = this._calculator.computePosition(record.startTime()); | 134 var position = this._calculator.computePosition(record.startTime()); |
135 var dividerPosition = Math.round(position); | 135 var dividerPosition = Math.round(position); |
136 if (dividerPosition < 0 || dividerPosition >= clientWidth || divider
s[dividerPosition]) | 136 if (dividerPosition < 0 || dividerPosition >= clientWidth || divider
s[dividerPosition]) |
137 continue; | 137 continue; |
138 var divider = this._uiUtils.createEventDivider(record.type(), record
.title()); | 138 var title = this._uiUtils.titleForRecord(record); |
| 139 var divider = this._uiUtils.createEventDivider(record.type(), title)
; |
139 divider.style.left = dividerPosition + "px"; | 140 divider.style.left = dividerPosition + "px"; |
140 dividers[dividerPosition] = divider; | 141 dividers[dividerPosition] = divider; |
141 } | 142 } |
142 this._timelineGrid.addEventDividers(dividers); | 143 this._timelineGrid.addEventDividers(dividers); |
143 }, | 144 }, |
144 | 145 |
145 _updateFrameBars: function(frames) | 146 _updateFrameBars: function(frames) |
146 { | 147 { |
147 var clientWidth = this._graphRowsElementWidth; | 148 var clientWidth = this._graphRowsElementWidth; |
148 if (this._frameContainer) { | 149 if (this._frameContainer) { |
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1058 | 1059 |
1059 this.element.className = "timeline-tree-item timeline-category-" + recor
d.category().name; | 1060 this.element.className = "timeline-tree-item timeline-category-" + recor
d.category().name; |
1060 var paddingLeft = 5; | 1061 var paddingLeft = 5; |
1061 var step = -3; | 1062 var step = -3; |
1062 for (var currentRecord = presentationRecord.presentationParent() ? prese
ntationRecord.presentationParent().presentationParent() : null; currentRecord; c
urrentRecord = currentRecord.presentationParent()) | 1063 for (var currentRecord = presentationRecord.presentationParent() ? prese
ntationRecord.presentationParent().presentationParent() : null; currentRecord; c
urrentRecord = currentRecord.presentationParent()) |
1063 paddingLeft += 12 / (Math.max(1, step++)); | 1064 paddingLeft += 12 / (Math.max(1, step++)); |
1064 this.element.style.paddingLeft = paddingLeft + "px"; | 1065 this.element.style.paddingLeft = paddingLeft + "px"; |
1065 if (record.thread()) | 1066 if (record.thread()) |
1066 this.element.classList.add("background"); | 1067 this.element.classList.add("background"); |
1067 | 1068 |
1068 this._typeElement.textContent = record.title(); | 1069 this._typeElement.textContent = uiUtils.titleForRecord(record); |
1069 | 1070 |
1070 if (this._dataElement.firstChild) | 1071 if (this._dataElement.firstChild) |
1071 this._dataElement.removeChildren(); | 1072 this._dataElement.removeChildren(); |
1072 | 1073 |
1073 this._warningElement.classList.toggle("hidden", !presentationRecord.hasW
arnings() && !presentationRecord.childHasWarnings()); | 1074 this._warningElement.classList.toggle("hidden", !presentationRecord.hasW
arnings() && !presentationRecord.childHasWarnings()); |
1074 this._warningElement.classList.toggle("timeline-tree-item-child-warning"
, presentationRecord.childHasWarnings() && !presentationRecord.hasWarnings()); | 1075 this._warningElement.classList.toggle("timeline-tree-item-child-warning"
, presentationRecord.childHasWarnings() && !presentationRecord.hasWarnings()); |
1075 | 1076 |
1076 if (presentationRecord.coalesced()) { | 1077 if (presentationRecord.coalesced()) { |
1077 this._dataElement.createTextChild(WebInspector.UIString("× %d", pres
entationRecord.presentationChildren().length)); | 1078 this._dataElement.createTextChild(WebInspector.UIString("× %d", pres
entationRecord.presentationChildren().length)); |
1078 } else { | 1079 } else { |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1294 this._element.classList.remove("hidden"); | 1295 this._element.classList.remove("hidden"); |
1295 } else | 1296 } else |
1296 this._element.classList.add("hidden"); | 1297 this._element.classList.add("hidden"); |
1297 }, | 1298 }, |
1298 | 1299 |
1299 _dispose: function() | 1300 _dispose: function() |
1300 { | 1301 { |
1301 this._element.remove(); | 1302 this._element.remove(); |
1302 } | 1303 } |
1303 } | 1304 } |
OLD | NEW |