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

Unified Diff: Source/devtools/front_end/timeline/TracingModel.js

Issue 563463003: DevTools: extract TracingManager from TracingModel, step 2 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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: Source/devtools/front_end/timeline/TracingModel.js
diff --git a/Source/devtools/front_end/sdk/TracingModel.js b/Source/devtools/front_end/timeline/TracingModel.js
similarity index 83%
rename from Source/devtools/front_end/sdk/TracingModel.js
rename to Source/devtools/front_end/timeline/TracingModel.js
index a41df029a8ac517ed2f784b3bd6c33559cb6f898..693e631fd91333ecfcd7a3231448b76f212760cc 100644
--- a/Source/devtools/front_end/sdk/TracingModel.js
+++ b/Source/devtools/front_end/timeline/TracingModel.js
@@ -6,132 +6,6 @@
/**
* @constructor
- * @extends {WebInspector.Object}
- * @implements {WebInspector.TargetManager.Observer}
- */
-WebInspector.TracingManager = function()
-{
- WebInspector.Object.call(this);
- this._active = false;
- WebInspector.targetManager.observeTargets(this);
-}
-
-WebInspector.TracingManager.Events = {
- "BufferUsage": "BufferUsage",
- "TracingStarted": "TracingStarted",
- "EventsCollected": "EventsCollected",
- "TracingStopped": "TracingStopped",
- "TracingComplete": "TracingComplete"
-}
-
-/** @typedef {!{
- cat: string,
- pid: number,
- tid: number,
- ts: number,
- ph: string,
- name: string,
- args: !Object,
- dur: number,
- id: number,
- s: string
- }}
- */
-WebInspector.TracingManager.EventPayload;
-
-
-WebInspector.TracingManager.prototype = {
- /**
- * @param {!WebInspector.Target} target
- */
- targetAdded: function(target)
- {
- if (this._target)
- return;
- this._target = target;
- InspectorBackend.registerTracingDispatcher(new WebInspector.TracingDispatcher(this));
- },
-
- /**
- * @param {!WebInspector.Target} target
- */
- targetRemoved: function(target)
- {
- if (this._target !== target)
- return;
- delete this._target;
- },
-
- /**
- * @param {number} usage
- */
- _bufferUsage: function(usage)
- {
- this.dispatchEventToListeners(WebInspector.TracingManager.Events.BufferUsage, usage);
- },
-
- /**
- * @param {!Array.<!WebInspector.TracingManager.EventPayload>} events
- */
- _eventsCollected: function(events)
- {
- this.dispatchEventToListeners(WebInspector.TracingManager.Events.EventsCollected, events);
- },
-
- _tracingComplete: function()
- {
- this.dispatchEventToListeners(WebInspector.TracingManager.Events.TracingComplete);
- },
-
- _tracingStarted: function()
- {
- if (this._active)
- return;
- this._active = true;
- this.dispatchEventToListeners(WebInspector.TracingManager.Events.TracingStarted);
- },
-
- /**
- * @param {string} categoryFilter
- * @param {string} options
- * @param {function(?string)=} callback
- */
- start: function(categoryFilter, options, callback)
- {
- if (this._active)
- return;
- WebInspector.profilingLock().acquire();
- this._shouldReleaseLock = true;
- var bufferUsageReportingIntervalMs = 500;
- TracingAgent.start(categoryFilter, options, bufferUsageReportingIntervalMs, callback);
- this._tracingStarted();
- this._active = true;
- },
-
- stop: function()
- {
- if (!this._active)
- return;
- TracingAgent.end(this._onStop.bind(this));
- if (this._shouldReleaseLock) {
- this._shouldReleaseLock = false;
- WebInspector.profilingLock().release();
- }
- },
-
- _onStop: function()
- {
- if (!this._active)
- return;
- this.dispatchEventToListeners(WebInspector.TracingManager.Events.TracingStopped);
- this._active = false;
- },
-
- __proto__: WebInspector.Object.prototype
-}
-
-/**
- * @constructor
*/
WebInspector.TracingModel = function()
{
@@ -795,42 +669,3 @@ WebInspector.TracingModel.Thread.prototype = {
__proto__: WebInspector.TracingModel.NamedObject.prototype
}
-
-
-/**
- * @constructor
- * @implements {TracingAgent.Dispatcher}
- * @param {!WebInspector.TracingManager} tracingManager
- */
-WebInspector.TracingDispatcher = function(tracingManager)
-{
- this._tracingManager = tracingManager;
-}
-
-WebInspector.TracingDispatcher.prototype = {
- /**
- * @param {number} usage
- */
- bufferUsage: function(usage)
- {
- this._tracingManager._bufferUsage(usage);
- },
-
- /**
- * @param {!Array.<!WebInspector.TracingManager.EventPayload>} data
- */
- dataCollected: function(data)
- {
- this._tracingManager._eventsCollected(data);
- },
-
- tracingComplete: function()
- {
- this._tracingManager._tracingComplete();
- },
-
- started: function()
- {
- this._tracingManager._tracingStarted();
- }
-}

Powered by Google App Engine
This is Rietveld 408576698