Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 201 WebInspector.AnimationModel._symbol = Symbol("AnimationModel"); | 202 WebInspector.AnimationModel._symbol = Symbol("AnimationModel"); |
| 202 | 203 |
| 203 /** | 204 /** |
| 204 * @param {!WebInspector.Target} target | 205 * @param {!WebInspector.Target} target |
| 205 * @return {?WebInspector.AnimationModel} | 206 * @return {?WebInspector.AnimationModel} |
| 206 */ | 207 */ |
| 207 WebInspector.AnimationModel.fromTarget = function(target) | 208 WebInspector.AnimationModel.fromTarget = function(target) |
| 208 { | 209 { |
| 209 if (!target.hasDOMCapability()) | 210 if (!target.hasDOMCapability()) |
| 210 return null; | 211 return null; |
| 211 if (!target[WebInspector.AnimationModel._symbol]) | 212 if (!target[WebInspector.AnimationModel._symbol]) { |
|
dgozman
2016/08/19 20:23:37
style: unnecessary {}
eostroukhov
2016/08/20 01:22:30
Done.
| |
| 212 target[WebInspector.AnimationModel._symbol] = new WebInspector.Animation Model(target); | 213 target[WebInspector.AnimationModel._symbol] = new WebInspector.Animation Model(target); |
| 214 } | |
| 213 | 215 |
| 214 return target[WebInspector.AnimationModel._symbol]; | 216 return target[WebInspector.AnimationModel._symbol]; |
| 215 } | 217 } |
| 216 | 218 |
| 217 /** | 219 /** |
| 218 * @constructor | 220 * @constructor |
| 219 * @extends {WebInspector.SDKObject} | 221 * @extends {WebInspector.SDKObject} |
| 220 * @param {!WebInspector.Target} target | 222 * @param {!WebInspector.Target} target |
| 221 * @param {!AnimationAgent.Animation} payload | 223 * @param {!AnimationAgent.Animation} payload |
| 222 */ | 224 */ |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 864 animationStarted: function(payload) | 866 animationStarted: function(payload) |
| 865 { | 867 { |
| 866 this._animationModel.animationStarted(payload); | 868 this._animationModel.animationStarted(payload); |
| 867 } | 869 } |
| 868 } | 870 } |
| 869 | 871 |
| 870 /** | 872 /** |
| 871 * @constructor | 873 * @constructor |
| 872 * @param {!WebInspector.Target} target | 874 * @param {!WebInspector.Target} target |
| 873 * @param {!WebInspector.AnimationModel} model | 875 * @param {!WebInspector.AnimationModel} model |
| 876 * @param {!WebInspector.ResourceTreeModel} resourceTreeModel | |
| 874 */ | 877 */ |
| 875 WebInspector.AnimationModel.ScreenshotCapture = function(target, model) | 878 WebInspector.AnimationModel.ScreenshotCapture = function(target, model, resource TreeModel) |
| 876 { | 879 { |
| 877 this._target = target; | 880 this._target = target; |
| 878 /** @type {!Array<!WebInspector.AnimationModel.ScreenshotCapture.Request>} * / | 881 /** @type {!Array<!WebInspector.AnimationModel.ScreenshotCapture.Request>} * / |
| 879 this._requests = []; | 882 this._requests = []; |
| 880 this._target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod el.EventTypes.ScreencastFrame, this._screencastFrame, this); | 883 resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes .ScreencastFrame, this._screencastFrame, this); |
| 881 this._model = model; | 884 this._model = model; |
| 882 this._model.addEventListener(WebInspector.AnimationModel.Events.ModelReset, this._stopScreencast, this); | 885 this._model.addEventListener(WebInspector.AnimationModel.Events.ModelReset, this._stopScreencast, this); |
| 883 } | 886 } |
| 884 | 887 |
| 885 /** @typedef {{ endTime: number, screenshots: !Array.<string>}} */ | 888 /** @typedef {{ endTime: number, screenshots: !Array.<string>}} */ |
| 886 WebInspector.AnimationModel.ScreenshotCapture.Request; | 889 WebInspector.AnimationModel.ScreenshotCapture.Request; |
| 887 | 890 |
| 888 WebInspector.AnimationModel.ScreenshotCapture.prototype = { | 891 WebInspector.AnimationModel.ScreenshotCapture.prototype = { |
| 889 /** | 892 /** |
| 890 * @param {number} duration | 893 * @param {number} duration |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 937 if (!this._capturing) | 940 if (!this._capturing) |
| 938 return; | 941 return; |
| 939 | 942 |
| 940 delete this._stopTimer; | 943 delete this._stopTimer; |
| 941 delete this._endTime; | 944 delete this._endTime; |
| 942 this._requests = []; | 945 this._requests = []; |
| 943 this._capturing = false; | 946 this._capturing = false; |
| 944 this._target.pageAgent().stopScreencast(); | 947 this._target.pageAgent().stopScreencast(); |
| 945 } | 948 } |
| 946 } | 949 } |
| OLD | NEW |