| 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 /** @enum {symbol} */ | 28 /** @enum {symbol} */ |
| 28 WebInspector.AnimationModel.Events = { | 29 WebInspector.AnimationModel.Events = { |
| 29 AnimationGroupStarted: Symbol("AnimationGroupStarted"), | 30 AnimationGroupStarted: Symbol("AnimationGroupStarted"), |
| 30 ModelReset: Symbol("ModelReset") | 31 ModelReset: Symbol("ModelReset") |
| 31 } | 32 } |
| 32 | 33 |
| 33 WebInspector.AnimationModel.prototype = { | 34 WebInspector.AnimationModel.prototype = { |
| 34 _reset: function() | 35 _reset: function() |
| (...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 animationStarted: function(payload) | 866 animationStarted: function(payload) |
| 866 { | 867 { |
| 867 this._animationModel.animationStarted(payload); | 868 this._animationModel.animationStarted(payload); |
| 868 } | 869 } |
| 869 } | 870 } |
| 870 | 871 |
| 871 /** | 872 /** |
| 872 * @constructor | 873 * @constructor |
| 873 * @param {!WebInspector.Target} target | 874 * @param {!WebInspector.Target} target |
| 874 * @param {!WebInspector.AnimationModel} model | 875 * @param {!WebInspector.AnimationModel} model |
| 876 * @param {!WebInspector.ResourceTreeModel} resourceTreeModel |
| 875 */ | 877 */ |
| 876 WebInspector.AnimationModel.ScreenshotCapture = function(target, model) | 878 WebInspector.AnimationModel.ScreenshotCapture = function(target, model, resource
TreeModel) |
| 877 { | 879 { |
| 878 this._target = target; | 880 this._target = target; |
| 879 /** @type {!Array<!WebInspector.AnimationModel.ScreenshotCapture.Request>} *
/ | 881 /** @type {!Array<!WebInspector.AnimationModel.ScreenshotCapture.Request>} *
/ |
| 880 this._requests = []; | 882 this._requests = []; |
| 881 this._target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod
el.EventTypes.ScreencastFrame, this._screencastFrame, this); | 883 resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes
.ScreencastFrame, this._screencastFrame, this); |
| 882 this._model = model; | 884 this._model = model; |
| 883 this._model.addEventListener(WebInspector.AnimationModel.Events.ModelReset,
this._stopScreencast, this); | 885 this._model.addEventListener(WebInspector.AnimationModel.Events.ModelReset,
this._stopScreencast, this); |
| 884 } | 886 } |
| 885 | 887 |
| 886 /** @typedef {{ endTime: number, screenshots: !Array.<string>}} */ | 888 /** @typedef {{ endTime: number, screenshots: !Array.<string>}} */ |
| 887 WebInspector.AnimationModel.ScreenshotCapture.Request; | 889 WebInspector.AnimationModel.ScreenshotCapture.Request; |
| 888 | 890 |
| 889 WebInspector.AnimationModel.ScreenshotCapture.prototype = { | 891 WebInspector.AnimationModel.ScreenshotCapture.prototype = { |
| 890 /** | 892 /** |
| 891 * @param {number} duration | 893 * @param {number} duration |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 if (!this._capturing) | 940 if (!this._capturing) |
| 939 return; | 941 return; |
| 940 | 942 |
| 941 delete this._stopTimer; | 943 delete this._stopTimer; |
| 942 delete this._endTime; | 944 delete this._endTime; |
| 943 this._requests = []; | 945 this._requests = []; |
| 944 this._capturing = false; | 946 this._capturing = false; |
| 945 this._target.pageAgent().stopScreencast(); | 947 this._target.pageAgent().stopScreencast(); |
| 946 } | 948 } |
| 947 } | 949 } |
| OLD | NEW |