Changeset 102906 in webkit
- Timestamp:
- Dec 15, 2011 1:37:32 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r102903 r102906 1 2011-12-14 Alexander Pavlov <apavlov@chromium.org> 2 3 Web Inspector: make ProfilesPanel scale as the number of ProfileTypes grows 4 https://bugs.webkit.org/show_bug.cgi?id=74391 5 6 Reviewed by Pavel Feldman. 7 8 Whenever a profile is started, this change disables all profile recording buttons, except the one 9 that correponds to the running profile. Once the profiling is finished, all buttons get enabled back again. 10 11 * English.lproj/localizedStrings.js: 12 * inspector/front-end/ProfileView.js: 13 (WebInspector.CPUProfileView.profileCallback): 14 (WebInspector.CPUProfileType.prototype.get buttonTooltip): 15 (WebInspector.CPUProfileType.prototype.get buttonStyle): 16 (WebInspector.CPUProfileType.prototype.buttonClicked): 17 * inspector/front-end/ProfilesPanel.js: 18 (WebInspector.ProfilesPanel.prototype.get statusBarItems.clickHandler): 19 (WebInspector.ProfilesPanel.prototype.get statusBarItems): 20 (WebInspector.ProfilesPanel.prototype._addProfileHeader): 21 (WebInspector.ProfilesPanel.prototype.updateProfileTypeButtons): 22 (WebInspector.ProfilesPanel.prototype._updateInterface): 23 (WebInspector.ProfilesPanel.prototype.setRecordingProfile): 24 (WebInspector.ProfilesPanel.prototype.takeHeapSnapshot): 25 (WebInspector.ProfilesPanel.prototype._reportHeapSnapshotProgress): 26 (WebInspector.ProfilerDispatcher.prototype.setRecordingProfile): 27 * inspector/front-end/inspector.css: 28 (.record-cpu-profile-status-bar-item .glyph): 29 (.record-cpu-profile-status-bar-item.toggled-on .glyph): 30 1 31 2011-12-15 Alexander Pavlov <apavlov@chromium.org> 2 32 -
trunk/Source/WebCore/inspector/front-end/ProfileView.js
r102803 r102906 86 86 if (error) 87 87 return; 88 89 if (!profile.head) { 90 // Profiling was tentatively terminated with the "Clear all profiles." button. 91 return; 92 } 88 93 this.profile.head = profile.head; 89 94 this._assignParentsInProfile(); … … 575 580 get buttonTooltip() 576 581 { 577 return this._recording ? WebInspector.UIString("Stop profiling.") : WebInspector.UIString("Startprofiling.");582 return this._recording ? WebInspector.UIString("Stop CPU profiling.") : WebInspector.UIString("Start CPU profiling."); 578 583 }, 579 584 580 585 get buttonStyle() 581 586 { 582 return this._recording ? "record- profile-status-bar-item status-bar-item toggled-on" : "record-profile-status-bar-item status-bar-item";587 return this._recording ? "record-cpu-profile-status-bar-item status-bar-item toggled-on" : "record-cpu-profile-status-bar-item status-bar-item"; 583 588 }, 584 589 585 590 buttonClicked: function() 586 591 { 587 this._recording = !this._recording;588 589 592 if (this._recording) { 593 this.stopRecordingProfile(); 594 WebInspector.networkManager.enableResourceTracking(); 595 } else 590 596 WebInspector.networkManager.disableResourceTracking(); 591 ProfilerAgent.start(); 592 } else { 593 ProfilerAgent.stop(); 594 WebInspector.networkManager.enableResourceTracking(); 597 this.startRecordingProfile(); 595 598 } 596 599 }, -
trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js
r101651 r102906 153 153 get statusBarItems() 154 154 { 155 function clickHandler(profileType, button Element)155 function clickHandler(profileType, button) 156 156 { 157 var wasProfiling = button.toggled; 157 158 profileType.buttonClicked.call(profileType); 158 this.updateProfileTypeButtons( );159 this.updateProfileTypeButtons(!wasProfiling, button); 159 160 } 160 161 … … 164 165 var profileType = this.getProfileType(typeId); 165 166 if (profileType.buttonStyle) { 166 var button = new WebInspector.StatusBarButton(profileType.buttonTooltip, profileType.buttonStyle , profileType.buttonCaption);167 this._profileTypeButtonsByIdMap[typeId] = button .element;168 button.element.addEventListener("click", clickHandler.bind(this, profileType, button .element), false);167 var button = new WebInspector.StatusBarButton(profileType.buttonTooltip, profileType.buttonStyle); 168 this._profileTypeButtonsByIdMap[typeId] = button; 169 button.element.addEventListener("click", clickHandler.bind(this, profileType, button), false); 169 170 items.push(button.element); 170 171 } … … 287 288 _addProfileHeader: function(profile) 288 289 { 289 if (this.hasTemporaryProfile(profile.typeId)) { 290 if (profile.typeId === WebInspector.CPUProfileType.TypeId) 291 this._removeProfileHeader(this._temporaryRecordingProfile); 292 else 293 this._removeProfileHeader(this._temporaryTakingSnapshot); 294 } 290 if (this.hasTemporaryProfile(profile.typeId)) 291 this._removeProfileHeader(this._temporaryRecordingProfile); 295 292 296 293 var typeId = profile.typeId; … … 353 350 this.showProfile(profile); 354 351 this.dispatchEventToListeners("profile added"); 352 this.updateProfileTypeButtons(false, this._profileTypeButtonsByIdMap[typeId]); 355 353 } 356 354 }, … … 506 504 }, 507 505 508 updateProfileTypeButtons: function() 506 /** 507 * @param {boolean} isProfiling 508 * @param {WebInspector.StatusBarButton=} effectButton 509 */ 510 updateProfileTypeButtons: function(isProfiling, effectButton) 509 511 { 510 512 for (var typeId in this._profileTypeButtonsByIdMap) { 511 var button Element= this._profileTypeButtonsByIdMap[typeId];513 var button = this._profileTypeButtonsByIdMap[typeId]; 512 514 var profileType = this.getProfileType(typeId); 513 button Element.className = profileType.buttonStyle;514 button Element.title = profileType.buttonTooltip;515 button.element.className = profileType.buttonStyle; 516 button.element.title = profileType.buttonTooltip; 515 517 // FIXME: Apply profileType.buttonCaption once captions are added to button controls. 518 if (!isProfiling) 519 button.disabled = false; 520 else { 521 if (effectButton && button !== effectButton) 522 button.disabled = true; 523 } 516 524 } 517 525 }, … … 753 761 this.enableToggleButton.toggled = true; 754 762 for (var typeId in this._profileTypeButtonsByIdMap) 755 this._profileTypeButtonsByIdMap[typeId]. removeStyleClass("hidden");763 this._profileTypeButtonsByIdMap[typeId].visible = true; 756 764 this.profileViewStatusBarItemsContainer.removeStyleClass("hidden"); 757 765 this.clearResultsButton.element.removeStyleClass("hidden"); … … 761 769 this.enableToggleButton.toggled = false; 762 770 for (var typeId in this._profileTypeButtonsByIdMap) 763 this._profileTypeButtonsByIdMap[typeId]. addStyleClass("hidden");771 this._profileTypeButtonsByIdMap[typeId].visible = false; 764 772 this.profileViewStatusBarItemsContainer.addStyleClass("hidden"); 765 773 this.clearResultsButton.element.addStyleClass("hidden"); … … 825 833 }, 826 834 827 _setRecordingProfile: function(isProfiling)828 { 829 this.getProfileType( WebInspector.CPUProfileType.TypeId).setRecordingProfile(isProfiling);830 if (this.hasTemporaryProfile( WebInspector.CPUProfileType.TypeId) !== isProfiling) {835 setRecordingProfile: function(profileType, isProfiling) 836 { 837 this.getProfileType(profileType).setRecordingProfile(isProfiling); 838 if (this.hasTemporaryProfile(profileType) !== isProfiling) { 831 839 if (!this._temporaryRecordingProfile) { 832 840 this._temporaryRecordingProfile = { 833 typeId: WebInspector.CPUProfileType.TypeId,834 title: WebInspector.UIString("Recording …"),841 typeId: profileType, 842 title: WebInspector.UIString("Recording\u2026"), 835 843 uid: -1, 836 844 isTemporary: true … … 839 847 if (isProfiling) { 840 848 this._addProfileHeader(this._temporaryRecordingProfile); 841 WebInspector.userMetrics.ProfilesCPUProfileTaken.record(); 842 } else 849 if (profileType === WebInspector.CPUProfileType.TypeId) 850 WebInspector.userMetrics.ProfilesCPUProfileTaken.record(); 851 } else { 843 852 this._removeProfileHeader(this._temporaryRecordingProfile); 844 } 845 this.updateProfileTypeButtons(); 853 delete this._temporaryRecordingProfile; 854 } 855 } 846 856 }, 847 857 … … 849 859 { 850 860 if (!this.hasTemporaryProfile(WebInspector.DetailedHeapshotProfileType.TypeId)) { 851 if (!this._temporary TakingSnapshot) {852 this._temporary TakingSnapshot= {861 if (!this._temporaryRecordingProfile) { 862 this._temporaryRecordingProfile = { 853 863 typeId: WebInspector.DetailedHeapshotProfileType.TypeId, 854 title: WebInspector.UIString("Snapshotting …"),864 title: WebInspector.UIString("Snapshotting\u2026"), 855 865 uid: -1, 856 866 isTemporary: true 857 867 }; 858 868 } 859 this._addProfileHeader(this._temporary TakingSnapshot);869 this._addProfileHeader(this._temporaryRecordingProfile); 860 870 } 861 871 ProfilerAgent.takeHeapSnapshot(); … … 866 876 { 867 877 if (this.hasTemporaryProfile(WebInspector.DetailedHeapshotProfileType.TypeId)) { 868 this._temporary TakingSnapshot.sidebarElement.subtitle = WebInspector.UIString("%.2f%%", (done / total) * 100);869 this._temporary TakingSnapshot.sidebarElement.wait = true;878 this._temporaryRecordingProfile.sidebarElement.subtitle = WebInspector.UIString("%.2f%%", (done / total) * 100); 879 this._temporaryRecordingProfile.sidebarElement.wait = true; 870 880 if (done >= total) 871 this._removeProfileHeader(this._temporary TakingSnapshot);881 this._removeProfileHeader(this._temporaryRecordingProfile); 872 882 } 873 883 } … … 905 915 setRecordingProfile: function(isProfiling) 906 916 { 907 this._profiler. _setRecordingProfile(isProfiling);917 this._profiler.setRecordingProfile(WebInspector.CPUProfileType.TypeId, isProfiling); 908 918 }, 909 919 -
trunk/Source/WebCore/inspector/front-end/inspector.css
r102671 r102906 2508 2508 } 2509 2509 2510 .record- profile-status-bar-item .glyph {2510 .record-cpu-profile-status-bar-item .glyph { 2511 2511 -webkit-mask-position: -288px 0; 2512 2512 } 2513 2513 2514 .record- profile-status-bar-item.toggled-on .glyph {2514 .record-cpu-profile-status-bar-item.toggled-on .glyph { 2515 2515 -webkit-mask-position: -288px -24px; 2516 2516 background-color: rgb(216, 0, 0) !important;
Note: See TracChangeset
for help on using the changeset viewer.