Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2212)

Unified Diff: Source/devtools/front_end/timeline/TracingTimelineUIUtils.js

Issue 631573002: [Devtools] Replace "Stacks" with "Causes" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Minor cleanup Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/devtools/front_end/timeline/TracingTimelineUIUtils.js
diff --git a/Source/devtools/front_end/timeline/TracingTimelineUIUtils.js b/Source/devtools/front_end/timeline/TracingTimelineUIUtils.js
index 81d521e5430678fe05bb1b6fec145b40c4360891..79f92ae6dc1946f354d60734bafe4e4240670819 100644
--- a/Source/devtools/front_end/timeline/TracingTimelineUIUtils.js
+++ b/Source/devtools/front_end/timeline/TracingTimelineUIUtils.js
@@ -538,9 +538,7 @@ WebInspector.TracingTimelineUIUtils._buildTraceEventDetailsSynchronously = funct
var recordTypes = WebInspector.TracingTimelineModel.RecordType;
- // The messages may vary per event.name;
- var callSiteStackTraceLabel;
- var callStackLabel;
+ // This message may vary per event.name;
var relatedNodeLabel;
var contentHelper = new WebInspector.TimelineDetailsContentHelper(event.thread.target(), linkifier, true);
@@ -555,9 +553,6 @@ WebInspector.TracingTimelineUIUtils._buildTraceEventDetailsSynchronously = funct
contentHelper.appendTextRow(WebInspector.UIString("Collected"), Number.bytesToString(delta));
break;
case recordTypes.TimerFire:
- callSiteStackTraceLabel = WebInspector.UIString("Timer installed");
- // Fall-through intended.
-
case recordTypes.TimerInstall:
case recordTypes.TimerRemove:
contentHelper.appendTextRow(WebInspector.UIString("Timer ID"), eventData["timerId"]);
@@ -567,7 +562,6 @@ WebInspector.TracingTimelineUIUtils._buildTraceEventDetailsSynchronously = funct
}
break;
case recordTypes.FireAnimationFrame:
- callSiteStackTraceLabel = WebInspector.UIString("Animation frame requested");
contentHelper.appendTextRow(WebInspector.UIString("Callback ID"), eventData["id"]);
break;
case recordTypes.FunctionCall:
@@ -619,7 +613,6 @@ WebInspector.TracingTimelineUIUtils._buildTraceEventDetailsSynchronously = funct
break;
case recordTypes.RecalculateStyles: // We don't want to see default details.
contentHelper.appendTextRow(WebInspector.UIString("Elements affected"), event.args["elementCount"]);
- callStackLabel = WebInspector.UIString("Styles recalculation forced");
break;
case recordTypes.Layout:
var beginData = event.args["beginData"];
@@ -627,8 +620,6 @@ WebInspector.TracingTimelineUIUtils._buildTraceEventDetailsSynchronously = funct
contentHelper.appendTextRow(WebInspector.UIString("Layout tree size"), beginData["totalObjects"]);
contentHelper.appendTextRow(WebInspector.UIString("Layout scope"),
beginData["partialLayout"] ? WebInspector.UIString("Partial") : WebInspector.UIString("Whole document"));
- callSiteStackTraceLabel = WebInspector.UIString("Layout invalidated");
- callStackLabel = WebInspector.UIString("Layout forced");
relatedNodeLabel = WebInspector.UIString("Layout root");
break;
case recordTypes.ConsoleTime:
@@ -662,15 +653,6 @@ WebInspector.TracingTimelineUIUtils._buildTraceEventDetailsSynchronously = funct
if (eventData && eventData["scriptName"] && event.name !== recordTypes.FunctionCall)
contentHelper.appendLocationRow(WebInspector.UIString("Function Call"), eventData["scriptName"], eventData["scriptLine"]);
- if (initiator) {
- var callSiteStackTrace = initiator.stackTrace;
- if (callSiteStackTrace)
- contentHelper.appendStackTrace(callSiteStackTraceLabel || WebInspector.UIString("Call Site stack"), callSiteStackTrace);
- }
- var eventStackTrace = event.stackTrace;
- if (eventStackTrace)
- contentHelper.appendStackTrace(callStackLabel || WebInspector.UIString("Call Stack"), eventStackTrace);
-
var warning = event.warning;
if (warning) {
var div = document.createElement("div");
@@ -684,6 +666,49 @@ WebInspector.TracingTimelineUIUtils._buildTraceEventDetailsSynchronously = funct
}
/**
+ * @param {!WebInspector.TracingModel.Event} event
+ * @param {!WebInspector.Linkifier} linkifier
+ * @return {!Node}
+ */
+WebInspector.TracingTimelineUIUtils.generateCausesContent = function(event, linkifier, callback)
+{
+ var recordTypes = WebInspector.TracingTimelineModel.RecordType;
+ var contentHelper = new WebInspector.TimelineDetailsContentHelper(event.thread.target(), linkifier, true);
+
+ var callSiteStackLabel;
+ var stackLabel;
+
+ switch (event.name) {
+ case recordTypes.TimerFire:
+ callSiteStackLabel = WebInspector.UIString("Timer installed");
+ break;
+ case recordTypes.FireAnimationFrame:
+ callSiteStackLabel = WebInspector.UIString("Animation frame requested");
+ break;
+ case recordTypes.RecalculateStyles:
+ stackLabel = WebInspector.UIString("Stack when style recalculation was forced");
+ break;
+ case recordTypes.Layout:
+ callSiteStackLabel = WebInspector.UIString("First layout invalidation");
+ stackLabel = WebInspector.UIString("Stack when layout was forced");
+ break;
+ default:
+ break;
+ }
+
+ // Direct cause.
+ if (event.stackTrace)
+ contentHelper.appendStackTrace(stackLabel || WebInspector.UIString("Stack when this event occurred"), event.stackTrace);
+
+ // Indirect cause / invalidation.
+ var initiator = event.initiator;
+ if (initiator && initiator.stackTrace)
+ contentHelper.appendStackTrace(callSiteStackLabel || WebInspector.UIString("Stack when first invalidated"), initiator.stackTrace);
+
+ callback(contentHelper.element);
caseq 2014/10/06 12:47:48 We always invoke callback synchronously -- let's j
pdr. 2014/10/07 04:36:13 Good catch. Done.
+}
+
+/**
* @param {!Object} total
* @param {!WebInspector.TracingTimelineModel} model
* @param {!WebInspector.TracingModel.Event} event

Powered by Google App Engine
This is Rietveld 408576698