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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/tracing/timeline-js/timeline-js-line-level-profile.html

Issue 2150803002: [DevTools] Add callFrame to CPUProfileNode & SamplingHeapProfileNode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments Created 4 years, 5 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
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script> 3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/debugger-test.js"></script> 4 <script src="../../../http/tests/inspector/debugger-test.js"></script>
5 <script src="../resources/timeline-data.js"></script> 5 <script src="../resources/timeline-data.js"></script>
6 <script> 6 <script>
7 function test() 7 function test()
8 { 8 {
9 var cpuProfile = { 9 var cpuProfile = {
10 startTime: 10, 10 startTime: 10,
11 endTime: 20, 11 endTime: 20,
12 head: { 12 head: {
13 functionName: "(root)", 13 callFrame: { functionName: "(root)" },
14 hitCount: 0, 14 hitCount: 0,
15 children: [ 15 children: [
16 { 16 {
17 functionName: "foo1", 17 callFrame: { functionName: "foo1" },
18 hitCount: 100, 18 hitCount: 100,
19 positionTicks: [{line:1, ticks:10}, {line:2, ticks:20}, {lin e:3, ticks:30}, {line:4, ticks:40}], 19 positionTicks: [{line:1, ticks:10}, {line:2, ticks:20}, {lin e:3, ticks:30}, {line:4, ticks:40}],
20 children: [] 20 children: []
21 }, 21 },
22 { 22 {
23 functionName: "foo2", 23 callFrame: { functionName: "foo2" },
24 hitCount: 200, 24 hitCount: 200,
25 positionTicks: [{line:100, ticks:1}, {line:102, ticks:190}], 25 positionTicks: [{line:100, ticks:1}, {line:102, ticks:190}],
26 children: [] 26 children: []
27 }, 27 },
28 { 28 {
29 functionName: "null", 29 callFrame: { functionName: "null" },
30 hitCount: 0, 30 hitCount: 0,
31 positionTicks: [], 31 positionTicks: [],
32 children: [ 32 children: [
33 { 33 {
34 functionName: "bar", 34 callFrame: { functionName: "bar" },
35 hitCount: 300, 35 hitCount: 300,
36 positionTicks: [{line:55, ticks:22}], 36 positionTicks: [{line:55, ticks:22}],
37 children: [] 37 children: []
38 }, 38 },
39 { 39 {
40 functionName: "baz", 40 callFrame: { functionName: "baz" },
41 hitCount: 400, 41 hitCount: 400,
42 // no positionTicks for the node. 42 // no positionTicks for the node.
43 children: [] 43 children: []
44 } 44 }
45 ] 45 ]
46 } 46 }
47 ] 47 ]
48 } 48 }
49 }; 49 };
50 50
51 InspectorTest.addSniffer(WebInspector.CodeMirrorTextEditor.prototype, "setGu tterDecoration", decorationAdded, true); 51 InspectorTest.addSniffer(WebInspector.CodeMirrorTextEditor.prototype, "setGu tterDecoration", decorationAdded, true);
52 InspectorTest.showScriptSource("timeline-data.js", frameRevealed); 52 InspectorTest.showScriptSource("timeline-data.js", frameRevealed);
53 53
54 function decorationAdded(line, type, element) 54 function decorationAdded(line, type, element)
55 { 55 {
56 InspectorTest.addResult(`${line} ${type} ${element.textContent} ${elemen t.style.backgroundColor}`); 56 InspectorTest.addResult(`${line} ${type} ${element.textContent} ${elemen t.style.backgroundColor}`);
57 } 57 }
58 58
59 function setUrls(url, node) 59 function setUrls(url, node)
60 { 60 {
61 node.url = url; 61 node.callFrame.url = url;
62 node.children.forEach(setUrls.bind(null, url)); 62 node.children.forEach(setUrls.bind(null, url));
63 } 63 }
64 64
65 function frameRevealed(frame) 65 function frameRevealed(frame)
66 { 66 {
67 var url = frame.uiSourceCode().url(); 67 var url = frame.uiSourceCode().url();
68 InspectorTest.addResult(InspectorTest.formatters.formatAsURL(url)); 68 InspectorTest.addResult(InspectorTest.formatters.formatAsURL(url));
69 setUrls(url, cpuProfile.head); 69 setUrls(url, cpuProfile.head);
70 var lineProfile = new WebInspector.LineLevelProfile.instance(); 70 var lineProfile = new WebInspector.LineLevelProfile.instance();
71 lineProfile.appendCPUProfile(new WebInspector.CPUProfileDataModel(cpuPro file)); 71 lineProfile.appendCPUProfile(new WebInspector.CPUProfileDataModel(cpuPro file));
72 setTimeout(() => InspectorTest.completeTest(), 0); 72 setTimeout(() => InspectorTest.completeTest(), 0);
73 } 73 }
74 } 74 }
75 75
76 </script> 76 </script>
77 </head> 77 </head>
78 <body onload="runTest()"> 78 <body onload="runTest()">
79 Tests that a line-level CPU profile is shown in the text editor. 79 Tests that a line-level CPU profile is shown in the text editor.
80 </body> 80 </body>
81 </html> 81 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698