OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @extends {WebInspector.TimelineUIUtils} | 7 * @extends {WebInspector.TimelineUIUtils} |
8 */ | 8 */ |
9 WebInspector.TracingTimelineUIUtils = function() | 9 WebInspector.TracingTimelineUIUtils = function() |
10 { | 10 { |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
625 case recordTypes.DecodeImage: | 625 case recordTypes.DecodeImage: |
626 case recordTypes.ResizeImage: | 626 case recordTypes.ResizeImage: |
627 case recordTypes.DrawLazyPixelRef: | 627 case recordTypes.DrawLazyPixelRef: |
628 relatedNodeLabel = WebInspector.UIString("Image element"); | 628 relatedNodeLabel = WebInspector.UIString("Image element"); |
629 if (event.imageURL) | 629 if (event.imageURL) |
630 contentHelper.appendElementRow(WebInspector.UIString("Image URL"), W ebInspector.linkifyResourceAsNode(event.imageURL)); | 630 contentHelper.appendElementRow(WebInspector.UIString("Image URL"), W ebInspector.linkifyResourceAsNode(event.imageURL)); |
631 break; | 631 break; |
632 case recordTypes.RecalculateStyles: // We don't want to see default details. | 632 case recordTypes.RecalculateStyles: // We don't want to see default details. |
633 contentHelper.appendTextRow(WebInspector.UIString("Elements affected"), event.args["elementCount"]); | 633 contentHelper.appendTextRow(WebInspector.UIString("Elements affected"), event.args["elementCount"]); |
634 callStackLabel = WebInspector.UIString("Styles recalculation forced"); | 634 callStackLabel = WebInspector.UIString("Styles recalculation forced"); |
635 // FIXME: Show invalidation tracking for updating style. | |
635 break; | 636 break; |
636 case recordTypes.Layout: | 637 case recordTypes.Layout: |
637 var beginData = event.args["beginData"]; | 638 var beginData = event.args["beginData"]; |
638 contentHelper.appendTextRow(WebInspector.UIString("Nodes that need layou t"), beginData["dirtyObjects"]); | 639 contentHelper.appendTextRow(WebInspector.UIString("Nodes that need layou t"), beginData["dirtyObjects"]); |
639 contentHelper.appendTextRow(WebInspector.UIString("Layout tree size"), b eginData["totalObjects"]); | 640 contentHelper.appendTextRow(WebInspector.UIString("Layout tree size"), b eginData["totalObjects"]); |
640 contentHelper.appendTextRow(WebInspector.UIString("Layout scope"), | 641 contentHelper.appendTextRow(WebInspector.UIString("Layout scope"), |
641 beginData["partialLayout"] ? WebInspector.UI String("Partial") : WebInspector.UIString("Whole document")); | 642 beginData["partialLayout"] ? WebInspector.UI String("Partial") : WebInspector.UIString("Whole document")); |
642 callSiteStackTraceLabel = WebInspector.UIString("Layout invalidated"); | 643 callSiteStackTraceLabel = WebInspector.UIString("Layout invalidated"); |
643 callStackLabel = WebInspector.UIString("Layout forced"); | 644 callStackLabel = WebInspector.UIString("Layout forced"); |
644 relatedNodeLabel = WebInspector.UIString("Layout root"); | 645 relatedNodeLabel = WebInspector.UIString("Layout root"); |
646 // FIXME: Show invalidation tracking for updating layout. | |
647 break; | |
648 case recordTypes.UpdateLayerTree: | |
649 // FIXME: Show invalidation tracking for updating the layer tree. | |
645 break; | 650 break; |
646 case recordTypes.ConsoleTime: | 651 case recordTypes.ConsoleTime: |
647 contentHelper.appendTextRow(WebInspector.UIString("Message"), eventData[ "message"]); | 652 contentHelper.appendTextRow(WebInspector.UIString("Message"), eventData[ "message"]); |
648 break; | 653 break; |
649 case recordTypes.WebSocketCreate: | 654 case recordTypes.WebSocketCreate: |
650 case recordTypes.WebSocketSendHandshakeRequest: | 655 case recordTypes.WebSocketSendHandshakeRequest: |
651 case recordTypes.WebSocketReceiveHandshakeResponse: | 656 case recordTypes.WebSocketReceiveHandshakeResponse: |
652 case recordTypes.WebSocketDestroy: | 657 case recordTypes.WebSocketDestroy: |
653 var initiatorData = initiator ? initiator.args["data"] : eventData; | 658 var initiatorData = initiator ? initiator.args["data"] : eventData; |
654 if (typeof initiatorData["webSocketURL"] !== "undefined") | 659 if (typeof initiatorData["webSocketURL"] !== "undefined") |
(...skipping 29 matching lines...) Expand all Loading... | |
684 contentHelper.appendStackTrace(callStackLabel || WebInspector.UIString(" Call Stack"), eventStackTrace); | 689 contentHelper.appendStackTrace(callStackLabel || WebInspector.UIString(" Call Stack"), eventStackTrace); |
685 | 690 |
686 var warning = event.warning; | 691 var warning = event.warning; |
687 if (warning) { | 692 if (warning) { |
688 var div = document.createElement("div"); | 693 var div = document.createElement("div"); |
689 div.textContent = warning; | 694 div.textContent = warning; |
690 contentHelper.appendElementRow(WebInspector.UIString("Warning"), div); | 695 contentHelper.appendElementRow(WebInspector.UIString("Warning"), div); |
691 } | 696 } |
692 if (event.previewElement) | 697 if (event.previewElement) |
693 contentHelper.appendElementRow(WebInspector.UIString("Preview"), event.p reviewElement); | 698 contentHelper.appendElementRow(WebInspector.UIString("Preview"), event.p reviewElement); |
699 | |
700 // Show invalidation tracking. | |
701 if (event.styleInvalidationTrackingEvents && event.styleInvalidationTracking Events.length) { | |
702 contentHelper.element.appendChild( | |
703 this._buildInvalidationDetailsNode("Style invalidations", linkifier, event, event.styleInvalidationTrackingEvents)); | |
caseq
2014/08/26 12:19:07
Display strings should be passed via WebInspector.
| |
704 } | |
705 if (event.layoutInvalidationTrackingEvents && event.layoutInvalidationTracki ngEvents.length) { | |
706 contentHelper.element.appendChild( | |
707 this._buildInvalidationDetailsNode("Layout invalidations", linkifier , event, event.layoutInvalidationTrackingEvents)); | |
708 } | |
709 | |
694 fragment.appendChild(contentHelper.element); | 710 fragment.appendChild(contentHelper.element); |
695 return fragment; | 711 return fragment; |
696 } | 712 } |
697 | 713 |
698 /** | 714 /** |
699 * @param {!Object} total | 715 * @param {!Object} total |
700 * @param {!WebInspector.TracingTimelineModel} model | 716 * @param {!WebInspector.TracingTimelineModel} model |
701 * @param {!WebInspector.TracingModel.Event} event | 717 * @param {!WebInspector.TracingModel.Event} event |
702 * @return {boolean} | 718 * @return {boolean} |
703 */ | 719 */ |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
794 else if (recordType === recordTypes.BeginFrame) | 810 else if (recordType === recordTypes.BeginFrame) |
795 eventDivider.className += " timeline-frame-divider"; | 811 eventDivider.className += " timeline-frame-divider"; |
796 | 812 |
797 if (title) | 813 if (title) |
798 eventDivider.title = title; | 814 eventDivider.title = title; |
799 | 815 |
800 return eventDivider; | 816 return eventDivider; |
801 } | 817 } |
802 | 818 |
803 /** | 819 /** |
820 * TODO: write me | |
821 */ | |
822 WebInspector.TracingTimelineUIUtils._buildInvalidationDetailsNode = function(tit le, linkifier, event, invalidationEvents) | |
823 { | |
824 var detailsNode = document.createElement("div"); | |
825 detailsNode.className = "timeline-details-view-row"; | |
826 var titleElement = document.createElement("span"); | |
827 titleElement.className = "timeline-details-view-row-title"; | |
828 titleElement.textContent = WebInspector.UIString("%s: ", title); | |
829 detailsNode.appendChild(titleElement); | |
830 var eventsList = document.createElement("ol"); | |
831 detailsNode.appendChild(eventsList); | |
832 | |
833 invalidationEvents.forEach(function(invalidationEvent, idx) { | |
caseq
2014/08/26 12:19:08
Does this produce readable output for large invali
| |
834 var row = document.createElement("li"); | |
835 eventsList.appendChild(row); | |
836 | |
837 var nodeRow = document.createElement("div"); | |
838 row.appendChild(nodeRow); | |
839 var target = event.thread.target(); | |
840 var node = target.domModel.nodeForId(invalidationEvent.nodeId); | |
caseq
2014/08/26 12:19:07
Does this actually work? It looks like it shouldn'
| |
841 if (node) | |
842 nodeRow.appendChild(WebInspector.DOMPresentationUtils.linkifyNodeRef erence(node)); | |
843 else if (invalidationEvent.nodeName) | |
844 nodeRow.textContent = '[' + invalidationEvent.nodeName + ']'; | |
845 else | |
846 nodeRow.textContent = '[ unknown node ]'; | |
847 | |
848 var callstack = invalidationEvent.callstack ? JSON.parse(invalidationEve nt.callstack) : []; | |
849 if (callstack.length > 0) { | |
850 var callstackRow = document.createElement("div"); | |
851 row.appendChild(callstackRow); | |
852 callstack.forEach(function(stackFrame) { | |
853 var frameRow = document.createElement("div"); | |
854 frameRow.className = "timeline-details-view-row monospace"; | |
855 callstackRow.appendChild(frameRow); | |
856 frameRow.textContent = stackFrame.functionName || WebInspector.U IString("(anonymous function)"); | |
857 frameRow.textContent += " @ "; | |
858 var urlElement = linkifier.linkifyScriptLocation(target, stackFr ame.scriptId, stackFrame.url, stackFrame.lineNumber - 1, stackFrame.columnNumber - 1); | |
859 frameRow.appendChild(urlElement); | |
860 }); | |
861 } | |
862 }); | |
863 return detailsNode; | |
864 } | |
865 | |
866 /** | |
804 * @return {!Array.<string>} | 867 * @return {!Array.<string>} |
805 */ | 868 */ |
806 WebInspector.TracingTimelineUIUtils._visibleTypes = function() | 869 WebInspector.TracingTimelineUIUtils._visibleTypes = function() |
807 { | 870 { |
808 var eventStyles = WebInspector.TracingTimelineUIUtils._initEventStyles(); | 871 var eventStyles = WebInspector.TracingTimelineUIUtils._initEventStyles(); |
809 var result = []; | 872 var result = []; |
810 for (var name in eventStyles) { | 873 for (var name in eventStyles) { |
811 if (!eventStyles[name].hidden) | 874 if (!eventStyles[name].hidden) |
812 result.push(name); | 875 result.push(name); |
813 } | 876 } |
814 return result; | 877 return result; |
815 } | 878 } |
816 | 879 |
817 /** | 880 /** |
818 * @return {!WebInspector.TracingTimelineModel.Filter} | 881 * @return {!WebInspector.TracingTimelineModel.Filter} |
819 */ | 882 */ |
820 WebInspector.TracingTimelineUIUtils.hiddenEventsFilter = function() | 883 WebInspector.TracingTimelineUIUtils.hiddenEventsFilter = function() |
821 { | 884 { |
822 return new WebInspector.TracingTimelineModel.InclusiveEventNameFilter(WebIns pector.TracingTimelineUIUtils._visibleTypes()); | 885 return new WebInspector.TracingTimelineModel.InclusiveEventNameFilter(WebIns pector.TracingTimelineUIUtils._visibleTypes()); |
823 } | 886 } |
OLD | NEW |