| 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 * @param {!Array<!WebInspector.TimelineModel.Filter>} filters | 9 * @param {!Array<!WebInspector.TimelineModel.Filter>} filters |
| 10 */ | 10 */ |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 } | 482 } |
| 483 }, | 483 }, |
| 484 | 484 |
| 485 /** | 485 /** |
| 486 * @param {!WebInspector.TimelineProfileTree.Node} node | 486 * @param {!WebInspector.TimelineProfileTree.Node} node |
| 487 * @return {!{name: string, color: string}} | 487 * @return {!{name: string, color: string}} |
| 488 */ | 488 */ |
| 489 _displayInfoForGroupNode: function(node) | 489 _displayInfoForGroupNode: function(node) |
| 490 { | 490 { |
| 491 var categories = WebInspector.TimelineUIUtils.categories(); | 491 var categories = WebInspector.TimelineUIUtils.categories(); |
| 492 var color = node.id ? WebInspector.TimelineUIUtils.eventColor(node.event
) : categories["other"].color; |
| 493 |
| 492 switch (this._groupBySetting.get()) { | 494 switch (this._groupBySetting.get()) { |
| 493 case WebInspector.TimelineAggregator.GroupBy.Category: | 495 case WebInspector.TimelineAggregator.GroupBy.Category: |
| 494 var category = categories[node.id] || categories["other"]; | 496 var category = categories[node.id] || categories["other"]; |
| 495 return {name: category.title, color: category.color}; | 497 return {name: category.title, color: category.color}; |
| 496 | 498 |
| 497 case WebInspector.TimelineAggregator.GroupBy.Domain: | 499 case WebInspector.TimelineAggregator.GroupBy.Domain: |
| 498 case WebInspector.TimelineAggregator.GroupBy.Subdomain: | 500 case WebInspector.TimelineAggregator.GroupBy.Subdomain: |
| 499 var name = node.id; | 501 var name = node.id; |
| 500 if (WebInspector.TimelineAggregator.isExtensionInternalURL(name)) | 502 if (WebInspector.TimelineAggregator.isExtensionInternalURL(name)) |
| 501 name = WebInspector.UIString("[Chrome extensions overhead]"); | 503 name = WebInspector.UIString("[Chrome extensions overhead]"); |
| 502 else if (name.startsWith("chrome-extension")) | 504 else if (name.startsWith("chrome-extension")) |
| 503 name = this._executionContextNamesByOrigin.get(name) || name; | 505 name = this._executionContextNamesByOrigin.get(name) || name; |
| 504 return { | 506 return { |
| 505 name: name || WebInspector.UIString("unattributed"), | 507 name: name || WebInspector.UIString("unattributed"), |
| 506 color: node.id ? WebInspector.TimelineUIUtils.eventColor(node.ev
ent) : categories["other"].color | 508 color: color |
| 507 } | 509 }; |
| 510 |
| 511 case WebInspector.TimelineAggregator.GroupBy.EventName: |
| 512 var name = node.event.name === WebInspector.TimelineModel.RecordType
.JSFrame ? |
| 513 WebInspector.UIString("JavaScript") : WebInspector.TimelineUIUti
ls.eventTitle(node.event); |
| 514 return { |
| 515 name: name, |
| 516 color: node.event.name === WebInspector.TimelineModel.RecordType
.JSFrame ? |
| 517 WebInspector.TimelineUIUtils.eventStyle(node.event).category
.color : color |
| 518 }; |
| 508 | 519 |
| 509 case WebInspector.TimelineAggregator.GroupBy.URL: | 520 case WebInspector.TimelineAggregator.GroupBy.URL: |
| 510 break; | 521 break; |
| 511 | 522 |
| 512 default: | 523 default: |
| 513 console.assert(false, "Unexpected aggregation type"); | 524 console.assert(false, "Unexpected aggregation type"); |
| 514 } | 525 } |
| 515 return { | 526 return { |
| 516 name: node.id || WebInspector.UIString("unattributed"), | 527 name: node.id || WebInspector.UIString("unattributed"), |
| 517 color: node.id ? WebInspector.TimelineUIUtils.eventColor(node.event)
: categories["other"].color | 528 color: color |
| 518 } | 529 }; |
| 519 }, | 530 }, |
| 520 | 531 |
| 521 /** | 532 /** |
| 522 * @override | 533 * @override |
| 523 * @param {!Element} parent | 534 * @param {!Element} parent |
| 524 */ | 535 */ |
| 525 _populateToolbar: function(parent) | 536 _populateToolbar: function(parent) |
| 526 { | 537 { |
| 527 var panelToolbar = new WebInspector.Toolbar("", parent); | 538 var panelToolbar = new WebInspector.Toolbar("", parent); |
| 528 this._groupByCombobox = new WebInspector.ToolbarComboBox(this._onGroupBy
Changed.bind(this)); | 539 this._groupByCombobox = new WebInspector.ToolbarComboBox(this._onGroupBy
Changed.bind(this)); |
| 529 /** | 540 /** |
| 530 * @param {string} name | 541 * @param {string} name |
| 531 * @param {string} id | 542 * @param {string} id |
| 532 * @this {WebInspector.TimelineTreeView} | 543 * @this {WebInspector.TimelineTreeView} |
| 533 */ | 544 */ |
| 534 function addGroupingOption(name, id) | 545 function addGroupingOption(name, id) |
| 535 { | 546 { |
| 536 var option = this._groupByCombobox.createOption(name, "", id); | 547 var option = this._groupByCombobox.createOption(name, "", id); |
| 537 this._groupByCombobox.addOption(option); | 548 this._groupByCombobox.addOption(option); |
| 538 if (id === this._groupBySetting.get()) | 549 if (id === this._groupBySetting.get()) |
| 539 this._groupByCombobox.select(option); | 550 this._groupByCombobox.select(option); |
| 540 } | 551 } |
| 541 addGroupingOption.call(this, WebInspector.UIString("No Grouping"), WebIn
spector.TimelineAggregator.GroupBy.None); | 552 addGroupingOption.call(this, WebInspector.UIString("No Grouping"), WebIn
spector.TimelineAggregator.GroupBy.None); |
| 553 addGroupingOption.call(this, WebInspector.UIString("Group by Activity"),
WebInspector.TimelineAggregator.GroupBy.EventName); |
| 542 addGroupingOption.call(this, WebInspector.UIString("Group by Category"),
WebInspector.TimelineAggregator.GroupBy.Category); | 554 addGroupingOption.call(this, WebInspector.UIString("Group by Category"),
WebInspector.TimelineAggregator.GroupBy.Category); |
| 543 addGroupingOption.call(this, WebInspector.UIString("Group by Domain"), W
ebInspector.TimelineAggregator.GroupBy.Domain); | 555 addGroupingOption.call(this, WebInspector.UIString("Group by Domain"), W
ebInspector.TimelineAggregator.GroupBy.Domain); |
| 544 addGroupingOption.call(this, WebInspector.UIString("Group by Subdomain")
, WebInspector.TimelineAggregator.GroupBy.Subdomain); | 556 addGroupingOption.call(this, WebInspector.UIString("Group by Subdomain")
, WebInspector.TimelineAggregator.GroupBy.Subdomain); |
| 545 addGroupingOption.call(this, WebInspector.UIString("Group by URL"), WebI
nspector.TimelineAggregator.GroupBy.URL); | 557 addGroupingOption.call(this, WebInspector.UIString("Group by URL"), WebI
nspector.TimelineAggregator.GroupBy.URL); |
| 546 panelToolbar.appendToolbarItem(this._groupByCombobox); | 558 panelToolbar.appendToolbarItem(this._groupByCombobox); |
| 547 }, | 559 }, |
| 548 | 560 |
| 549 /** | 561 /** |
| 550 * @param {!WebInspector.TimelineProfileTree.Node} treeNode | 562 * @param {!WebInspector.TimelineProfileTree.Node} treeNode |
| 551 * @return {!Array<!WebInspector.TimelineProfileTree.Node>} | 563 * @return {!Array<!WebInspector.TimelineProfileTree.Node>} |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 } | 629 } |
| 618 | 630 |
| 619 WebInspector.CallTreeTimelineTreeView.prototype = { | 631 WebInspector.CallTreeTimelineTreeView.prototype = { |
| 620 /** | 632 /** |
| 621 * @override | 633 * @override |
| 622 * @return {!WebInspector.TimelineProfileTree.Node} | 634 * @return {!WebInspector.TimelineProfileTree.Node} |
| 623 */ | 635 */ |
| 624 _buildTree: function() | 636 _buildTree: function() |
| 625 { | 637 { |
| 626 var topDown = this._buildTopDownTree(WebInspector.TimelineAggregator.eve
ntId); | 638 var topDown = this._buildTopDownTree(WebInspector.TimelineAggregator.eve
ntId); |
| 627 var aggregator = new WebInspector.TimelineAggregator(event => WebInspect
or.TimelineUIUtils.eventStyle(event).category.name); | 639 var aggregator = new WebInspector.TimelineAggregator(event => WebInspect
or.TimelineUIUtils.eventStyle(event)); |
| 628 return aggregator.performGrouping(topDown, this._groupBySetting.get()); | 640 return aggregator.performGrouping(topDown, this._groupBySetting.get()); |
| 629 }, | 641 }, |
| 630 | 642 |
| 631 __proto__: WebInspector.AggregatedTimelineTreeView.prototype, | 643 __proto__: WebInspector.AggregatedTimelineTreeView.prototype, |
| 632 }; | 644 }; |
| 633 | 645 |
| 634 /** | 646 /** |
| 635 * @constructor | 647 * @constructor |
| 636 * @extends {WebInspector.AggregatedTimelineTreeView} | 648 * @extends {WebInspector.AggregatedTimelineTreeView} |
| 637 * @param {!WebInspector.TimelineModel} model | 649 * @param {!WebInspector.TimelineModel} model |
| 638 * @param {!Array<!WebInspector.TimelineModel.Filter>} filters | 650 * @param {!Array<!WebInspector.TimelineModel.Filter>} filters |
| 639 */ | 651 */ |
| 640 WebInspector.BottomUpTimelineTreeView = function(model, filters) | 652 WebInspector.BottomUpTimelineTreeView = function(model, filters) |
| 641 { | 653 { |
| 642 WebInspector.AggregatedTimelineTreeView.call(this, model, filters); | 654 WebInspector.AggregatedTimelineTreeView.call(this, model, filters); |
| 643 this._dataGrid.markColumnAsSortedBy("self", WebInspector.DataGrid.Order.Desc
ending); | 655 this._dataGrid.markColumnAsSortedBy("self", WebInspector.DataGrid.Order.Desc
ending); |
| 644 } | 656 } |
| 645 | 657 |
| 646 WebInspector.BottomUpTimelineTreeView.prototype = { | 658 WebInspector.BottomUpTimelineTreeView.prototype = { |
| 647 /** | 659 /** |
| 648 * @override | 660 * @override |
| 649 * @return {!WebInspector.TimelineProfileTree.Node} | 661 * @return {!WebInspector.TimelineProfileTree.Node} |
| 650 */ | 662 */ |
| 651 _buildTree: function() | 663 _buildTree: function() |
| 652 { | 664 { |
| 653 var topDown = this._buildTopDownTree(WebInspector.TimelineAggregator.eve
ntId); | 665 var topDown = this._buildTopDownTree(WebInspector.TimelineAggregator.eve
ntId); |
| 654 var aggregator = new WebInspector.TimelineAggregator(event => WebInspect
or.TimelineUIUtils.eventStyle(event).category.name); | 666 var aggregator = new WebInspector.TimelineAggregator(event => WebInspect
or.TimelineUIUtils.eventStyle(event)); |
| 655 return WebInspector.TimelineProfileTree.buildBottomUp(topDown, aggregato
r.groupFunction(this._groupBySetting.get())); | 667 return WebInspector.TimelineProfileTree.buildBottomUp(topDown, aggregato
r.groupFunction(this._groupBySetting.get())); |
| 656 }, | 668 }, |
| 657 | 669 |
| 658 __proto__: WebInspector.AggregatedTimelineTreeView.prototype | 670 __proto__: WebInspector.AggregatedTimelineTreeView.prototype |
| 659 }; | 671 }; |
| 660 | 672 |
| 661 /** | 673 /** |
| 662 * @constructor | 674 * @constructor |
| 663 * @extends {WebInspector.TimelineTreeView} | 675 * @extends {WebInspector.TimelineTreeView} |
| 664 * @param {!WebInspector.TimelineModel} model | 676 * @param {!WebInspector.TimelineModel} model |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 return selectedNode && /** @type {!WebInspector.TimelineTreeView.GridNod
e} */ (selectedNode)._profileNode; | 868 return selectedNode && /** @type {!WebInspector.TimelineTreeView.GridNod
e} */ (selectedNode)._profileNode; |
| 857 }, | 869 }, |
| 858 | 870 |
| 859 _onSelectionChanged: function() | 871 _onSelectionChanged: function() |
| 860 { | 872 { |
| 861 this.dispatchEventToListeners(WebInspector.TimelineStackView.Events.Sele
ctionChanged); | 873 this.dispatchEventToListeners(WebInspector.TimelineStackView.Events.Sele
ctionChanged); |
| 862 }, | 874 }, |
| 863 | 875 |
| 864 __proto__: WebInspector.VBox.prototype | 876 __proto__: WebInspector.VBox.prototype |
| 865 } | 877 } |
| OLD | NEW |