OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 15 matching lines...) Expand all Loading... |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 /** | 31 /** |
32 * @constructor | 32 * @constructor |
33 */ | 33 */ |
34 WebInspector.UserMetrics = function() | 34 WebInspector.UserMetrics = function() |
35 { | 35 { |
36 } | 36 }; |
37 | 37 |
38 // Codes below are used to collect UMA histograms in the Chromium port. | 38 // Codes below are used to collect UMA histograms in the Chromium port. |
39 // Do not change the values below, additional actions are needed on the Chromium
side | 39 // Do not change the values below, additional actions are needed on the Chromium
side |
40 // in order to add more codes. | 40 // in order to add more codes. |
41 | 41 |
42 /** @enum {number} */ | 42 /** @enum {number} */ |
43 WebInspector.UserMetrics.Action = { | 43 WebInspector.UserMetrics.Action = { |
44 WindowDocked: 1, | 44 WindowDocked: 1, |
45 WindowUndocked: 2, | 45 WindowUndocked: 2, |
46 ScriptsBreakpointSet: 3, | 46 ScriptsBreakpointSet: 3, |
47 TimelineStarted: 4, | 47 TimelineStarted: 4, |
48 ProfilesCPUProfileTaken: 5, | 48 ProfilesCPUProfileTaken: 5, |
49 ProfilesHeapProfileTaken: 6, | 49 ProfilesHeapProfileTaken: 6, |
50 AuditsStarted: 7, | 50 AuditsStarted: 7, |
51 ConsoleEvaluated: 8, | 51 ConsoleEvaluated: 8, |
52 FileSavedInWorkspace: 9, | 52 FileSavedInWorkspace: 9, |
53 DeviceModeEnabled: 10, | 53 DeviceModeEnabled: 10, |
54 AnimationsPlaybackRateChanged: 11, | 54 AnimationsPlaybackRateChanged: 11, |
55 RevisionApplied: 12, | 55 RevisionApplied: 12, |
56 FileSystemDirectoryContentReceived: 13, | 56 FileSystemDirectoryContentReceived: 13, |
57 StyleRuleEdited: 14, | 57 StyleRuleEdited: 14, |
58 CommandEvaluatedInConsolePanel: 15, | 58 CommandEvaluatedInConsolePanel: 15, |
59 DOMPropertiesExpanded: 16, | 59 DOMPropertiesExpanded: 16, |
60 ResizedViewInResponsiveMode: 17 | 60 ResizedViewInResponsiveMode: 17 |
61 } | 61 }; |
62 | 62 |
63 WebInspector.UserMetrics._PanelCodes = { | 63 WebInspector.UserMetrics._PanelCodes = { |
64 elements: 1, | 64 elements: 1, |
65 resources: 2, | 65 resources: 2, |
66 network: 3, | 66 network: 3, |
67 sources: 4, | 67 sources: 4, |
68 timeline: 5, | 68 timeline: 5, |
69 profiles: 6, | 69 profiles: 6, |
70 audits: 7, | 70 audits: 7, |
71 console: 8, | 71 console: 8, |
72 layers: 9, | 72 layers: 9, |
73 "drawer-console": 10, | 73 "drawer-console": 10, |
74 "drawer-animations": 11, | 74 "drawer-animations": 11, |
75 "drawer-network.config": 12, | 75 "drawer-network.config": 12, |
76 "drawer-rendering": 13, | 76 "drawer-rendering": 13, |
77 "drawer-sensors": 14, | 77 "drawer-sensors": 14, |
78 "drawer-sources.search": 15, | 78 "drawer-sources.search": 15, |
79 security: 16 | 79 security: 16 |
80 } | 80 }; |
81 | 81 |
82 WebInspector.UserMetrics.prototype = { | 82 WebInspector.UserMetrics.prototype = { |
83 /** | 83 /** |
84 * @param {string} panelName | 84 * @param {string} panelName |
85 */ | 85 */ |
86 panelShown: function(panelName) | 86 panelShown: function(panelName) |
87 { | 87 { |
88 var code = WebInspector.UserMetrics._PanelCodes[panelName] || 0; | 88 var code = WebInspector.UserMetrics._PanelCodes[panelName] || 0; |
89 var size = Object.keys(WebInspector.UserMetrics._PanelCodes).length + 1; | 89 var size = Object.keys(WebInspector.UserMetrics._PanelCodes).length + 1; |
90 InspectorFrontendHost.recordEnumeratedHistogram("DevTools.PanelShown", c
ode, size); | 90 InspectorFrontendHost.recordEnumeratedHistogram("DevTools.PanelShown", c
ode, size); |
91 }, | 91 }, |
92 | 92 |
93 /** | 93 /** |
94 * @param {string} drawerId | 94 * @param {string} drawerId |
95 */ | 95 */ |
96 drawerShown: function(drawerId) | 96 drawerShown: function(drawerId) |
97 { | 97 { |
98 this.panelShown("drawer-" + drawerId); | 98 this.panelShown("drawer-" + drawerId); |
99 }, | 99 }, |
100 | 100 |
101 /** | 101 /** |
102 * @param {!WebInspector.UserMetrics.Action} action | 102 * @param {!WebInspector.UserMetrics.Action} action |
103 */ | 103 */ |
104 actionTaken: function(action) | 104 actionTaken: function(action) |
105 { | 105 { |
106 var size = Object.keys(WebInspector.UserMetrics.Action).length + 1; | 106 var size = Object.keys(WebInspector.UserMetrics.Action).length + 1; |
107 InspectorFrontendHost.recordEnumeratedHistogram("DevTools.ActionTaken",
action, size); | 107 InspectorFrontendHost.recordEnumeratedHistogram("DevTools.ActionTaken",
action, size); |
108 } | 108 } |
109 } | 109 }; |
110 | 110 |
111 /** @type {!WebInspector.UserMetrics} */ | 111 /** @type {!WebInspector.UserMetrics} */ |
112 WebInspector.userMetrics = new WebInspector.UserMetrics(); | 112 WebInspector.userMetrics = new WebInspector.UserMetrics(); |
OLD | NEW |