Changeset 153928 in webkit
- Timestamp:
- Aug 11, 2013 4:10:57 PM (11 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 4 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r153894 r153928 1 2013-08-09 Dean Jackson <dino@apple.com> 2 3 Bootstrap canvas profiler 4 https://bugs.webkit.org/show_bug.cgi?id=119652 5 <rdar://problem/14703665> 6 7 Reviewed by Joseph Pecoraro. 8 9 Add enough to get an empty Canvas profile recording 10 and displayed. 11 12 * Localizations/en.lproj/localizedStrings.js: Add canvas strings. 13 * UserInterface/CanvasProfileObject.js: Added. Mostly copied from CSS Selector Profiles. 14 * UserInterface/CanvasProfileType.js: Added. Ditto. 15 * UserInterface/CanvasDataGridNode.js: Added. Ditto. 16 * UserInterface/CanvasProfileView.js: Added. Ditto. 17 * UserInterface/ContentView.js: 18 (WebInspector.ContentView): Add support for the new View type. 19 (WebInspector.ContentView.isViewable): 20 * UserInterface/InstrumentSidebarPanel.js: 21 (WebInspector.InstrumentSidebarPanel): Add support for canvas profiles. 22 (WebInspector.InstrumentSidebarPanel.prototype._recordProfileGlyphMousedOver): 23 (WebInspector.InstrumentSidebarPanel.prototype._recordProfileGlyphMousedDown): 24 (WebInspector.InstrumentSidebarPanel.prototype._recordProfileGlyphClicked): 25 (WebInspector.InstrumentSidebarPanel.prototype._profileTypeWasSelected): 26 (WebInspector.InstrumentSidebarPanel.prototype._profilesCleared): 27 * UserInterface/Main.html: Load the new files. 28 * UserInterface/ProfileManager.js: New methods and support for canvas profiles. 29 (WebInspector.ProfileManager): 30 (WebInspector.ProfileManager.prototype.initialize): 31 (WebInspector.ProfileManager.prototype.isProfilingCanvas): 32 (WebInspector.ProfileManager.prototype.startProfilingCanvas): 33 (WebInspector.ProfileManager.prototype.stopProfilingCanvas): 34 (WebInspector.ProfileManager.prototype._checkForInterruptions): 35 (WebInspector.ProfileManager.prototype._attemptToResumeProfiling): 36 1 37 2013-08-07 Timothy Hatcher <timothy@apple.com> 2 38 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r152979 r153928 55 55 localizedStrings["Breakpoints"] = "Breakpoints"; 56 56 localizedStrings["Bubbling"] = "Bubbling"; 57 localizedStrings["CANVAS PROFILES"] = "CANVAS PROFILES"; 57 58 localizedStrings["CSS SELECTOR PROFILES"] = "CSS SELECTOR PROFILES"; 58 59 localizedStrings["CSS Selector Profile %d"] = "CSS Selector Profile %d"; 59 60 localizedStrings["CSS selector profiles show how long the selector matching has taken in total and how many times a certain selector has matched DOM elements (the results are approximate due to matching algorithm optimizations.)"] = "CSS selector profiles show how long the selector matching has taken in total and how many times a certain selector has matched DOM elements (the results are approximate due to matching algorithm optimizations.)"; 60 61 localizedStrings["Cached"] = "Cached"; 62 localizedStrings["Call"] = "Call"; 61 63 localizedStrings["Call Stack"] = "Call Stack"; 62 64 localizedStrings["Calls"] = "Calls"; 65 localizedStrings["Canvas Profile %d"] = "Canvas Profile %d"; 66 localizedStrings["Canvas profiles allow you to examine drawing operations on canvas elements."] = "Canvas profiles allow you to examine drawing operations on canvas elements."; 63 67 localizedStrings["Capturing"] = "Capturing"; 64 68 localizedStrings["Catch Variables"] = "Catch Variables"; … … 73 77 localizedStrings["Collapse columns"] = "Collapse columns"; 74 78 localizedStrings["Collect CSS Selector Profile"] = "Collect CSS Selector Profile"; 79 localizedStrings["Collect Canvas Profile"] = "Collect Canvas Profile"; 75 80 localizedStrings["Collect JavaScript Profile"] = "Collect JavaScript Profile"; 76 81 localizedStrings["Comment"] = "Comment"; … … 281 286 localizedStrings["Recording"] = "Recording"; 282 287 localizedStrings["Recording CSS Selector Profile\u2026"] = "Recording CSS Selector Profile\u2026"; 288 localizedStrings["Recording Canvas Profile\u2026"] = "Recording Canvas Profile\u2026"; 283 289 localizedStrings["Recording JavaScript Profile\u2026"] = "Recording JavaScript Profile\u2026"; 284 290 localizedStrings["Recording\u2026"] = "Recording\u2026"; … … 336 342 localizedStrings["Start CSS Selector Profile"] = "Start CSS Selector Profile"; 337 343 localizedStrings["Start CSS selector profiling."] = "Start CSS selector profiling."; 344 localizedStrings["Start Canvas Profile"] = "Start Canvas Profile"; 345 localizedStrings["Start Canvas profiling."] = "Start Canvas profiling."; 338 346 localizedStrings["Start JavaScript Profile"] = "Start JavaScript Profile"; 339 347 localizedStrings["Start JavaScript profiling."] = "Start JavaScript profiling."; … … 346 354 localizedStrings["Step over (%s or %s)"] = "Step over (%s or %s)"; 347 355 localizedStrings["Stop CSS selector profiling."] = "Stop CSS selector profiling."; 356 localizedStrings["Stop Canvas profiling."] = "Stop Canvas profiling."; 348 357 localizedStrings["Stop JavaScript profiling."] = "Stop JavaScript profiling."; 349 358 localizedStrings["Stop Profiling"] = "Stop Profiling"; -
trunk/Source/WebInspectorUI/UserInterface/ContentView.js
r151453 r153928 66 66 if (representedObject instanceof WebInspector.JavaScriptProfileObject) 67 67 return new WebInspector.JavaScriptProfileView(representedObject); 68 68 69 69 if (representedObject instanceof WebInspector.CSSSelectorProfileObject) 70 70 return new WebInspector.CSSSelectorProfileView(representedObject); 71 72 if (representedObject instanceof WebInspector.CanvasProfileObject) 73 return new WebInspector.CanvasProfileView(representedObject); 71 74 72 75 if (typeof representedObject === "string" || representedObject instanceof String) … … 121 124 return true; 122 125 if (representedObject instanceof WebInspector.CSSSelectorProfileObject) 126 return true; 127 if (representedObject instanceof WebInspector.CanvasProfileObject) 123 128 return true; 124 129 if (typeof representedObject === "string" || representedObject instanceof String) -
trunk/Source/WebInspectorUI/UserInterface/InstrumentSidebarPanel.js
r153894 r153928 106 106 startCSSSelectorProfileOption.value = WebInspector.InstrumentSidebarPanel.StartCSSSelectorProfileValue; 107 107 startCSSSelectorProfileOption.selected = false; 108 108 109 var startCanvasProfileOption = document.createElement("option"); 110 startCanvasProfileOption.textContent = WebInspector.UIString("Start Canvas Profile"); 111 startCanvasProfileOption.value = WebInspector.InstrumentSidebarPanel.StartCanvasProfileValue; 112 startCanvasProfileOption.selected = false; 113 109 114 this._recordProfileGlyphElement.add(startJavaScriptProfileOption); 110 115 this._recordProfileGlyphElement.add(startCSSSelectorProfileOption); 116 this._recordProfileGlyphElement.add(startCanvasProfileOption); 111 117 112 118 profilesTitleBarElement.appendChild(this._recordProfileGlyphElement); … … 153 159 WebInspector.InstrumentSidebarPanel.StartJavaScriptProfileValue = "start-javascript-profile"; 154 160 WebInspector.InstrumentSidebarPanel.StartCSSSelectorProfileValue = "start-css-selector-profile"; 161 WebInspector.InstrumentSidebarPanel.StartCanvasProfileValue = "start-canvas-profile"; 155 162 156 163 WebInspector.InstrumentSidebarPanel.prototype = { … … 278 285 this._recordProfileGlyphElement.classList.remove(WebInspector.InstrumentSidebarPanel.RecordGlyphRecordingForcedStyleClass); 279 286 280 if (WebInspector.profileManager.isProfilingJavaScript() || WebInspector.profileManager.isProfilingCSSSelectors() )287 if (WebInspector.profileManager.isProfilingJavaScript() || WebInspector.profileManager.isProfilingCSSSelectors() || WebInspector.profileManager.isProfilingCanvas()) 281 288 this._recordProfileStatusElement.textContent = WebInspector.UIString("Stop Profiling"); 282 289 else … … 301 308 // We don't want to show the select if the user is currently profiling. In that case, 302 309 // the user should just be able to click the record button to stop profiling. 303 if (WebInspector.profileManager.isProfilingJavaScript() || WebInspector.profileManager.isProfilingCSSSelectors() )310 if (WebInspector.profileManager.isProfilingJavaScript() || WebInspector.profileManager.isProfilingCSSSelectors() || WebInspector.profileManager.isProfilingCanvas()) 304 311 event.preventDefault(); 305 312 else { … … 325 332 if (WebInspector.profileManager.isProfilingCSSSelectors()) 326 333 WebInspector.profileManager.stopProfilingCSSSelectors(); 334 if (WebInspector.profileManager.isProfilingCanvas()) 335 WebInspector.profileManager.stopProfilingCanvas(); 327 336 }, 328 337 … … 332 341 if (selectedIndex === -1) 333 342 return; 334 343 335 344 var selectedValue = this._recordProfileGlyphElement.options[selectedIndex].value; 336 345 if (selectedValue === WebInspector.InstrumentSidebarPanel.StartJavaScriptProfileValue) 337 346 WebInspector.profileManager.startProfilingJavaScript(); 347 else if (selectedValue === WebInspector.InstrumentSidebarPanel.StartCSSSelectorProfileValue) 348 WebInspector.profileManager.startProfilingCSSSelectors(); 338 349 else { 339 console.assert(selectedValue === WebInspector.InstrumentSidebarPanel.StartCSSSelectorProfileValue); 340 WebInspector.profileManager.startProfilingCSSSelectors(); 341 } 342 350 console.assert(selectedValue === WebInspector.InstrumentSidebarPanel.StartCanvasProfileValue); 351 WebInspector.profileManager.startProfilingCanvas(); 352 } 343 353 }, 344 354 … … 479 489 WebInspector.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.JavaScriptProfileView); 480 490 WebInspector.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.CSSSelectorProfileView); 491 WebInspector.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.CanvasProfileView); 481 492 482 493 this.updateEmptyContentPlaceholder(WebInspector.UIString("No Recorded Profiles")); -
trunk/Source/WebInspectorUI/UserInterface/Main.html
r153087 r153928 336 336 <script src="CSSSelectorProfileType.js"></script> 337 337 <script src="CSSSelectorProfileView.js"></script> 338 <script src="CanvasDataGridNode.js"></script> 339 <script src="CanvasProfileType.js"></script> 340 <script src="CanvasProfileView.js"></script> 338 341 <script src="ProfileObject.js"></script> 339 342 <script src="JavaScriptProfileObject.js"></script> 340 343 <script src="CSSSelectorProfileObject.js"></script> 344 <script src="CanvasProfileObject.js"></script> 341 345 <script src="DebuggerSidebarPanel.js"></script> 342 346 <script src="BreakpointTreeElement.js"></script> -
trunk/Source/WebInspectorUI/UserInterface/ProfileManager.js
r151453 r153928 30 30 this._javaScriptProfileType = new WebInspector.JavaScriptProfileType; 31 31 this._cssSelectorProfileType = new WebInspector.CSSSelectorProfileType; 32 this._canvasProfileType = new WebInspector.CanvasProfileType; 32 33 33 34 ProfilerAgent.enable(); … … 61 62 this._recordingJavaScriptProfile = null; 62 63 this._recordingCSSSelectorProfile = null; 64 this._recordingCanvasProfile = null; 63 65 64 66 this._isProfiling = false; … … 121 123 122 124 this._cssSelectorProfileType.stopRecordingProfile(cssProfilingStopped.bind(this)); 125 }, 126 127 isProfilingCanvas: function() 128 { 129 return this._canvasProfileType.isRecordingProfile(); 130 }, 131 132 startProfilingCanvas: function() 133 { 134 this._canvasProfileType.startRecordingProfile(); 135 136 var id = this._canvasProfileType.nextProfileId(); 137 this._recordingCanvasProfile = new WebInspector.CanvasProfileObject(WebInspector.UIString("Canvas Profile %d").format(id), id, true); 138 this.dispatchEventToListeners(WebInspector.ProfileManager.Event.ProfileWasAdded, {profile: this._recordingCanvasProfile}); 139 140 this.dispatchEventToListeners(WebInspector.ProfileManager.Event.ProfilingStarted); 141 }, 142 143 stopProfilingCanvas: function() 144 { 145 function canvasProfilingStopped(error, profile) 146 { 147 if (error) 148 return; 149 150 console.assert(this._recordingCanvasProfile); 151 152 this._recordingCanvasProfile.data = profile.data; 153 this._recordingCanvasProfile.recording = false; 154 155 this.dispatchEventToListeners(WebInspector.ProfileManager.Event.ProfileWasUpdated, {profile: this._recordingCanvasProfile}); 156 this.dispatchEventToListeners(WebInspector.ProfileManager.Event.ProfilingEnded, {profile: this._recordingCanvasProfile}); 157 158 this._recordingCanvasProfile = null; 159 } 160 161 this._canvasProfileType.stopRecordingProfile(canvasProfilingStopped.bind(this)); 123 162 }, 124 163 … … 212 251 this.dispatchEventToListeners(WebInspector.ProfileManager.Event.ProfilingInterrupted, {profile: this._recordingCSSSelectorProfile}); 213 252 this._cssSelectorProfileType.setRecordingProfile(false); 253 } else if (this._recordingCanvasProfile) { 254 this.dispatchEventToListeners(WebInspector.ProfileManager.Event.ProfilingInterrupted, {profile: this._recordingCanvasProfile}); 255 this._canvasProfileType.setRecordingProfile(false); 214 256 } 215 257 }, … … 223 265 else if (this._recordingCSSSelectorProfile) 224 266 this.startProfilingCSSSelectors(); 267 else if (this._recordingCanvasProfile) 268 this.startProfilingCanvas(); 225 269 } 226 270 };
Note: See TracChangeset
for help on using the changeset viewer.