Changeset 143580 in webkit
- Timestamp:
- Feb 21, 2013 3:39:17 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/inspector/profiler/canvas2d/canvas-replay-log-grid.html
r143324 r143580 56 56 { 57 57 profileHeader = profilesPanel.getProfiles(WebInspector.CanvasProfileType.TypeId)[0]; 58 profilesPanel. showProfile(profileHeader);58 profilesPanel._showProfile(profileHeader); 59 59 InspectorTest.addSniffer(profileHeader, "_updateCapturingStatus", didReceiveFirstFrame); 60 60 InspectorTest.evaluateInConsole("doSomeCanvasCalls(2)"); -
trunk/LayoutTests/inspector/profiler/heap-snapshot-inspect-dom-wrapper.html
r142460 r143580 20 20 { 21 21 var profiles = WebInspector.panels.profiles.getProfiles("HEAP"); 22 WebInspector.panels.profiles. showProfile(profiles[profiles.length - 1]);22 WebInspector.panels.profiles._showProfile(profiles[profiles.length - 1]); 23 23 InspectorTest.addSniffer(WebInspector.panels.profiles, "_finishHeapSnapshot", step1); 24 24 } -
trunk/LayoutTests/inspector/profiler/heap-snapshot-loader.html
r142460 r143580 46 46 47 47 InspectorTest.override(HeapProfilerAgent, "getHeapSnapshot", getHeapSnapshotMock); 48 panel. showProfile(profileHeader);48 panel._showProfile(profileHeader); 49 49 } 50 50 -
trunk/LayoutTests/inspector/profiler/heap-snapshot-test.js
r143159 r143580 739 739 InspectorTest._takeAndOpenSnapshotCallback = callback; 740 740 WebInspector.panels.profiles.addProfileHeader(profile); 741 WebInspector.panels.profiles. showProfile(profile);741 WebInspector.panels.profiles._showProfile(profile); 742 742 }; 743 743 -
trunk/LayoutTests/inspector/profiler/profiler-test.js
r103803 r143580 67 67 { 68 68 if (InspectorTest._showProfileWhenAdded === profile.title) { 69 WebInspector.panels.profiles. showProfile(profile);69 WebInspector.panels.profiles._showProfile(profile); 70 70 } 71 71 }; -
trunk/PerformanceTests/inspector/heap-snapshot-performance-test.js
r142460 r143580 35 35 transferTimerCookie = timer.start("transfer-snapshot"); 36 36 var profiles = WebInspector.panels.profiles.getProfiles("HEAP"); 37 WebInspector.panels.profiles. showProfile(profiles[profiles.length - 1]);37 WebInspector.panels.profiles._showProfile(profiles[profiles.length - 1]); 38 38 InspectorTest.addSniffer(WebInspector.panels.profiles, "_finishHeapSnapshot", step1); 39 39 } -
trunk/Source/WebCore/ChangeLog
r143578 r143580 1 2013-02-19 Eugene Klyuchnikov <eustas@chromium.org> 2 3 Web Inspector: [Console] Add console API message types for profile/profileEnd. 4 https://bugs.webkit.org/show_bug.cgi?id=109790 5 6 Reviewed by Pavel Feldman. 7 8 With profile/profileEnd message types we will gain more control over 9 output messages. 10 11 * English.lproj/localizedStrings.js: Added corresponging strings. 12 * inspector/ConsoleAPITypes.h: Added enum members. 13 * inspector/Inspector.json: Ditto. 14 * inspector/front-end/ConsoleModel.js: Ditto. 15 * inspector/ConsoleMessage.cpp: 16 (WebCore::messageTypeValue): Added cases. 17 * inspector/InspectorProfilerAgent.cpp: Adopted changes. 18 * inspector/front-end/inspector.js: Ditto. 19 * inspector/front-end/ConsoleMessage.js: 20 Added message generators for introduced message types. 21 * inspector/front-end/ProfilesPanel.js: 22 Turned showProfileForURL(url) to showProfile(typeId, uid). 23 * inspector/front-end/ProfilesPanelDescriptor.js: 24 (WebInspector.ProfilesPanelDescriptor.resolveProfileTitle): Added. 25 * inspector/front-end/ResourceUtils.js: Removed linkifier plugins. 26 1 27 2013-02-21 Tamas Czene <tczene@inf.u-szeged.hu> 2 28 -
trunk/Source/WebCore/English.lproj/localizedStrings.js
r143573 r143580 312 312 localizedStrings["Pausing"] = "Pausing"; 313 313 localizedStrings["Preview"] = "Preview"; 314 localizedStrings["Profile '%s' started."] = "Profile '%s' started."; 315 localizedStrings["Profile '%s' finished."] = "Profile '%s' finished."; 314 316 localizedStrings["Profiles"] = "Profiles"; 315 317 localizedStrings["Profiling disabled. Click to enable."] = "Profiling disabled. Click to enable."; -
trunk/Source/WebCore/inspector/ConsoleAPITypes.h
r143186 r143580 39 39 ClearMessageType, 40 40 AssertMessageType, 41 TimingMessageType 41 TimingMessageType, 42 ProfileMessageType, 43 ProfileEndMessageType 42 44 }; 43 45 -
trunk/Source/WebCore/inspector/ConsoleMessage.cpp
r143186 r143580 162 162 case AssertMessageType: return TypeBuilder::Console::ConsoleMessage::Type::Assert; 163 163 case TimingMessageType: return TypeBuilder::Console::ConsoleMessage::Type::Timing; 164 case ProfileMessageType: return TypeBuilder::Console::ConsoleMessage::Type::Profile; 165 case ProfileEndMessageType: return TypeBuilder::Console::ConsoleMessage::Type::ProfileEnd; 164 166 } 165 167 return TypeBuilder::Console::ConsoleMessage::Type::Log; -
trunk/Source/WebCore/inspector/Inspector.json
r143574 r143580 772 772 { "name": "level", "type": "string", "enum": ["tip", "log", "warning", "error", "debug"], "description": "Message severity." }, 773 773 { "name": "text", "type": "string", "description": "Message text." }, 774 { "name": "type", "type": "string", "optional": true, "enum": ["log", "dir", "dirxml", "table", "trace", "clear", "startGroup", "startGroupCollapsed", "endGroup", "assert", "timing" ], "description": "Console message type." },774 { "name": "type", "type": "string", "optional": true, "enum": ["log", "dir", "dirxml", "table", "trace", "clear", "startGroup", "startGroupCollapsed", "endGroup", "assert", "timing", "profile", "profileEnd"], "description": "Console message type." }, 775 775 { "name": "url", "type": "string", "optional": true, "description": "URL of the message origin." }, 776 776 { "name": "line", "type": "integer", "optional": true, "description": "Line number in the resource that generated this message." }, … … 3490 3490 { "name": "result", "$ref": "CallArgument", "optional": true }, 3491 3491 { "name": "isDrawingCall", "type": "boolean", "optional": true }, 3492 { "name": "isFrameEndCall", "type": "boolean", "optional": true },3493 3492 { "name": "property", "type": "string", "optional": true }, 3494 3493 { "name": "value", "$ref": "CallArgument", "optional": true }, -
trunk/Source/WebCore/inspector/InspectorProfilerAgent.cpp
r143449 r143580 165 165 return; 166 166 RefPtr<ScriptProfile> profile = prpProfile; 167 String title = profile->title(); 168 String message = makeString("Profile \"webkit-profile://", CPUProfileType, '/', encodeWithURLEscapeSequences(title), '#', String::number(profile->uid()), "\" finished."); 169 m_consoleAgent->addMessageToConsole(ConsoleAPIMessageSource, LogMessageType, DebugMessageLevel, message, sourceURL, lineNumber); 167 String message = makeString(profile->title(), '#', String::number(profile->uid())); 168 m_consoleAgent->addMessageToConsole(ConsoleAPIMessageSource, ProfileEndMessageType, DebugMessageLevel, message, sourceURL, lineNumber); 170 169 } 171 170 … … 174 173 if (!m_frontend) 175 174 return; 176 String message = makeString("Profile \"webkit-profile://", CPUProfileType, '/', encodeWithURLEscapeSequences(title), "#0\" started."); 177 m_consoleAgent->addMessageToConsole(ConsoleAPIMessageSource, LogMessageType, DebugMessageLevel, message, sourceURL, lineNumber); 175 m_consoleAgent->addMessageToConsole(ConsoleAPIMessageSource, ProfileMessageType, DebugMessageLevel, title, sourceURL, lineNumber); 178 176 } 179 177 -
trunk/Source/WebCore/inspector/front-end/ConsoleMessage.js
r143186 r143580 112 112 this._messageElement = this._format(args); 113 113 break; 114 case WebInspector.ConsoleMessage.MessageType.Profile: 115 var title = WebInspector.ProfilesPanelDescriptor.resolveProfileTitle(this._messageText); 116 this._messageElement = document.createTextNode(WebInspector.UIString("Profile '%s' started.", title)); 117 break; 118 case WebInspector.ConsoleMessage.MessageType.ProfileEnd: 119 var hashIndex = this._messageText.lastIndexOf("#"); 120 var title = WebInspector.ProfilesPanelDescriptor.resolveProfileTitle(this._messageText.substring(0, hashIndex)); 121 var uid = this._messageText.substring(hashIndex + 1); 122 var format = WebInspector.UIString("Profile '%s' finished.", "%_"); 123 var link = WebInspector.linkifyURLAsNode("webkit-profile://CPU/" + uid, title); 124 this._messageElement = document.createElement("span"); 125 this._formatWithSubstitutionString(format, [link], this._messageElement); 126 break; 114 127 default: 115 128 var args = this._parameters || [this._messageText]; … … 248 261 if (shouldFormatMessage) { 249 262 // Multiple parameters with the first being a format string. Save unused substitutions. 250 var result = this._formatWithSubstitutionString(parameters , formattedResult);263 var result = this._formatWithSubstitutionString(parameters[0].description, parameters.slice(1), formattedResult); 251 264 parameters = result.unusedSubstitutions; 252 265 if (parameters.length) … … 566 579 }, 567 580 568 _formatWithSubstitutionString: function( parameters, formattedResult)581 _formatWithSubstitutionString: function(format, parameters, formattedResult) 569 582 { 570 583 var formatters = {}; … … 592 605 return "NaN"; 593 606 return Math.floor(obj.value); 607 } 608 609 function bypassFormatter(obj) 610 { 611 return (obj instanceof Node) ? obj : ""; 594 612 } 595 613 … … 630 648 // Support %O to force object formatting, instead of the type-based %o formatting. 631 649 formatters.O = parameterFormatter.bind(this, true); 650 651 formatters._ = bypassFormatter; 632 652 633 653 function append(a, b) … … 650 670 651 671 // String.format does treat formattedResult like a Builder, result is an object. 652 return String.format( parameters[0].description, parameters.slice(1), formatters, formattedResult, append);672 return String.format(format, parameters, formatters, formattedResult, append); 653 673 }, 654 674 … … 821 841 typeString = "Result"; 822 842 break; 843 case WebInspector.ConsoleMessage.MessageType.Profile: 844 case WebInspector.ConsoleMessage.MessageType.ProfileEnd: 845 typeString = "Profiling"; 846 break; 823 847 } 824 848 -
trunk/Source/WebCore/inspector/front-end/ConsoleModel.js
r143186 r143580 238 238 EndGroup: "endGroup", 239 239 Assert: "assert", 240 Result: "result" 240 Result: "result", 241 Profile: "profile", 242 ProfileEnd: "profileEnd" 241 243 } 242 244 -
trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js
r143159 r143580 603 603 if (!profile.isTemporary) { 604 604 if (!this.visibleView) 605 this. showProfile(profile);605 this._showProfile(profile); 606 606 this.dispatchEventToListeners("profile added", { 607 607 type: typeId … … 651 651 * @param {WebInspector.ProfileHeader} profile 652 652 */ 653 showProfile: function(profile)653 _showProfile: function(profile) 654 654 { 655 655 if (!profile || profile.isTemporary) … … 705 705 // TODO: allow to choose snapshot if there are several options. 706 706 if (profile.maxJSObjectId >= snapshotObjectId) { 707 this. showProfile(profile);707 this._showProfile(profile); 708 708 profile.view().changeView(viewName, function() { 709 709 profile.view().dataGrid.highlightObjectByHeapSnapshotId(snapshotObjectId); … … 774 774 showView: function(view) 775 775 { 776 this. showProfile(view.profile);776 this._showProfile(view.profile); 777 777 }, 778 778 … … 786 786 787 787 /** 788 * @param {string} url 789 */ 790 showProfileForURL: function(url) 791 { 792 var match = url.match(WebInspector.ProfilesPanelDescriptor.ProfileURLRegExp); 793 if (!match) 794 return; 795 this.showProfile(this._profilesIdMap[this._makeKey(Number(match[3]), match[1])]); 788 * @param {string} typeId 789 * @param {string} uid 790 */ 791 showProfile: function(typeId, uid) 792 { 793 this._showProfile(this._profilesIdMap[this._makeKey(Number(uid), typeId)]); 796 794 }, 797 795 … … 801 799 this.visibleView.detach(); 802 800 delete this.visibleView; 803 },804 805 /**806 * @param {string} title807 * @param {string} typeId808 */809 displayTitleForProfileLink: function(title, typeId)810 {811 title = unescape(title);812 if (title.startsWith(UserInitiatedProfileName)) {813 title = WebInspector.UIString("Profile %d", title.substring(UserInitiatedProfileName.length + 1));814 } else {815 var titleKey = this._makeTitleKey(title, typeId);816 if (!(titleKey in this._profileGroupsForLinks))817 this._profileGroupsForLinks[titleKey] = 0;818 819 var groupNumber = ++this._profileGroupsForLinks[titleKey];820 821 if (groupNumber > 2)822 // The title is used in the console message announcing that a profile has started so it gets823 // incremented twice as often as it's displayed824 title += " " + WebInspector.UIString("Run %d", (groupNumber + 1) / 2);825 }826 827 return title;828 801 }, 829 802 … … 1408 1381 { 1409 1382 if (!this._suppressOnSelect) 1410 this.treeOutline.panel. showProfile(this.profile);1383 this.treeOutline.panel._showProfile(this.profile); 1411 1384 }, 1412 1385 … … 1484 1457 { 1485 1458 if (this.children.length > 0) 1486 WebInspector.ProfilesPanel._instance. showProfile(this.children[this.children.length - 1].profile);1459 WebInspector.ProfilesPanel._instance._showProfile(this.children[this.children.length - 1].profile); 1487 1460 }, 1488 1461 -
trunk/Source/WebCore/inspector/front-end/ProfilesPanelDescriptor.js
r143159 r143580 65 65 return parseInt(suffix, 10); 66 66 } 67 68 /** 69 * @param {string} title 70 * @return {string} 71 */ 72 WebInspector.ProfilesPanelDescriptor.resolveProfileTitle = function(title) 73 { 74 if (!WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(title)) 75 return title; 76 return WebInspector.UIString("Profile %d", WebInspector.ProfilesPanelDescriptor.userInitiatedProfileIndex(title)); 77 } -
trunk/Source/WebCore/inspector/front-end/ResourceUtils.js
r143448 r143580 124 124 } 125 125 126 WebInspector._linkifierPlugins = [];127 128 /**129 * @param {function(string):string} plugin130 */131 WebInspector.registerLinkifierPlugin = function(plugin)132 {133 WebInspector._linkifierPlugins.push(plugin);134 }135 136 126 /** 137 127 * @param {string} string … … 148 138 function linkifier(title, url, lineNumber) 149 139 { 150 for (var i = 0; i < WebInspector._linkifierPlugins.length; ++i)151 title = WebInspector._linkifierPlugins[i](title);152 153 140 var isExternal = !WebInspector.resourceForURL(url); 154 141 var urlNode = WebInspector.linkifyURLAsNode(url, title, undefined, isExternal); -
trunk/Source/WebCore/inspector/front-end/inspector.js
r143448 r143580 273 273 }, 274 274 275 _profilesLinkifier: function(title)276 {277 var profileStringMatches = WebInspector.ProfilesPanelDescriptor.ProfileURLRegExp.exec(title);278 if (profileStringMatches) {279 var profilesPanel = /** @ type {WebInspector.ProfilesPanel} */ WebInspector.panel("profiles");280 title = WebInspector.ProfilesPanel._instance.displayTitleForProfileLink(profileStringMatches[2], profileStringMatches[1]);281 }282 return title;283 },284 285 275 _debuggerPaused: function() 286 276 { … … 469 459 470 460 this.addMainEventListeners(document); 471 WebInspector.registerLinkifierPlugin(this._profilesLinkifier.bind(this));472 461 473 462 window.addEventListener("resize", this.windowResize.bind(this), true); … … 584 573 { 585 574 var anchor = event.target.enclosingNodeOrSelfWithNodeName("a"); 586 if (!anchor || (anchor.target === "_blank" && !WebInspector.ProfilesPanelDescriptor.ProfileURLRegExp.exec(anchor.href)))575 if (!anchor || (anchor.target === "_blank")) 587 576 return; 588 577 … … 597 586 const profileMatch = WebInspector.ProfilesPanelDescriptor.ProfileURLRegExp.exec(anchor.href); 598 587 if (profileMatch) { 599 WebInspector.showP rofileForURL(anchor.href);588 WebInspector.showPanel("profiles").showProfile(profileMatch[1], profileMatch[2]); 600 589 return; 601 590 } … … 985 974 } 986 975 987 WebInspector.showProfileForURL = function(url)988 {989 WebInspector.showPanel("profiles").showProfileForURL(url);990 }991 992 976 WebInspector.evaluateInConsole = function(expression, showResultOnly) 993 977 {
Note: See TracChangeset
for help on using the changeset viewer.