OLD | NEW |
(Empty) | |
| 1 /** |
| 2 * @constructor |
| 3 * @param {string} extensionOrigin |
| 4 * @param {string} id |
| 5 * @param {string} categoryName |
| 6 * @param {string} categoryTooltip |
| 7 */ |
| 8 WebInspector.ExtensionTraceProvider = function(extensionOrigin, id, categoryName
, categoryTooltip) |
| 9 { |
| 10 this._extensionOrigin = extensionOrigin; |
| 11 this._id = id; |
| 12 this._categoryName = categoryName; |
| 13 this._categoryTooltip = categoryTooltip; |
| 14 this._storage = new WebInspector.TempFileBackingStorage("extension-" + this.
_categoryName); |
| 15 this._tracingModel = new WebInspector.TracingModel(this._storage); |
| 16 this._traceData = null; |
| 17 } |
| 18 |
| 19 WebInspector.ExtensionTraceProvider.prototype = { |
| 20 get id() |
| 21 { |
| 22 return this._id; |
| 23 }, |
| 24 |
| 25 get categoryName() |
| 26 { |
| 27 return this._categoryName; |
| 28 }, |
| 29 |
| 30 get categoryTooltip() |
| 31 { |
| 32 return this._categoryTooltip; |
| 33 }, |
| 34 |
| 35 get tracingModel() |
| 36 { |
| 37 return this._tracingModel; |
| 38 }, |
| 39 |
| 40 get traceData() |
| 41 { |
| 42 return this._traceData; |
| 43 }, |
| 44 |
| 45 run: function() |
| 46 { |
| 47 WebInspector.extensionServer.startTraceRecording(this.id); |
| 48 }, |
| 49 |
| 50 /** |
| 51 * @param {!Array.<!WebInspector.NetworkRequest>} requests |
| 52 */ |
| 53 stop: function(requests) |
| 54 { |
| 55 this._traceData = new WebInspector.ExtensionTraceData(this); |
| 56 WebInspector.extensionServer.stopTraceRecording(this.id, this._traceData
); |
| 57 } |
| 58 } |
| 59 |
| 60 /** |
| 61 * @constructor |
| 62 * @param {!WebInspector.ExtensionTraceProvider} traceProvider |
| 63 */ |
| 64 WebInspector.ExtensionTraceData = function(traceProvider) |
| 65 { |
| 66 this._traceProvider = traceProvider; |
| 67 this._id = traceProvider.id + "-" + ++WebInspector.ExtensionTraceData._lastI
d; |
| 68 this._threadName = null; |
| 69 this._events = null; |
| 70 } |
| 71 |
| 72 WebInspector.ExtensionTraceData.prototype = { |
| 73 /** |
| 74 * @return {string} |
| 75 */ |
| 76 id: function() |
| 77 { |
| 78 return this._id; |
| 79 }, |
| 80 |
| 81 /** |
| 82 * @param {string} threadName |
| 83 * @param {!Object} events |
| 84 */ |
| 85 addTraceData: function(threadName, events) |
| 86 { |
| 87 this._threadName = threadName; |
| 88 this._events = events; |
| 89 }, |
| 90 |
| 91 get threadName() |
| 92 { |
| 93 return this._threadName; |
| 94 }, |
| 95 |
| 96 get events() |
| 97 { |
| 98 return this._events; |
| 99 } |
| 100 } |
| 101 |
| 102 WebInspector.ExtensionTraceData._lastId = 0; |
OLD | NEW |