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 = WebInspector.ResourceTreeModel.fromTarget(target); |
| 24 if (resourceTreeModel) | |
|
pfeldman
2016/07/07 17:44:13
No need in this check - we should either have both
eostroukhov-old
2016/07/13 23:30:58
To signify the dependency, I turned resourceTreeMo
| |
| 25 resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventT ypes.MainFrameNavigated, this._reset, this); | |
| 24 this._screenshotCapture = new WebInspector.AnimationModel.ScreenshotCapture( target, this); | 26 this._screenshotCapture = new WebInspector.AnimationModel.ScreenshotCapture( target, this); |
| 25 } | 27 } |
| 26 | 28 |
| 27 WebInspector.AnimationModel.Events = { | 29 WebInspector.AnimationModel.Events = { |
| 28 AnimationGroupStarted: "AnimationGroupStarted", | 30 AnimationGroupStarted: "AnimationGroupStarted", |
| 29 ModelReset: "ModelReset" | 31 ModelReset: "ModelReset" |
| 30 } | 32 } |
| 31 | 33 |
| 32 WebInspector.AnimationModel.prototype = { | 34 WebInspector.AnimationModel.prototype = { |
| 33 _reset: function() | 35 _reset: function() |
| (...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 876 /** | 878 /** |
| 877 * @constructor | 879 * @constructor |
| 878 * @param {!WebInspector.Target} target | 880 * @param {!WebInspector.Target} target |
| 879 * @param {!WebInspector.AnimationModel} model | 881 * @param {!WebInspector.AnimationModel} model |
| 880 */ | 882 */ |
| 881 WebInspector.AnimationModel.ScreenshotCapture = function(target, model) | 883 WebInspector.AnimationModel.ScreenshotCapture = function(target, model) |
| 882 { | 884 { |
| 883 this._target = target; | 885 this._target = target; |
| 884 /** @type {!Array<!WebInspector.AnimationModel.ScreenshotCapture.Request>} * / | 886 /** @type {!Array<!WebInspector.AnimationModel.ScreenshotCapture.Request>} * / |
| 885 this._requests = []; | 887 this._requests = []; |
| 886 this._target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod el.EventTypes.ScreencastFrame, this._screencastFrame, this); | 888 var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(this._targ et); |
| 889 if (resourceTreeModel) | |
|
pfeldman
2016/07/07 17:44:13
ditto
eostroukhov-old
2016/07/13 23:30:58
Done.
| |
| 890 resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventT ypes.ScreencastFrame, this._screencastFrame, this); | |
| 887 this._model = model; | 891 this._model = model; |
| 888 this._model.addEventListener(WebInspector.AnimationModel.Events.ModelReset, this._stopScreencast, this); | 892 this._model.addEventListener(WebInspector.AnimationModel.Events.ModelReset, this._stopScreencast, this); |
| 889 } | 893 } |
| 890 | 894 |
| 891 /** @typedef {{ endTime: number, screenshots: !Array.<string>}} */ | 895 /** @typedef {{ endTime: number, screenshots: !Array.<string>}} */ |
| 892 WebInspector.AnimationModel.ScreenshotCapture.Request; | 896 WebInspector.AnimationModel.ScreenshotCapture.Request; |
| 893 | 897 |
| 894 WebInspector.AnimationModel.ScreenshotCapture.prototype = { | 898 WebInspector.AnimationModel.ScreenshotCapture.prototype = { |
| 895 /** | 899 /** |
| 896 * @param {number} duration | 900 * @param {number} duration |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 943 if (!this._capturing) | 947 if (!this._capturing) |
| 944 return; | 948 return; |
| 945 | 949 |
| 946 delete this._stopTimer; | 950 delete this._stopTimer; |
| 947 delete this._endTime; | 951 delete this._endTime; |
| 948 this._requests = []; | 952 this._requests = []; |
| 949 this._capturing = false; | 953 this._capturing = false; |
| 950 this._target.pageAgent().stopScreencast(); | 954 this._target.pageAgent().stopScreencast(); |
| 951 } | 955 } |
| 952 } | 956 } |
| OLD | NEW |