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

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

Issue 2073343002: Timeline addTraceProvider API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: checkbox prototype Created 4 years, 6 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: third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js
index 63a911ee61f34234a7b5a5bea3198437b5bf6f0e..ad53fdb05c20fdb4f93dac216a8613c33191321c 100644
--- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js
+++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js
@@ -67,6 +67,16 @@ WebInspector.TimelinePanel = function()
if (Runtime.experiments.isEnabled("cpuThrottling"))
this._cpuThrottlingManager = new WebInspector.CPUThrottlingManager();
+ // Create extension trace providers.
+ this._traceProvidersById = {};
caseq 2016/06/21 07:29:51 We prefer using maps in the new code, i.e. /**
+ this._captureExtensionSettings = {};
caseq 2016/06/21 07:29:51 ditto.
+ var extensionTraceProviders = WebInspector.extensionServer.traceProviders();
+ for (var i = 0; i < extensionTraceProviders.length; ++i) {
+ var provider = extensionTraceProviders[i];
caseq 2016/06/21 07:29:51 nit: for (var provider of extensionTraceProviders)
+ this.addTraceProvider(provider);
+ this._captureExtensionSettings[provider.id] = WebInspector.settings.createSetting(provider.categoryName, false);
+ }
+
/** @type {!Array.<!WebInspector.TimelineModeView>} */
this._currentViews = [];
@@ -162,6 +172,28 @@ WebInspector.TimelinePanel.headerHeight = 20;
WebInspector.TimelinePanel.prototype = {
/**
+ * @return {!Object.<string, !WebInspector.ExtensionTraceProvider>}
+ */
+ get traceProvidersById()
caseq 2016/06/21 07:29:51 do you need to expose this? Also, we avoid getters
+ {
+ return this._traceProvidersById;
+ },
+
+ addTraceProvider: function(provider)
+ {
+ this._traceProvidersById[provider.id] = provider;
+ },
+
+ /**
+ * @param {string} id
+ * @return {!WebInspector.ExtensionTraceProvider}
+ */
+ getTraceProvider: function(id)
caseq 2016/06/21 07:29:51 not sure you need to expose any of these (also: pl
+ {
+ return this.traceProvidersById[id];
+ },
+
+ /**
* @override
* @return {?WebInspector.SearchableView}
*/
@@ -390,6 +422,11 @@ WebInspector.TimelinePanel.prototype = {
WebInspector.UIString("Memory"), this._captureMemorySetting, WebInspector.UIString("Capture memory information on every timeline event.")));
this._panelToolbar.appendToolbarItem(this._createSettingCheckbox(
WebInspector.UIString("Paint"), this._captureLayersAndPicturesSetting, WebInspector.UIString("Capture graphics layer positions and rasterization draw calls. (Has large performance overhead)")));
+ for (var s in this._captureExtensionSettings) {
caseq 2016/06/21 07:29:51 I guess you also want to handle TraceProviderAdded
+ this._panelToolbar.appendToolbarItem(this._createSettingCheckbox(
+ WebInspector.UIString(this._traceProvidersById[s].categoryName), this._captureExtensionSettings[s], WebInspector.UIString(this._traceProvidersById[s].categoryTooltip)));
+ }
+
} else {
this._panelToolbar.appendToolbarItem(screenshotCheckbox);
}

Powered by Google App Engine
This is Rietveld 408576698