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; |