OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.VBox} | 7 * @extends {WebInspector.VBox} |
8 * @param {!WebInspector.TimelineModel} model | 8 * @param {!WebInspector.TimelineModel} model |
9 */ | 9 */ |
10 WebInspector.TimelineTreeView = function(model) | 10 WebInspector.TimelineTreeView = function(model) |
(...skipping 11 matching lines...) Expand all Loading... |
22 WebInspector.TimelineModel.RecordType.EventDispatch, | 22 WebInspector.TimelineModel.RecordType.EventDispatch, |
23 WebInspector.TimelineModel.RecordType.FunctionCall, | 23 WebInspector.TimelineModel.RecordType.FunctionCall, |
24 WebInspector.TimelineModel.RecordType.TimerFire | 24 WebInspector.TimelineModel.RecordType.TimerFire |
25 ]; | 25 ]; |
26 this._filters = [ | 26 this._filters = [ |
27 WebInspector.TimelineUIUtils.hiddenEventsFilter(), | 27 WebInspector.TimelineUIUtils.hiddenEventsFilter(), |
28 new WebInspector.ExclusiveTraceEventNameFilter(nonessentialEvents), | 28 new WebInspector.ExclusiveTraceEventNameFilter(nonessentialEvents), |
29 new WebInspector.ExcludeTopLevelFilter() | 29 new WebInspector.ExcludeTopLevelFilter() |
30 ]; | 30 ]; |
31 | 31 |
32 this._groupBySetting = WebInspector.settings.createSetting("timelineTreeGrou
pBy", WebInspector.TimelineTreeView.GroupBy.None); | 32 this._groupBySetting = WebInspector.settings.createSetting("timelineTreeGrou
pBy", WebInspector.TimelineTreeView.GroupBy.Domain); |
33 | 33 |
34 this.dataGrid = new WebInspector.SortableDataGrid(columns); | 34 this.dataGrid = new WebInspector.SortableDataGrid(columns); |
35 this.dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged,
this._sortingChanged, this); | 35 this.dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged,
this._sortingChanged, this); |
36 | 36 |
37 this._createToolbar(); | 37 this._createToolbar(); |
38 | 38 |
39 this.dataGrid.show(this.element); | 39 this.dataGrid.show(this.element); |
40 } | 40 } |
41 | 41 |
42 /** | 42 /** |
43 * @enum {string} | 43 * @enum {string} |
44 */ | 44 */ |
45 WebInspector.TimelineTreeView.Mode = { | 45 WebInspector.TimelineTreeView.Mode = { |
46 TopDown: "TopDown", | 46 TopDown: "TopDown", |
47 BottomUp: "BottomUp" | 47 BottomUp: "BottomUp" |
48 } | 48 } |
49 | 49 |
50 /** | 50 /** |
51 * @enum {string} | 51 * @enum {string} |
52 */ | 52 */ |
53 WebInspector.TimelineTreeView.GroupBy = { | 53 WebInspector.TimelineTreeView.GroupBy = { |
54 None: "None", | 54 None: "None", |
55 Domain: "Domain", | 55 Domain: "Domain", |
56 DomainSecondLevel: "DomainSecondLevel", | 56 Subdomain: "Subdomain", |
57 URL: "URL" | 57 URL: "URL" |
58 } | 58 } |
59 | 59 |
60 WebInspector.TimelineTreeView.prototype = { | 60 WebInspector.TimelineTreeView.prototype = { |
61 /** | 61 /** |
62 * @param {!WebInspector.TimelineSelection} selection | 62 * @param {!WebInspector.TimelineSelection} selection |
63 */ | 63 */ |
64 updateContents: function(selection) | 64 updateContents: function(selection) |
65 { | 65 { |
66 this._startTime = selection.startTime(); | 66 this._startTime = selection.startTime(); |
(...skipping 17 matching lines...) Expand all Loading... |
84 * @param {string} id | 84 * @param {string} id |
85 * @this {WebInspector.TimelineTreeView} | 85 * @this {WebInspector.TimelineTreeView} |
86 */ | 86 */ |
87 function addGroupingOption(name, id) | 87 function addGroupingOption(name, id) |
88 { | 88 { |
89 var option = this._groupByCombobox.createOption(name, "", id); | 89 var option = this._groupByCombobox.createOption(name, "", id); |
90 this._groupByCombobox.addOption(option); | 90 this._groupByCombobox.addOption(option); |
91 if (id === this._groupBySetting.get()) | 91 if (id === this._groupBySetting.get()) |
92 this._groupByCombobox.select(option); | 92 this._groupByCombobox.select(option); |
93 } | 93 } |
94 panelToolbar.appendToolbarItem(new WebInspector.ToolbarText(WebInspector
.UIString("Group by"))); | 94 addGroupingOption.call(this, WebInspector.UIString("No Grouping"), WebIn
spector.TimelineTreeView.GroupBy.None); |
95 addGroupingOption.call(this, WebInspector.UIString("Function"), WebInspe
ctor.TimelineTreeView.GroupBy.None); | 95 addGroupingOption.call(this, WebInspector.UIString("Group by Domain"), W
ebInspector.TimelineTreeView.GroupBy.Domain); |
96 addGroupingOption.call(this, WebInspector.UIString("Domain"), WebInspect
or.TimelineTreeView.GroupBy.Domain); | 96 addGroupingOption.call(this, WebInspector.UIString("Group by Subdomain")
, WebInspector.TimelineTreeView.GroupBy.Subdomain); |
97 addGroupingOption.call(this, WebInspector.UIString("Domain (2nd Level)")
, WebInspector.TimelineTreeView.GroupBy.DomainSecondLevel); | 97 addGroupingOption.call(this, WebInspector.UIString("Group by URL"), WebI
nspector.TimelineTreeView.GroupBy.URL); |
98 addGroupingOption.call(this, WebInspector.UIString("URL"), WebInspector.
TimelineTreeView.GroupBy.URL); | |
99 panelToolbar.appendToolbarItem(this._groupByCombobox); | 98 panelToolbar.appendToolbarItem(this._groupByCombobox); |
100 }, | 99 }, |
101 | 100 |
102 _onTreeModeChanged: function() | 101 _onTreeModeChanged: function() |
103 { | 102 { |
104 this._refreshTree(); | 103 this._refreshTree(); |
105 }, | 104 }, |
106 | 105 |
107 _onGroupByChanged: function() | 106 _onGroupByChanged: function() |
108 { | 107 { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 } | 205 } |
207 | 206 |
208 var executionContextNamesByOrigin = new Map(); | 207 var executionContextNamesByOrigin = new Map(); |
209 var mainTarget = WebInspector.targetManager.mainTarget(); | 208 var mainTarget = WebInspector.targetManager.mainTarget(); |
210 if (mainTarget) { | 209 if (mainTarget) { |
211 for (var context of mainTarget.runtimeModel.executionContexts()) | 210 for (var context of mainTarget.runtimeModel.executionContexts()) |
212 executionContextNamesByOrigin.set(context.origin, context.name); | 211 executionContextNamesByOrigin.set(context.origin, context.name); |
213 } | 212 } |
214 var groupByMap = /** @type {!Map<!WebInspector.TimelineTreeView.GroupBy,
?function(!WebInspector.TimelineModel.ProfileTreeNode):string>} */ (new Map([ | 213 var groupByMap = /** @type {!Map<!WebInspector.TimelineTreeView.GroupBy,
?function(!WebInspector.TimelineModel.ProfileTreeNode):string>} */ (new Map([ |
215 [WebInspector.TimelineTreeView.GroupBy.None, null], | 214 [WebInspector.TimelineTreeView.GroupBy.None, null], |
216 [WebInspector.TimelineTreeView.GroupBy.Domain, groupByDomain.bind(nu
ll, false)], | 215 [WebInspector.TimelineTreeView.GroupBy.Subdomain, groupByDomain.bind
(null, false)], |
217 [WebInspector.TimelineTreeView.GroupBy.DomainSecondLevel, groupByDom
ain.bind(null, true)], | 216 [WebInspector.TimelineTreeView.GroupBy.Domain, groupByDomain.bind(nu
ll, true)], |
218 [WebInspector.TimelineTreeView.GroupBy.URL, groupByURL] | 217 [WebInspector.TimelineTreeView.GroupBy.URL, groupByURL] |
219 ])); | 218 ])); |
220 return groupByMap.get(this._groupBySetting.get()) || null; | 219 return groupByMap.get(this._groupBySetting.get()) || null; |
221 }, | 220 }, |
222 | 221 |
223 /** | 222 /** |
224 * @param {function(!WebInspector.TimelineModel.ProfileTreeNode):string} nod
eToGroupId | 223 * @param {function(!WebInspector.TimelineModel.ProfileTreeNode):string} nod
eToGroupId |
225 * @param {!WebInspector.TimelineModel.ProfileTreeNode} node | 224 * @param {!WebInspector.TimelineModel.ProfileTreeNode} node |
226 * @return {!WebInspector.TimelineModel.ProfileTreeNode} | 225 * @return {!WebInspector.TimelineModel.ProfileTreeNode} |
227 */ | 226 */ |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 if (!this._profileNode.children) | 413 if (!this._profileNode.children) |
415 return; | 414 return; |
416 for (var node of this._profileNode.children.values()) { | 415 for (var node of this._profileNode.children.values()) { |
417 var gridNode = new WebInspector.TimelineTreeView.GridNode(node, this
._totalTime, this._maxTimes.self, this._maxTimes.total); | 416 var gridNode = new WebInspector.TimelineTreeView.GridNode(node, this
._totalTime, this._maxTimes.self, this._maxTimes.total); |
418 this.insertChildOrdered(gridNode); | 417 this.insertChildOrdered(gridNode); |
419 } | 418 } |
420 }, | 419 }, |
421 | 420 |
422 __proto__: WebInspector.SortableDataGridNode.prototype | 421 __proto__: WebInspector.SortableDataGridNode.prototype |
423 } | 422 } |
OLD | NEW |