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

Side by Side 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: Comments addressed 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 5
6 /** 6 /**
7 * @constructor 7 * @constructor
8 * @extends {WebInspector.SDKModel} 8 * @extends {WebInspector.SDKModel}
9 * @param {!WebInspector.Target} target 9 * @param {!WebInspector.Target} target
10 */ 10 */
11 WebInspector.AnimationModel = function(target) 11 WebInspector.AnimationModel = function(target)
12 { 12 {
13 WebInspector.SDKModel.call(this, WebInspector.AnimationModel, target); 13 WebInspector.SDKModel.call(this, WebInspector.AnimationModel, target);
14 this._agent = target.animationAgent(); 14 this._agent = target.animationAgent();
15 target.registerAnimationDispatcher(new WebInspector.AnimationDispatcher(this )); 15 target.registerAnimationDispatcher(new WebInspector.AnimationDispatcher(this ));
16 /** @type {!Map.<string, !WebInspector.AnimationModel.Animation>} */ 16 /** @type {!Map.<string, !WebInspector.AnimationModel.Animation>} */
17 this._animationsById = new Map(); 17 this._animationsById = new Map();
18 /** @type {!Map.<string, !WebInspector.AnimationModel.AnimationGroup>} */ 18 /** @type {!Map.<string, !WebInspector.AnimationModel.AnimationGroup>} */
19 this._animationGroups = new Map(); 19 this._animationGroups = new Map();
20 /** @type {!Array.<string>} */ 20 /** @type {!Array.<string>} */
21 this._pendingAnimations = []; 21 this._pendingAnimations = [];
22 this._playbackRate = 1; 22 this._playbackRate = 1;
23 target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Eve ntTypes.MainFrameNavigated, this._reset, this); 23 var resourceTreeModel = /** @type {!WebInspector.ResourceTreeModel} */ (WebI nspector.ResourceTreeModel.fromTarget(target));
24 this._screenshotCapture = new WebInspector.AnimationModel.ScreenshotCapture( target, this); 24 resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes .MainFrameNavigated, this._reset, this);
25 this._screenshotCapture = new WebInspector.AnimationModel.ScreenshotCapture( target, this, resourceTreeModel);
25 } 26 }
26 27
27 WebInspector.AnimationModel.Events = { 28 WebInspector.AnimationModel.Events = {
28 AnimationGroupStarted: "AnimationGroupStarted", 29 AnimationGroupStarted: "AnimationGroupStarted",
29 ModelReset: "ModelReset" 30 ModelReset: "ModelReset"
30 } 31 }
31 32
32 WebInspector.AnimationModel.prototype = { 33 WebInspector.AnimationModel.prototype = {
33 _reset: function() 34 _reset: function()
34 { 35 {
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 animationStarted: function(payload) 865 animationStarted: function(payload)
865 { 866 {
866 this._animationModel.animationStarted(payload); 867 this._animationModel.animationStarted(payload);
867 } 868 }
868 } 869 }
869 870
870 /** 871 /**
871 * @constructor 872 * @constructor
872 * @param {!WebInspector.Target} target 873 * @param {!WebInspector.Target} target
873 * @param {!WebInspector.AnimationModel} model 874 * @param {!WebInspector.AnimationModel} model
875 * @param {!WebInspector.ResourceTreeModel} resourceTreeModel
874 */ 876 */
875 WebInspector.AnimationModel.ScreenshotCapture = function(target, model) 877 WebInspector.AnimationModel.ScreenshotCapture = function(target, model, resource TreeModel)
876 { 878 {
877 this._target = target; 879 this._target = target;
878 /** @type {!Array<!WebInspector.AnimationModel.ScreenshotCapture.Request>} * / 880 /** @type {!Array<!WebInspector.AnimationModel.ScreenshotCapture.Request>} * /
879 this._requests = []; 881 this._requests = [];
880 this._target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod el.EventTypes.ScreencastFrame, this._screencastFrame, this); 882 resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes .ScreencastFrame, this._screencastFrame, this);
881 this._model = model; 883 this._model = model;
882 this._model.addEventListener(WebInspector.AnimationModel.Events.ModelReset, this._stopScreencast, this); 884 this._model.addEventListener(WebInspector.AnimationModel.Events.ModelReset, this._stopScreencast, this);
883 } 885 }
884 886
885 /** @typedef {{ endTime: number, screenshots: !Array.<string>}} */ 887 /** @typedef {{ endTime: number, screenshots: !Array.<string>}} */
886 WebInspector.AnimationModel.ScreenshotCapture.Request; 888 WebInspector.AnimationModel.ScreenshotCapture.Request;
887 889
888 WebInspector.AnimationModel.ScreenshotCapture.prototype = { 890 WebInspector.AnimationModel.ScreenshotCapture.prototype = {
889 /** 891 /**
890 * @param {number} duration 892 * @param {number} duration
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 if (!this._capturing) 939 if (!this._capturing)
938 return; 940 return;
939 941
940 delete this._stopTimer; 942 delete this._stopTimer;
941 delete this._endTime; 943 delete this._endTime;
942 this._requests = []; 944 this._requests = [];
943 this._capturing = false; 945 this._capturing = false;
944 this._target.pageAgent().stopScreencast(); 946 this._target.pageAgent().stopScreencast();
945 } 947 }
946 } 948 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698