Commit 080e5dc2 authored by timothy@apple.com's avatar timothy@apple.com
Browse files

Generate better display names for timer and event Timeline records.

Also support AnimationFrameRequested and AnimationFrameCanceled.

https://bugs.webkit.org/show_bug.cgi?id=127258

Reviewed by Joseph Pecoraro.

* Localizations/en.lproj/localizedStrings.js: Updated.

* UserInterface/LayoutTimelineRecord.js:
(WebInspector.LayoutTimelineRecord.EventType.displayName):
Generate past tense names that better match other names.

* UserInterface/ScriptTimelineDataGridNode.js:
(WebInspector.ScriptTimelineDataGridNode.prototype.createCellContent):
Pass the details to displayName.

* UserInterface/ScriptTimelineRecord.js:
(WebInspector.ScriptTimelineRecord.EventType.displayName):
Generate better names for timer and event records. Also add missing animation frame types.

* UserInterface/ScriptTimelineView.js:
(WebInspector.ScriptTimelineView.prototype._processPendingRecords):
Pass true to WebInspector.TimelineRecordTreeElement to include timer identifiers in the title.

* UserInterface/SourceCodeTimelineTreeElement.js:
(WebInspector.SourceCodeTimelineTreeElement):
Pass includeTimerIdentifierInMainTitle through to TimelineRecordTreeElement.

* UserInterface/TimelineManager.js:
(WebInspector.TimelineManager.prototype.eventRecorded.processRecord):
Include AnimationFrameRequested and AnimationFrameCanceled.

