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

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

Issue 631573002: [Devtools] Replace "Stacks" with "Causes" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address reviewer comments 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/TimelinePanel.js
diff --git a/Source/devtools/front_end/timeline/TimelinePanel.js b/Source/devtools/front_end/timeline/TimelinePanel.js
index 3123606d92cfc4857d6b5e4f98fb39212ac44ef6..b5f3e745a3f37390d99058774c9f771e0e105eab 100644
--- a/Source/devtools/front_end/timeline/TimelinePanel.js
+++ b/Source/devtools/front_end/timeline/TimelinePanel.js
@@ -270,6 +270,13 @@ WebInspector.TimelinePanel.prototype = {
return this._lazyPaintProfilerView;
},
+ _causesView: function()
+ {
+ if (!this._lazyCausesView)
+ this._lazyCausesView = new WebInspector.TimelineCausesView();
+ return this._lazyCausesView;
+ },
+
/**
* @param {!WebInspector.TimelineModeView} modeView
*/
@@ -347,11 +354,11 @@ WebInspector.TimelinePanel.prototype = {
panelStatusBarElement.appendChild(flameChartToggleButton.element);
}
- this._captureStacksSetting = WebInspector.settings.createSetting("timelineCaptureStacks", true);
- this._captureStacksSetting.addChangeListener(this._refreshViews, this);
- panelStatusBarElement.appendChild(this._createSettingCheckbox(WebInspector.UIString("Stacks"),
- this._captureStacksSetting,
- WebInspector.UIString("Capture JavaScript stack on every timeline event")));
+ this._captureCausesSetting = WebInspector.settings.createSetting("timelineCaptureCauses", true);
+ this._captureCausesSetting.addChangeListener(this._refreshViews, this);
+ panelStatusBarElement.appendChild(this._createSettingCheckbox(WebInspector.UIString("Causes"),
+ this._captureCausesSetting,
+ WebInspector.UIString("Capture causes for timeline events (e.g., stack traces)")));
this._captureMemorySetting = WebInspector.settings.createSetting("timelineCaptureMemory", false);
panelStatusBarElement.appendChild(this._createSettingCheckbox(WebInspector.UIString("Memory"),
this._captureMemorySetting,
@@ -639,7 +646,7 @@ WebInspector.TimelinePanel.prototype = {
_startRecording: function(userInitiated)
{
this._userInitiatedRecording = userInitiated;
- this._model.startRecording(this._captureStacksSetting.get(), this._captureMemorySetting.get(), this._captureLayersAndPicturesSetting && this._captureLayersAndPicturesSetting.get());
+ this._model.startRecording(this._captureCausesSetting.get(), this._captureMemorySetting.get(), this._captureLayersAndPicturesSetting && this._captureLayersAndPicturesSetting.get());
if (this._lazyFrameModel)
this._lazyFrameModel.setMergeRecords(false);
@@ -996,16 +1003,22 @@ WebInspector.TimelinePanel.prototype = {
{
var title = WebInspector.TracingTimelineUIUtils.eventStyle(event).title;
this.showInDetails(title, content);
- if (!event.picture)
- return;
- var paintProfilerView = this._paintProfilerView();
- this._detailsView.appendTab("paintProfiler", WebInspector.UIString("Paint Profiler"), paintProfilerView);
- event.picture.requestObject(onGotObject);
- function onGotObject(result)
- {
- if (!result || !result["skp64"])
- return;
- paintProfilerView.setPicture(event.thread.target(), result["skp64"]);
+ if (event.picture) {
+ var paintProfilerView = this._paintProfilerView();
+ this._detailsView.appendTab("paintProfiler", WebInspector.UIString("Paint Profiler"), paintProfilerView);
+ event.picture.requestObject(onGotObject);
+ function onGotObject(result)
+ {
+ if (!result || !result["skp64"])
+ return;
+ paintProfilerView.setPicture(event.thread.target(), result["skp64"]);
+ }
+ }
+ if (this._hasCauses(event)) {
+ var causesView = this._causesView();
+ causesView.setContent(
+ WebInspector.TracingTimelineUIUtils.generateCauses(event, this._detailsLinkifier));
+ this._detailsView.appendTab("causes", WebInspector.UIString("Causes"), causesView);
}
},
@@ -1113,6 +1126,22 @@ WebInspector.TimelinePanel.prototype = {
this._detailsView.setContent(title, node);
},
+ /**
+ * @param {!WebInspector.TracingModel.Event} event
+ * @return {boolean}
+ */
+ _hasCauses: function(event)
+ {
+ // Do not show cause data unless the setting is enabled. This gives us a
+ // single checkbox and a consistent UI, at the cost of not showing
+ // initiator data that might be available when the setting is disabled.
+ if (!event || !this._captureCausesSetting.get())
caseq 2014/10/07 09:50:07 nit: drop !event check
+ return false;
+
+ var initiatorHasStack = event.initiator && event.initiator.stackTrace;
+ return initiatorHasStack || event.stackTrace;
+ },
+
__proto__: WebInspector.Panel.prototype
}
@@ -1463,3 +1492,31 @@ WebInspector.TimelinePanelFactory.prototype = {
return WebInspector.TimelinePanel._instance();
}
}
+
+/**
+ * Display information about an event's direct and indirect causes.
+ *
+ * @interface
caseq 2014/10/07 09:50:08 s/@interface/@constructor/
+ * @extends {WebInspector.VBox}
+ */
+WebInspector.TimelineCausesView = function()
+{
+ WebInspector.VBox.call(this);
+ this.element.classList.add("timeline-causes-view");
caseq 2014/10/07 09:50:07 unused?
+}
+
+WebInspector.TimelineCausesView.prototype = {
+ setContent: function(content)
caseq 2014/10/07 09:50:08 Please annotate @type for content.
+ {
+ this.element.removeChildren();
+ if (!content || !content.children || !content.children.length) {
+ console.error("No content generator set on TimelineCausesView.");
+ content = this.element.createChild("div", "");
+ content.textContent =
+ WebInspector.UIString("No causes reported for this event.");
+ }
+ this.element.appendChild(content);
caseq 2014/10/07 09:50:08 This will throw if (!content), so perhaps put unde
+ },
+
+ __proto__: WebInspector.VBox.prototype
+};

Powered by Google App Engine
This is Rietveld 408576698