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

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: [DevTools] No RTM for non-browser targets Created 4 years, 4 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 1c49a82014b32542c710a7a77956ac365a5d4d48..102060d05675613022957e79d7a691dc2f6f040b 100644
--- a/third_party/WebKit/Source/devtools/front_end/animation/AnimationModel.js
+++ b/third_party/WebKit/Source/devtools/front_end/animation/AnimationModel.js
@@ -20,8 +20,9 @@ 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);
+ var resourceTreeModel = /** @type {!WebInspector.ResourceTreeModel} */ (WebInspector.ResourceTreeModel.fromTarget(target));
+ resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, this._reset, this);
+ this._screenshotCapture = new WebInspector.AnimationModel.ScreenshotCapture(target, this, resourceTreeModel);
}
WebInspector.AnimationModel.Events = {
@@ -208,8 +209,9 @@ WebInspector.AnimationModel.fromTarget = function(target)
{
if (!target.hasDOMCapability())
return null;
- if (!target[WebInspector.AnimationModel._symbol])
+ if (!target[WebInspector.AnimationModel._symbol]) {
dgozman 2016/08/19 20:23:37 style: unnecessary {}
eostroukhov 2016/08/20 01:22:30 Done.
target[WebInspector.AnimationModel._symbol] = new WebInspector.AnimationModel(target);
+ }
return target[WebInspector.AnimationModel._symbol];
}
@@ -871,13 +873,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