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

Unified Diff: third_party/WebKit/Source/devtools/front_end/animation/AnimationModel.js

Issue 2122353002: [DevTools] Make resource tree model optional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 5 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/animation/AnimationModel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/animation/AnimationModel.js b/third_party/WebKit/Source/devtools/front_end/animation/AnimationModel.js
index 33b75da781d43dfe8ed46ce218df9c6d7bf9b585..4ab3c8001052513431d0156e94c4dafacabfc19a 100644
--- a/third_party/WebKit/Source/devtools/front_end/animation/AnimationModel.js
+++ b/third_party/WebKit/Source/devtools/front_end/animation/AnimationModel.js
@@ -7,8 +7,9 @@
* @constructor
* @extends {WebInspector.SDKModel}
* @param {!WebInspector.Target} target
+ * @param {!WebInspector.ResourceTreeModel} resourceTreeModel
*/
-WebInspector.AnimationModel = function(target)
+WebInspector.AnimationModel = function(target, resourceTreeModel)
{
WebInspector.SDKModel.call(this, WebInspector.AnimationModel, target);
this._agent = target.animationAgent();
@@ -20,8 +21,8 @@ WebInspector.AnimationModel = function(target)
/** @type {!Array.<string>} */
this._pendingAnimations = [];
this._playbackRate = 1;
- target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, this._reset, this);
- this._screenshotCapture = new WebInspector.AnimationModel.ScreenshotCapture(target, this);
+ resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, this._reset, this);
+ this._screenshotCapture = new WebInspector.AnimationModel.ScreenshotCapture(target, this, resourceTreeModel);
}
WebInspector.AnimationModel.Events = {
@@ -208,8 +209,10 @@ WebInspector.AnimationModel.fromTarget = function(target)
{
if (!target.hasBrowserCapability())
return null;
- if (!target[WebInspector.AnimationModel._symbol])
- target[WebInspector.AnimationModel._symbol] = new WebInspector.AnimationModel(target);
+ if (!target[WebInspector.AnimationModel._symbol]) {
+ var resourceTreeModel = /** @type {!WebInspector.ResourceTreeModel} */ (WebInspector.ResourceTreeModel.fromTarget(target));
pfeldman 2016/07/13 23:55:56 You could as well do this in the WebInspector.Anim
eostroukhov-old 2016/07/20 23:46:14 Done.
+ target[WebInspector.AnimationModel._symbol] = new WebInspector.AnimationModel(target, resourceTreeModel);
+ }
return target[WebInspector.AnimationModel._symbol];
}
@@ -879,13 +882,14 @@ WebInspector.AnimationDispatcher.prototype = {
* @constructor
* @param {!WebInspector.Target} target
* @param {!WebInspector.AnimationModel} model
+ * @param {!WebInspector.ResourceTreeModel} resourceTreeModel
*/
-WebInspector.AnimationModel.ScreenshotCapture = function(target, model)
+WebInspector.AnimationModel.ScreenshotCapture = function(target, model, resourceTreeModel)
{
this._target = target;
/** @type {!Array<!WebInspector.AnimationModel.ScreenshotCapture.Request>} */
this._requests = [];
- this._target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ScreencastFrame, this._screencastFrame, this);
+ resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ScreencastFrame, this._screencastFrame, this);
this._model = model;
this._model.addEventListener(WebInspector.AnimationModel.Events.ModelReset, this._stopScreencast, this);
}

Powered by Google App Engine
This is Rietveld 408576698