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

Unified Diff: third_party/WebKit/Source/devtools/front_end/network/NetworkPanel.js

Issue 2722993002: [DevTools] Turn TracingManager into SDKModel. (Closed)
Patch Set: review comment Created 3 years, 10 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/network/NetworkPanel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/network/NetworkPanel.js b/third_party/WebKit/Source/devtools/front_end/network/NetworkPanel.js
index fe8d988bca36cb644fe02afa29327f48a5bfc17e..5244640ffbde1647d2099fa9ff5b59c37562c2dd 100644
--- a/third_party/WebKit/Source/devtools/front_end/network/NetworkPanel.js
+++ b/third_party/WebKit/Source/devtools/front_end/network/NetworkPanel.js
@@ -671,8 +671,10 @@ Network.NetworkPanel.FilmStripRecorder = class {
* @param {!PerfUI.FilmStripView} filmStripView
*/
constructor(timeCalculator, filmStripView) {
- /** @type {?SDK.Target} */
- this._target = null;
+ /** @type {?SDK.TracingManager} */
+ this._tracingManager = null;
+ /** @type {?SDK.ResourceTreeModel} */
+ this._resourceTreeModel = null;
this._timeCalculator = timeCalculator;
this._filmStripView = filmStripView;
}
@@ -690,15 +692,15 @@ Network.NetworkPanel.FilmStripRecorder = class {
* @override
*/
tracingComplete() {
- if (!this._tracingModel || !this._target)
+ if (!this._tracingModel || !this._tracingManager)
return;
this._tracingModel.tracingComplete();
- var resourceTreeModel = SDK.ResourceTreeModel.fromTarget(this._target);
- this._target = null;
+ this._tracingManager = null;
this._callback(new SDK.FilmStripModel(this._tracingModel, this._timeCalculator.minimumBoundary() * 1000));
delete this._callback;
- if (resourceTreeModel)
- resourceTreeModel.resumeReload();
+ if (this._resourceTreeModel)
+ this._resourceTreeModel.resumeReload();
+ this._resourceTreeModel = null;
}
/**
@@ -717,35 +719,36 @@ Network.NetworkPanel.FilmStripRecorder = class {
startRecording() {
this._filmStripView.reset();
this._filmStripView.setStatusText(Common.UIString('Recording frames...'));
- if (this._target)
+ var tracingManagers = SDK.targetManager.models(SDK.TracingManager);
+ if (this._tracingManager || !tracingManagers.length)
return;
- this._target = SDK.targetManager.mainTarget();
+ this._tracingManager = tracingManagers[0];
+ this._resourceTreeModel = this._tracingManager.target().model(SDK.ResourceTreeModel);
if (this._tracingModel)
this._tracingModel.reset();
else
this._tracingModel = new SDK.TracingModel(new Bindings.TempFileBackingStorage('tracing'));
- this._target.tracingManager.start(this, '-*,disabled-by-default-devtools.screenshot', '');
+ this._tracingManager.start(this, '-*,disabled-by-default-devtools.screenshot', '');
}
/**
* @return {boolean}
*/
isRecording() {
- return !!this._target;
+ return !!this._tracingManager;
}
/**
* @param {function(?SDK.FilmStripModel)} callback
*/
stopRecording(callback) {
- if (!this._target)
+ if (!this._tracingManager)
return;
- this._target.tracingManager.stop();
- var resourceTreeModel = SDK.ResourceTreeModel.fromTarget(this._target);
- if (resourceTreeModel)
- resourceTreeModel.suspendReload();
+ this._tracingManager.stop();
+ if (this._resourceTreeModel)
+ this._resourceTreeModel.suspendReload();
this._callback = callback;
this._filmStripView.setStatusText(Common.UIString('Fetching frames...'));
}

Powered by Google App Engine
This is Rietveld 408576698