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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 var clientWidth = this._graphRowsElementWidth; | 132 var clientWidth = this._graphRowsElementWidth; |
133 var dividers = new Map(); | 133 var dividers = new Map(); |
134 var eventDividerRecords = this._model.eventDividerRecords(); | 134 var eventDividerRecords = this._model.eventDividerRecords(); |
135 | 135 |
136 for (var i = 0; i < eventDividerRecords.length; ++i) { | 136 for (var i = 0; i < eventDividerRecords.length; ++i) { |
137 var record = eventDividerRecords[i]; | 137 var record = eventDividerRecords[i]; |
138 var position = this._calculator.computePosition(record.startTime()); | 138 var position = this._calculator.computePosition(record.startTime()); |
139 var dividerPosition = Math.round(position); | 139 var dividerPosition = Math.round(position); |
140 if (dividerPosition < 0 || dividerPosition >= clientWidth || divider
s.has(dividerPosition)) | 140 if (dividerPosition < 0 || dividerPosition >= clientWidth || divider
s.has(dividerPosition)) |
141 continue; | 141 continue; |
142 dividers.set(dividerPosition, WebInspector.TimelineUIUtils.createDiv
iderForRecord(record, dividerPosition)); | 142 dividers.set(dividerPosition, WebInspector.TimelineUIUtils.createDiv
iderForRecord(record, this._calculator.zeroTime(), dividerPosition)); |
143 } | 143 } |
144 this._timelineGrid.addEventDividers(dividers.valuesArray()); | 144 this._timelineGrid.addEventDividers(dividers.valuesArray()); |
145 }, | 145 }, |
146 | 146 |
147 _updateFrameBars: function(frames) | 147 _updateFrameBars: function(frames) |
148 { | 148 { |
149 if (this._frameContainer) { | 149 if (this._frameContainer) { |
150 this._frameContainer.removeChildren(); | 150 this._frameContainer.removeChildren(); |
151 } else { | 151 } else { |
152 const frameContainerBorderWidth = 1; | 152 const frameContainerBorderWidth = 1; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 * @param {?WebInspector.TimelinePresentationModel.Record} presentationRecor
d | 326 * @param {?WebInspector.TimelinePresentationModel.Record} presentationRecor
d |
327 */ | 327 */ |
328 _selectRecord: function(presentationRecord) | 328 _selectRecord: function(presentationRecord) |
329 { | 329 { |
330 if (presentationRecord.coalesced()) { | 330 if (presentationRecord.coalesced()) { |
331 // Presentation record does not have model record to highlight. | 331 // Presentation record does not have model record to highlight. |
332 this._innerSetSelectedRecord(presentationRecord); | 332 this._innerSetSelectedRecord(presentationRecord); |
333 var aggregatedStats = {}; | 333 var aggregatedStats = {}; |
334 var presentationChildren = presentationRecord.presentationChildren()
; | 334 var presentationChildren = presentationRecord.presentationChildren()
; |
335 for (var i = 0; i < presentationChildren.length; ++i) | 335 for (var i = 0; i < presentationChildren.length; ++i) |
336 WebInspector.TimelineUIUtils.aggregateTimeForRecord(aggregatedSt
ats, presentationChildren[i].record()); | 336 WebInspector.TimelineUIUtils.aggregateTimeForRecord(aggregatedSt
ats, this._model, presentationChildren[i].record()); |
337 var idle = presentationRecord.endTime() - presentationRecord.startTi
me(); | 337 var idle = presentationRecord.endTime() - presentationRecord.startTi
me(); |
338 for (var category in aggregatedStats) | 338 for (var category in aggregatedStats) |
339 idle -= aggregatedStats[category]; | 339 idle -= aggregatedStats[category]; |
340 aggregatedStats["idle"] = idle; | 340 aggregatedStats["idle"] = idle; |
341 | 341 |
342 var contentHelper = new WebInspector.TimelineDetailsContentHelper(nu
ll, null, null, true); | 342 var contentHelper = new WebInspector.TimelineDetailsContentHelper(nu
ll, null, null, true); |
343 var pieChart = WebInspector.TimelineUIUtils.generatePieChart(aggrega
tedStats); | 343 var pieChart = WebInspector.TimelineUIUtils.generatePieChart(aggrega
tedStats); |
344 var title = WebInspector.TimelineUIUtils.eventTitle(presentationReco
rd.record().traceEvent()); | 344 var title = WebInspector.TimelineUIUtils.eventTitle(presentationReco
rd.record().traceEvent()); |
345 contentHelper.appendTextRow(WebInspector.UIString("Type"), title); | 345 contentHelper.appendTextRow(WebInspector.UIString("Type"), title); |
346 contentHelper.appendElementRow(WebInspector.UIString("Aggregated Tim
e"), pieChart); | 346 contentHelper.appendElementRow(WebInspector.UIString("Aggregated Tim
e"), pieChart); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 var element = /** @type {?Element} */ (container.firstChild); | 651 var element = /** @type {?Element} */ (container.firstChild); |
652 var lastElement; | 652 var lastElement; |
653 var lastLeft; | 653 var lastLeft; |
654 var lastRight; | 654 var lastRight; |
655 | 655 |
656 for (; taskIndex < tasks.length; ++taskIndex) { | 656 for (; taskIndex < tasks.length; ++taskIndex) { |
657 var task = tasks[taskIndex]; | 657 var task = tasks[taskIndex]; |
658 if (task.startTime() > endTime) | 658 if (task.startTime() > endTime) |
659 break; | 659 break; |
660 | 660 |
| 661 var data = task.traceEvent().args["data"]; |
| 662 var foreign = data && data["foreign"]; |
661 var left = Math.max(0, this._calculator.computePosition(task.startTi
me()) + barOffset - widthAdjustment); | 663 var left = Math.max(0, this._calculator.computePosition(task.startTi
me()) + barOffset - widthAdjustment); |
662 var right = Math.min(width, this._calculator.computePosition(task.en
dTime() || 0) + barOffset + widthAdjustment); | 664 var right = Math.min(width, this._calculator.computePosition(task.en
dTime() || 0) + barOffset + widthAdjustment); |
663 | 665 |
664 if (lastElement) { | 666 if (lastElement) { |
665 var gap = Math.floor(left) - Math.ceil(lastRight); | 667 var gap = Math.floor(left) - Math.ceil(lastRight); |
666 if (gap < minGap) { | 668 if (gap < minGap) { |
667 if (!task.data["foreign"]) | 669 if (!foreign) |
668 lastElement.classList.remove(foreignStyle); | 670 lastElement.classList.remove(foreignStyle); |
669 lastRight = right; | 671 lastRight = right; |
670 lastElement._tasksInfo.lastTaskIndex = taskIndex; | 672 lastElement._tasksInfo.lastTaskIndex = taskIndex; |
671 continue; | 673 continue; |
672 } | 674 } |
673 lastElement.style.width = (lastRight - lastLeft) + "px"; | 675 lastElement.style.width = (lastRight - lastLeft) + "px"; |
674 } | 676 } |
675 | 677 |
676 if (!element) | 678 if (!element) |
677 element = container.createChild("div", "timeline-graph-bar"); | 679 element = container.createChild("div", "timeline-graph-bar"); |
678 element.style.left = left + "px"; | 680 element.style.left = left + "px"; |
679 element._tasksInfo = {name: name, tasks: tasks, firstTaskIndex: task
Index, lastTaskIndex: taskIndex}; | 681 element._tasksInfo = {name: name, tasks: tasks, firstTaskIndex: task
Index, lastTaskIndex: taskIndex}; |
680 if (task.data["foreign"]) | 682 if (foreign) |
681 element.classList.add(foreignStyle); | 683 element.classList.add(foreignStyle); |
682 lastLeft = left; | 684 lastLeft = left; |
683 lastRight = right; | 685 lastRight = right; |
684 lastElement = element; | 686 lastElement = element; |
685 element = /** @type {?Element} */ (element.nextSibling); | 687 element = /** @type {?Element} */ (element.nextSibling); |
686 } | 688 } |
687 | 689 |
688 if (lastElement) | 690 if (lastElement) |
689 lastElement.style.width = (lastRight - lastLeft) + "px"; | 691 lastElement.style.width = (lastRight - lastLeft) + "px"; |
690 | 692 |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1300 } else { | 1302 } else { |
1301 this._element.classList.add("hidden"); | 1303 this._element.classList.add("hidden"); |
1302 } | 1304 } |
1303 }, | 1305 }, |
1304 | 1306 |
1305 _dispose: function() | 1307 _dispose: function() |
1306 { | 1308 { |
1307 this._element.remove(); | 1309 this._element.remove(); |
1308 } | 1310 } |
1309 } | 1311 } |
OLD | NEW |