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

Unified Diff: third_party/WebKit/Source/devtools/front_end/extensions/ExtensionTraceProvider.js

Issue 2073343002: Timeline addTraceProvider API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: timelineFlameChart.js 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/extensions/ExtensionTraceProvider.js
diff --git a/third_party/WebKit/Source/devtools/front_end/extensions/ExtensionTraceProvider.js b/third_party/WebKit/Source/devtools/front_end/extensions/ExtensionTraceProvider.js
new file mode 100644
index 0000000000000000000000000000000000000000..3974c2c0a0c5e26793faa1a96b22a935d186cf02
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/front_end/extensions/ExtensionTraceProvider.js
@@ -0,0 +1,102 @@
+/**
+ * @constructor
+ * @param {string} extensionOrigin
+ * @param {string} id
+ * @param {string} categoryName
+ * @param {string} categoryTooltip
+ */
+WebInspector.ExtensionTraceProvider = function(extensionOrigin, id, categoryName, categoryTooltip)
+{
+ this._extensionOrigin = extensionOrigin;
+ this._id = id;
+ this._categoryName = categoryName;
+ this._categoryTooltip = categoryTooltip;
+ this._storage = new WebInspector.TempFileBackingStorage("extension-" + this._categoryName);
+ this._tracingModel = new WebInspector.TracingModel(this._storage);
+ this._traceData = null;
+}
+
+WebInspector.ExtensionTraceProvider.prototype = {
+ get id()
+ {
+ return this._id;
+ },
+
+ get categoryName()
+ {
+ return this._categoryName;
+ },
+
+ get categoryTooltip()
+ {
+ return this._categoryTooltip;
+ },
+
+ get tracingModel()
+ {
+ return this._tracingModel;
+ },
+
+ get traceData()
+ {
+ return this._traceData;
+ },
+
+ run: function()
+ {
+ WebInspector.extensionServer.startTraceRecording(this.id);
+ },
+
+ /**
+ * @param {!Array.<!WebInspector.NetworkRequest>} requests
+ */
+ stop: function(requests)
+ {
+ this._traceData = new WebInspector.ExtensionTraceData(this);
+ WebInspector.extensionServer.stopTraceRecording(this.id, this._traceData);
+ }
+}
+
+/**
+ * @constructor
+ * @param {!WebInspector.ExtensionTraceProvider} traceProvider
+ */
+WebInspector.ExtensionTraceData = function(traceProvider)
+{
+ this._traceProvider = traceProvider;
+ this._id = traceProvider.id + "-" + ++WebInspector.ExtensionTraceData._lastId;
+ this._threadName = null;
+ this._events = null;
+}
+
+WebInspector.ExtensionTraceData.prototype = {
+ /**
+ * @return {string}
+ */
+ id: function()
+ {
+ return this._id;
+ },
+
+ /**
+ * @param {string} threadName
+ * @param {!Object} events
+ */
+ addTraceData: function(threadName, events)
+ {
+ this._threadName = threadName;
+ this._events = events;
+ },
+
+ get threadName()
+ {
+ return this._threadName;
+ },
+
+ get events()
+ {
+ return this._events;
+ }
+}
+
+WebInspector.ExtensionTraceData._lastId = 0;

Powered by Google App Engine
This is Rietveld 408576698