OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 return false; | 67 return false; |
68 } | 68 } |
69 | 69 |
70 /** | 70 /** |
71 * @return {?string} | 71 * @return {?string} |
72 */ | 72 */ |
73 fileExtension() { | 73 fileExtension() { |
74 return null; | 74 return null; |
75 } | 75 } |
76 | 76 |
77 /** | |
78 * @return {!Array.<!UI.ToolbarItem>} | |
79 */ | |
80 toolbarItems() { | |
81 return []; | |
82 } | |
83 | |
84 get buttonTooltip() { | 77 get buttonTooltip() { |
85 return ''; | 78 return ''; |
86 } | 79 } |
87 | 80 |
88 get id() { | 81 get id() { |
89 return this._id; | 82 return this._id; |
90 } | 83 } |
91 | 84 |
92 get treeItemTitle() { | 85 get treeItemTitle() { |
93 return this._name; | 86 return this._name; |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 /** @type {!UI.Action }*/ (UI.actionRegistry.action('profiler.toggle-rec
ording')); | 417 /** @type {!UI.Action }*/ (UI.actionRegistry.action('profiler.toggle-rec
ording')); |
425 this._toggleRecordButton = UI.Toolbar.createActionButton(this._toggleRecordA
ction); | 418 this._toggleRecordButton = UI.Toolbar.createActionButton(this._toggleRecordA
ction); |
426 toolbar.appendToolbarItem(this._toggleRecordButton); | 419 toolbar.appendToolbarItem(this._toggleRecordButton); |
427 | 420 |
428 this.clearResultsButton = new UI.ToolbarButton(Common.UIString('Clear all pr
ofiles'), 'largeicon-clear'); | 421 this.clearResultsButton = new UI.ToolbarButton(Common.UIString('Clear all pr
ofiles'), 'largeicon-clear'); |
429 this.clearResultsButton.addEventListener(UI.ToolbarButton.Events.Click, this
._reset, this); | 422 this.clearResultsButton.addEventListener(UI.ToolbarButton.Events.Click, this
._reset, this); |
430 toolbar.appendToolbarItem(this.clearResultsButton); | 423 toolbar.appendToolbarItem(this.clearResultsButton); |
431 toolbar.appendSeparator(); | 424 toolbar.appendSeparator(); |
432 toolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('components.col
lect-garbage')); | 425 toolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('components.col
lect-garbage')); |
433 | 426 |
434 this._profileTypeToolbar = new UI.Toolbar('', this._toolbarElement); | |
435 this._profileViewToolbar = new UI.Toolbar('', this._toolbarElement); | 427 this._profileViewToolbar = new UI.Toolbar('', this._toolbarElement); |
436 | 428 |
437 this._profileGroups = {}; | 429 this._profileGroups = {}; |
438 this._launcherView = new Profiler.MultiProfileLauncherView(this); | 430 this._launcherView = new Profiler.MultiProfileLauncherView(this); |
439 this._launcherView.addEventListener( | 431 this._launcherView.addEventListener( |
440 Profiler.MultiProfileLauncherView.Events.ProfileTypeSelected, this._onPr
ofileTypeSelected, this); | 432 Profiler.MultiProfileLauncherView.Events.ProfileTypeSelected, this._onPr
ofileTypeSelected, this); |
441 | 433 |
442 this._profileToView = []; | 434 this._profileToView = []; |
443 this._typeIdToSidebarSection = {}; | 435 this._typeIdToSidebarSection = {}; |
444 var types = Profiler.ProfileTypeRegistry.instance.profileTypes(); | 436 var types = Profiler.ProfileTypeRegistry.instance.profileTypes(); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 /** | 572 /** |
581 * @param {!Common.Event} event | 573 * @param {!Common.Event} event |
582 */ | 574 */ |
583 _onProfileTypeSelected(event) { | 575 _onProfileTypeSelected(event) { |
584 this._selectedProfileType = /** @type {!Profiler.ProfileType} */ (event.data
); | 576 this._selectedProfileType = /** @type {!Profiler.ProfileType} */ (event.data
); |
585 this._updateProfileTypeSpecificUI(); | 577 this._updateProfileTypeSpecificUI(); |
586 } | 578 } |
587 | 579 |
588 _updateProfileTypeSpecificUI() { | 580 _updateProfileTypeSpecificUI() { |
589 this._updateToggleRecordAction(this._toggleRecordAction.toggled()); | 581 this._updateToggleRecordAction(this._toggleRecordAction.toggled()); |
590 this._profileTypeToolbar.removeToolbarItems(); | |
591 var toolbarItems = this._selectedProfileType.toolbarItems(); | |
592 for (var i = 0; i < toolbarItems.length; ++i) | |
593 this._profileTypeToolbar.appendToolbarItem(toolbarItems[i]); | |
594 } | 582 } |
595 | 583 |
596 _reset() { | 584 _reset() { |
597 Profiler.ProfileTypeRegistry.instance.profileTypes().forEach(type => type.re
set()); | 585 Profiler.ProfileTypeRegistry.instance.profileTypes().forEach(type => type.re
set()); |
598 | 586 |
599 delete this.visibleView; | 587 delete this.visibleView; |
600 | 588 |
601 this._profileGroups = {}; | 589 this._profileGroups = {}; |
602 this._updateToggleRecordAction(false); | 590 this._updateToggleRecordAction(false); |
603 this._launcherView.profileFinished(); | 591 this._launcherView.profileFinished(); |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1243 * @param {string} actionId | 1231 * @param {string} actionId |
1244 * @return {boolean} | 1232 * @return {boolean} |
1245 */ | 1233 */ |
1246 handleAction(context, actionId) { | 1234 handleAction(context, actionId) { |
1247 var panel = UI.context.flavor(Profiler.ProfilesPanel); | 1235 var panel = UI.context.flavor(Profiler.ProfilesPanel); |
1248 console.assert(panel && panel instanceof Profiler.ProfilesPanel); | 1236 console.assert(panel && panel instanceof Profiler.ProfilesPanel); |
1249 panel.toggleRecord(); | 1237 panel.toggleRecord(); |
1250 return true; | 1238 return true; |
1251 } | 1239 } |
1252 }; | 1240 }; |
OLD | NEW |