* UserInterface/TimelineRecordTreeElement.js:
(WebInspector.TimelineRecordTreeElement):
Use displayName functions instead and support includeTimerIdentifierInMainTitle.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162420 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 594b2d9a
2014-01-19 Timothy Hatcher <timothy@apple.com>
Generate better display names for timer and event Timeline records.
Also support AnimationFrameRequested and AnimationFrameCanceled.
https://bugs.webkit.org/show_bug.cgi?id=127258
Reviewed by Joseph Pecoraro.
* Localizations/en.lproj/localizedStrings.js: Updated.
* UserInterface/LayoutTimelineRecord.js:
(WebInspector.LayoutTimelineRecord.EventType.displayName):
Generate past tense names that better match other names.
* UserInterface/ScriptTimelineDataGridNode.js:
(WebInspector.ScriptTimelineDataGridNode.prototype.createCellContent):
Pass the details to displayName.
* UserInterface/ScriptTimelineRecord.js:
(WebInspector.ScriptTimelineRecord.EventType.displayName):
Generate better names for timer and event records. Also add missing animation frame types.
* UserInterface/ScriptTimelineView.js:
(WebInspector.ScriptTimelineView.prototype._processPendingRecords):
Pass true to WebInspector.TimelineRecordTreeElement to include timer identifiers in the title.
* UserInterface/SourceCodeTimelineTreeElement.js:
(WebInspector.SourceCodeTimelineTreeElement):
Pass includeTimerIdentifierInMainTitle through to TimelineRecordTreeElement.
* UserInterface/TimelineManager.js:
(WebInspector.TimelineManager.prototype.eventRecorded.processRecord):
Include AnimationFrameRequested and AnimationFrameCanceled.
* UserInterface/TimelineRecordTreeElement.js:
(WebInspector.TimelineRecordTreeElement):
Use displayName functions instead and support includeTimerIdentifierInMainTitle.
2014-01-19 Timothy Hatcher <timothy@apple.com>
Implement basic versions of the TimelineOverview graphs.
......
......@@ -52,11 +52,11 @@ WebInspector.LayoutTimelineRecord.EventType.displayName = function(eventType)
{
switch(eventType) {
case WebInspector.LayoutTimelineRecord.EventType.InvalidateStyles:
return WebInspector.UIString("Invalidate Styles");
return WebInspector.UIString("Styles Invalidated");
case WebInspector.LayoutTimelineRecord.EventType.RecalculateStyles:
return WebInspector.UIString("Recalculate Styles");
return WebInspector.UIString("Styles Recalculated");
case WebInspector.LayoutTimelineRecord.EventType.InvalidateLayout:
return WebInspector.UIString("Invalidate Layout");
return WebInspector.UIString("Layout Invalidated");
case WebInspector.LayoutTimelineRecord.EventType.Layout:
return WebInspector.UIString("Layout");
case WebInspector.LayoutTimelineRecord.EventType.Paint:
......
......@@ -64,7 +64,7 @@ WebInspector.ScriptTimelineDataGridNode.prototype = {
switch (columnIdentifier) {
case "eventType":
return WebInspector.ScriptTimelineRecord.EventType.displayName(value);
return WebInspector.ScriptTimelineRecord.EventType.displayName(value, this._record.details);
case "details":
return value ? value : emptyValuePlaceholderString;
......
......@@ -42,24 +42,194 @@ WebInspector.ScriptTimelineRecord.EventType = {
TimerFired: "script-timeline-record-timer-fired",
TimerInstalled: "script-timeline-record-timer-installed",
TimerRemoved: "script-timeline-record-timer-removed",
AnimationFrameFired: "script-timeline-record-animation-frame-fired"
AnimationFrameFired: "script-timeline-record-animation-frame-fired",
AnimationFrameRequested: "script-timeline-record-animation-frame-requested",
AnimationFrameCanceled: "script-timeline-record-animation-frame-canceled"
};
WebInspector.ScriptTimelineRecord.EventType.displayName = function(eventType)
WebInspector.ScriptTimelineRecord.EventType.displayName = function(eventType, details, includeTimerIdentifierInMainTitle)
{
if (details && !WebInspector.ScriptTimelineRecord._eventDisplayNames) {
// These display names are not localized because they closely represent
// the real API name, just with word spaces and Title Case.
var nameMap = new Map;
nameMap.set("DOMActivate", "DOM Activate");
nameMap.set("DOMCharacterDataModified", "DOM Character Data Modified");
nameMap.set("DOMContentLoaded", "DOM Content Loaded");
nameMap.set("DOMFocusIn", "DOM Focus In");
nameMap.set("DOMFocusOut", "DOM Focus Out");
nameMap.set("DOMNodeInserted", "DOM Node Inserted");
nameMap.set("DOMNodeInsertedIntoDocument", "DOM Node Inserted Into Document");
nameMap.set("DOMNodeRemoved", "DOM Node Removed");
nameMap.set("DOMNodeRemovedFromDocument", "DOM Node Removed From Document");
nameMap.set("DOMSubtreeModified", "DOM Sub-Tree Modified");
nameMap.set("addsourcebuffer", "Add Source Buffer");
nameMap.set("addstream", "Add Stream");
nameMap.set("addtrack", "Add Track");
nameMap.set("audioend", "Audio End");
nameMap.set("audioprocess", "Audio Process");
nameMap.set("audiostart", "Audio Start");
nameMap.set("beforecopy", "Before Copy");
nameMap.set("beforecut", "Before Cut");
nameMap.set("beforeload", "Before Load");
nameMap.set("beforepaste", "Before Paste");
nameMap.set("beforeunload", "Before Unload");
nameMap.set("canplay", "Can Play");
nameMap.set("canplaythrough", "Can Play Through");
nameMap.set("chargingchange", "Charging Change");
nameMap.set("chargingtimechange", "Charging Time Change");
nameMap.set("compositionend", "Composition End");
nameMap.set("compositionstart", "Composition Start");
nameMap.set("compositionupdate", "Composition Update");
nameMap.set("contextmenu", "Context Menu");
nameMap.set("cuechange", "Cue Change");
nameMap.set("datachannel", "Data Channel");
nameMap.set("dblclick", "Double Click");
nameMap.set("devicemotion", "Device Motion");
nameMap.set("deviceorientation", "Device Orientation");
nameMap.set("dischargingtimechange", "Discharging Time Change");
nameMap.set("dragend", "Drag End");
nameMap.set("dragenter", "Drag Enter");
nameMap.set("dragleave", "Drag Leave");
nameMap.set("dragover", "Drag Over");
nameMap.set("dragstart", "Drag Start");
nameMap.set("durationchange", "Duration Change");
nameMap.set("focusin", "Focus In");
nameMap.set("focusout", "Focus Out");
nameMap.set("gesturechange", "Gesture Change");
nameMap.set("gestureend", "Gesture End");
nameMap.set("gesturescrollend", "Gesture Scroll End");
nameMap.set("gesturescrollstart", "Gesture Scroll Start");
nameMap.set("gesturescrollupdate", "Gesture Scroll Update");
nameMap.set("gesturestart", "Gesture Start");
nameMap.set("gesturetap", "Gesture Tap");
nameMap.set("gesturetapdown", "Gesture Tap Down");
nameMap.set("hashchange", "Hash Change");
nameMap.set("icecandidate", "ICE Candidate");
nameMap.set("iceconnectionstatechange", "ICE Connection State Change");
nameMap.set("keydown", "Key Down");
nameMap.set("keypress", "Key Press");
nameMap.set("keyup", "Key Up");
nameMap.set("levelchange", "Level Change");
nameMap.set("loadeddata", "Loaded Data");
nameMap.set("loadedmetadata", "Loaded Metadata");
nameMap.set("loadend", "Load End");
nameMap.set("loadingdone", "Loading Done");
nameMap.set("loadstart", "Load Start");
nameMap.set("mousedown", "Mouse Down");
nameMap.set("mouseenter", "Mouse Enter");
nameMap.set("mouseleave", "Mouse Leave");
nameMap.set("mousemove", "Mouse Move");
nameMap.set("mouseout", "Mouse Out");
nameMap.set("mouseover", "Mouse Over");
nameMap.set("mouseup", "Mouse Up");
nameMap.set("mousewheel", "Mouse Wheel");
nameMap.set("negotiationneeded", "Negotiation Needed");
nameMap.set("nomatch", "No Match");
nameMap.set("noupdate", "No Update");
nameMap.set("orientationchange", "Orientation Change");
nameMap.set("overflowchanged", "Overflow Changed");
nameMap.set("pagehide", "Page Hide");
nameMap.set("pageshow", "Page Show");
nameMap.set("popstate", "Pop State");
nameMap.set("ratechange", "Rate Change");
nameMap.set("readystatechange", "Ready State Change");
nameMap.set("removesourcebuffer", "Remove Source Buffer");
nameMap.set("removestream", "Remove Stream");
nameMap.set("removetrack", "Remove Track");
nameMap.set("securitypolicyviolation", "Security Policy Violation");
nameMap.set("selectionchange", "Selection Change");
nameMap.set("selectstart", "Select Start");
nameMap.set("signalingstatechange", "Signaling State Change");
nameMap.set("soundend", "Sound End");
nameMap.set("soundstart", "Sound Start");
nameMap.set("sourceclose", "Source Close");
nameMap.set("sourceended", "Source Ended");
nameMap.set("sourceopen", "Source Open");
nameMap.set("speechend", "Speech End");
nameMap.set("speechstart", "Speech Start");
nameMap.set("textInput", "Text Input");
nameMap.set("timeupdate", "Time Update");
nameMap.set("tonechange", "Tone Change");
nameMap.set("touchcancel", "Touch Cancel");
nameMap.set("touchend", "Touch End");
nameMap.set("touchmove", "Touch Move");
nameMap.set("touchstart", "Touch Start");
nameMap.set("transitionend", "Transition End");
nameMap.set("updateend", "Update End");
nameMap.set("updateready", "Update Ready");
nameMap.set("updatestart", "Update Start");
nameMap.set("upgradeneeded", "Upgrade Needed");
nameMap.set("versionchange", "Version Change");
nameMap.set("visibilitychange", "Visibility Change");
nameMap.set("volumechange", "Volume Change");
nameMap.set("webglcontextcreationerror", "WebGL Context Creation Error");
nameMap.set("webglcontextlost", "WebGL Context Lost");
nameMap.set("webglcontextrestored", "WebGL Context Restored");
nameMap.set("webkitAnimationEnd", "Animation End");
nameMap.set("webkitAnimationIteration", "Animation Iteration");
nameMap.set("webkitAnimationStart", "Animation Start");
nameMap.set("webkitBeforeTextInserted", "Before Text Inserted");
nameMap.set("webkitEditableContentChanged", "Editable Content Changed");
nameMap.set("webkitTransitionEnd", "Transition End");
nameMap.set("webkitaddsourcebuffer", "Add Source Buffer");
nameMap.set("webkitbeginfullscreen", "Begin Fullscreen");
nameMap.set("webkitcurrentplaybacktargetiswirelesschanged", "Current Playback Target Is Wireless Changed");
nameMap.set("webkitdeviceproximity", "Device Proximity");
nameMap.set("webkitendfullscreen", "End Fullscreen");
nameMap.set("webkitfullscreenchange", "Fullscreen Change");
nameMap.set("webkitfullscreenerror", "Fullscreen Error");
nameMap.set("webkitkeyadded", "Key Added");
nameMap.set("webkitkeyerror", "Key Error");
nameMap.set("webkitkeymessage", "Key Message");
nameMap.set("webkitneedkey", "Need Key");
nameMap.set("webkitnetworkinfochange", "Network Info Change");
nameMap.set("webkitplaybacktargetavailabilitychanged", "Playback Target Availability Changed");
nameMap.set("webkitpointerlockchange", "Pointer Lock Change");
nameMap.set("webkitpointerlockerror", "Pointer Lock Error");
nameMap.set("webkitregionlayoutupdate", "Region Layout Update");
nameMap.set("webkitregionoversetchange", "Region Overset Change");
nameMap.set("webkitremovesourcebuffer", "Remove Source Buffer");
nameMap.set("webkitresourcetimingbufferfull", "Resource Timing Buffer Full");
nameMap.set("webkitsourceclose", "Source Close");
nameMap.set("webkitsourceended", "Source Ended");
nameMap.set("webkitsourceopen", "Source Open");
nameMap.set("webkitspeechchange", "Speech Change");
nameMap.set("writeend", "Write End");
nameMap.set("writestart", "Write Start");
WebInspector.ScriptTimelineRecord._eventDisplayNames = nameMap;
}
switch(eventType) {
case WebInspector.ScriptTimelineRecord.EventType.ScriptEvaluated:
return WebInspector.UIString("Script Evaluated");
case WebInspector.ScriptTimelineRecord.EventType.EventDispatched:
if (details && (details instanceof String || typeof details === "string")) {
var eventDisplayName = WebInspector.ScriptTimelineRecord._eventDisplayNames.get(details) || details.capitalize();
return WebInspector.UIString("%s Event Dispatched").format(eventDisplayName);
}
return WebInspector.UIString("Event Dispatched");
case WebInspector.ScriptTimelineRecord.EventType.TimerFired:
if (details && includeTimerIdentifierInMainTitle)
return WebInspector.UIString("Timer %s Fired").format(details);
return WebInspector.UIString("Timer Fired");
case WebInspector.ScriptTimelineRecord.EventType.TimerInstalled:
if (details && includeTimerIdentifierInMainTitle)
return WebInspector.UIString("Timer %s Installed").format(details);
return WebInspector.UIString("Timer Installed");
case WebInspector.ScriptTimelineRecord.EventType.TimerRemoved:
if (details && includeTimerIdentifierInMainTitle)
return WebInspector.UIString("Timer %s Removed").format(details);
return WebInspector.UIString("Timer Removed");
case WebInspector.ScriptTimelineRecord.EventType.AnimationFrameFired:
return WebInspector.UIString("Animation Frame Fired");
case WebInspector.ScriptTimelineRecord.EventType.AnimationFrameRequested:
return WebInspector.UIString("Animation Frame Requested");
case WebInspector.ScriptTimelineRecord.EventType.AnimationFrameCanceled:
return WebInspector.UIString("Animation Frame Canceled");
}
};
......
......@@ -31,7 +31,7 @@ WebInspector.ScriptTimelineView = function(recording)
this.navigationSidebarTreeOutline.element.classList.add(WebInspector.NavigationSidebarPanel.HideDisclosureButtonsStyleClassName);
this.navigationSidebarTreeOutline.element.classList.add(WebInspector.ScriptTimelineView.TreeOutlineStyleClassName);
var columns = {eventType: {}, location: {}, details: {}, startTime: {}, duration: {}};
var columns = {eventType: {}, location: {}, startTime: {}, duration: {}};
columns.eventType.title = WebInspector.UIString("Type");
columns.eventType.width = "15%";
......@@ -41,9 +41,6 @@ WebInspector.ScriptTimelineView = function(recording)
columns.location.title = WebInspector.UIString("Location");
columns.location.width = "15%";
columns.details.title = WebInspector.UIString("Details");
columns.details.width = "15%";
columns.startTime.title = WebInspector.UIString("Start Time");
columns.startTime.width = "10%";
columns.startTime.aligned = "right";
......@@ -125,7 +122,7 @@ WebInspector.ScriptTimelineView.prototype = {
return;
for (var scriptTimelineRecord of this._pendingRecords) {
var treeElement = new WebInspector.TimelineRecordTreeElement(scriptTimelineRecord, true);
var treeElement = new WebInspector.TimelineRecordTreeElement(scriptTimelineRecord, true, true);
var dataGridNode = new WebInspector.ScriptTimelineDataGridNode(scriptTimelineRecord, this.zeroTime);
this._dataGrid.addRowInSortOrder(treeElement, dataGridNode);
......
......@@ -23,13 +23,13 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
WebInspector.SourceCodeTimelineTreeElement = function(sourceCodeTimeline, showFullLocationSubtitle)
WebInspector.SourceCodeTimelineTreeElement = function(sourceCodeTimeline, showFullLocationSubtitle, includeTimerIdentifierInMainTitle)
{
console.assert(sourceCodeTimeline);
this._sourceCodeTimeline = sourceCodeTimeline;
WebInspector.TimelineRecordTreeElement.call(this, sourceCodeTimeline.records[0], showFullLocationSubtitle, sourceCodeTimeline.sourceCodeLocation, sourceCodeTimeline);
WebInspector.TimelineRecordTreeElement.call(this, sourceCodeTimeline.records[0], showFullLocationSubtitle, includeTimerIdentifierInMainTitle, sourceCodeTimeline.sourceCodeLocation, sourceCodeTimeline);
};
WebInspector.SourceCodeTimelineTreeElement.prototype = {
......
......@@ -274,6 +274,20 @@ WebInspector.TimelineManager.prototype = {
// Pass the startTime as the endTime since this record type has no duration.
this._addRecord(new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.TimerRemoved, startTime, startTime, callFrames, sourceCodeLocation, recordPayload.data.timerId));
break;
case TimelineAgent.EventType.RequestAnimationFrame:
console.assert(isNaN(endTime));
// Pass the startTime as the endTime since this record type has no duration.
this._addRecord(new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.AnimationFrameRequested, startTime, startTime, callFrames, sourceCodeLocation, recordPayload.data.timerId));
break;
case TimelineAgent.EventType.CancelAnimationFrame:
console.assert(isNaN(endTime));
// Pass the startTime as the endTime since this record type has no duration.
this._addRecord(new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.AnimationFrameCanceled, startTime, startTime, callFrames, sourceCodeLocation, recordPayload.data.timerId));
break;
}
}
......
......@@ -23,12 +23,12 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
WebInspector.TimelineRecordTreeElement = function(timelineRecord, showFullLocationSubtitle, sourceCodeLocation, representedObject)
WebInspector.TimelineRecordTreeElement = function(timelineRecord, showFullLocationSubtitle, includeTimerIdentifierInMainTitle, sourceCodeLocation, representedObject)
{
console.assert(timelineRecord);
this._record = timelineRecord;
this._sourceCodeLocation = sourceCodeLocation || timelineRecord.sourceCodeLocation;
this._sourceCodeLocation = sourceCodeLocation || timelineRecord.sourceCodeLocation || null;
var title = "";
var subtitle = "";
......@@ -49,25 +49,18 @@ WebInspector.TimelineRecordTreeElement = function(timelineRecord, showFullLocati
switch (timelineRecord.type) {
case WebInspector.TimelineRecord.Type.Layout:
title = WebInspector.LayoutTimelineRecord.EventType.displayName(timelineRecord.eventType);
switch (timelineRecord.eventType) {
case WebInspector.LayoutTimelineRecord.EventType.InvalidateStyles:
title = WebInspector.UIString("Styles Invalidated");
iconStyleClass = WebInspector.TimelineRecordTreeElement.StyleRecordIconStyleClass;
break;
case WebInspector.LayoutTimelineRecord.EventType.RecalculateStyles:
title = WebInspector.UIString("Styles Recalculated");
iconStyleClass = WebInspector.TimelineRecordTreeElement.StyleRecordIconStyleClass;
break;
case WebInspector.LayoutTimelineRecord.EventType.InvalidateLayout:
title = WebInspector.UIString("Layout Invalidated");
iconStyleClass = WebInspector.TimelineRecordTreeElement.LayoutRecordIconStyleClass;
break;
case WebInspector.LayoutTimelineRecord.EventType.Layout:
title = WebInspector.UIString("Layout");
iconStyleClass = WebInspector.TimelineRecordTreeElement.LayoutRecordIconStyleClass;
break;
case WebInspector.LayoutTimelineRecord.EventType.Paint:
title = WebInspector.UIString("Paint");
iconStyleClass = WebInspector.TimelineRecordTreeElement.PaintRecordIconStyleClass;
break;
default:
......@@ -77,31 +70,23 @@ WebInspector.TimelineRecordTreeElement = function(timelineRecord, showFullLocati
break;
case WebInspector.TimelineRecord.Type.Script:
title = WebInspector.ScriptTimelineRecord.EventType.displayName(timelineRecord.eventType, timelineRecord.details, includeTimerIdentifierInMainTitle);
switch (timelineRecord.eventType) {
case WebInspector.ScriptTimelineRecord.EventType.ScriptEvaluated:
title = WebInspector.UIString("Script Evaluated");
iconStyleClass = WebInspector.TimelineRecordTreeElement.EvaluatedRecordIconStyleClass;
break;
case WebInspector.ScriptTimelineRecord.EventType.EventDispatched:
title = WebInspector.UIString("Event Dispatched");
if (timelineRecord.details)
subtitle += " \u2014 " + timelineRecord.details;
iconStyleClass = WebInspector.TimelineRecordTreeElement.EventRecordIconStyleClass;
break;
case WebInspector.ScriptTimelineRecord.EventType.TimerFired:
title = WebInspector.UIString("Timer Fired");
iconStyleClass = WebInspector.TimelineRecordTreeElement.TimerRecordIconStyleClass;
break;
case WebInspector.ScriptTimelineRecord.EventType.TimerInstalled:
title = WebInspector.UIString("Timer Installed");
iconStyleClass = WebInspector.TimelineRecordTreeElement.TimerRecordIconStyleClass;
break;
case WebInspector.ScriptTimelineRecord.EventType.TimerRemoved:
title = WebInspector.UIString("Timer Removed");
iconStyleClass = WebInspector.TimelineRecordTreeElement.TimerRecordIconStyleClass;
break;
case WebInspector.ScriptTimelineRecord.EventType.AnimationFrameFired:
title = WebInspector.UIString("Animation Frame Fired");
case WebInspector.ScriptTimelineRecord.EventType.AnimationFrameRequested:
case WebInspector.ScriptTimelineRecord.EventType.AnimationFrameCanceled:
iconStyleClass = WebInspector.TimelineRecordTreeElement.AnimationRecordIconStyleClass;
break;
default:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment