Index: Source/devtools/front_end/TimelineManager.js |
diff --git a/Source/devtools/front_end/TimelineManager.js b/Source/devtools/front_end/TimelineManager.js |
index 914230ef509dc95c7f996cf482611821c9c26a85..7ac53262a541439ec69461b972cf379fb5374b1c 100644 |
--- a/Source/devtools/front_end/TimelineManager.js |
+++ b/Source/devtools/front_end/TimelineManager.js |
@@ -50,15 +50,21 @@ WebInspector.TimelineManager.prototype = { |
* @param {number=} maxCallStackDepth |
* @param {boolean=} includeDomCounters |
* @param {boolean=} includeNativeMemoryStatistics |
+ * @param {function(?Protocol.Error)=} callback |
*/ |
- start: function(maxCallStackDepth, includeDomCounters, includeNativeMemoryStatistics) |
+ start: function(maxCallStackDepth, includeDomCounters, includeNativeMemoryStatistics, callback) |
{ |
this._enablementCount++; |
if (this._enablementCount === 1) |
- TimelineAgent.start(maxCallStackDepth, includeDomCounters, includeNativeMemoryStatistics, this._started.bind(this)); |
+ TimelineAgent.start(maxCallStackDepth, includeDomCounters, includeNativeMemoryStatistics, callback); |
+ else if (callback) |
+ callback(null); |
}, |
- stop: function() |
+ /** |
+ * @param {function(?Protocol.Error)=} callback |
+ */ |
+ stop: function(callback) |
{ |
if (!this._enablementCount) { |
console.error("WebInspector.TimelineManager start/stop calls are unbalanced"); |
@@ -66,17 +72,9 @@ WebInspector.TimelineManager.prototype = { |
} |
this._enablementCount--; |
if (!this._enablementCount) |
- TimelineAgent.stop(this._stopped.bind(this)); |
- }, |
- |
- _started: function() |
- { |
- this.dispatchEventToListeners(WebInspector.TimelineManager.EventTypes.TimelineStarted); |
- }, |
- |
- _stopped: function() |
- { |
- this.dispatchEventToListeners(WebInspector.TimelineManager.EventTypes.TimelineStopped); |
+ TimelineAgent.stop(callback); |
+ else if (callback) |
+ callback(null); |
}, |
__proto__: WebInspector.Object.prototype |
@@ -93,9 +91,32 @@ WebInspector.TimelineDispatcher = function(manager) |
} |
WebInspector.TimelineDispatcher.prototype = { |
+ /** |
+ * @param {TimelineAgent.TimelineEvent} record |
+ */ |
eventRecorded: function(record) |
{ |
this._manager.dispatchEventToListeners(WebInspector.TimelineManager.EventTypes.TimelineEventRecorded, record); |
+ }, |
+ |
+ /** |
+ * @param {boolean=} consoleTimeline |
+ */ |
+ started: function(consoleTimeline) |
+ { |
+ if (consoleTimeline) |
+ this._manager._enablementCount++; |
caseq
2013/09/06 09:25:46
So what happens if pages does console.timeline() a
pfeldman
2013/09/06 16:10:30
Good catch. InspectorTimelineAgent::restore is now
|
+ this._manager.dispatchEventToListeners(WebInspector.TimelineManager.EventTypes.TimelineStarted, consoleTimeline); |
+ }, |
+ |
+ /** |
+ * @param {boolean=} consoleTimeline |
+ */ |
+ stopped: function(consoleTimeline) |
+ { |
+ if (consoleTimeline) |
+ this._manager._enablementCount--; |
+ this._manager.dispatchEventToListeners(WebInspector.TimelineManager.EventTypes.TimelineStopped, consoleTimeline); |
} |
} |