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

Unified Diff: third_party/WebKit/Source/devtools/front_end/animation/AnimationTimeline.js

Issue 2674573006: [DevTools] Migrate TargetObserver to AnimationModel observer where makes sense. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/animation/AnimationModel.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/animation/AnimationTimeline.js
diff --git a/third_party/WebKit/Source/devtools/front_end/animation/AnimationTimeline.js b/third_party/WebKit/Source/devtools/front_end/animation/AnimationTimeline.js
index 694653d7f071f2b0f59468706239b2f6121f9d2e..261abfff41ab5c39e35ae895baaf565362ac173a 100644
--- a/third_party/WebKit/Source/devtools/front_end/animation/AnimationTimeline.js
+++ b/third_party/WebKit/Source/devtools/front_end/animation/AnimationTimeline.js
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
- * @implements {SDK.TargetManager.Observer}
+ * @implements {SDK.SDKModelObserver<!Animation.AnimationModel>}
* @unrestricted
*/
Animation.AnimationTimeline = class extends UI.VBox {
@@ -33,7 +33,7 @@ Animation.AnimationTimeline = class extends UI.VBox {
/** @type {!Map.<string, !Animation.AnimationModel.Animation>} */
this._animationsMap = new Map();
SDK.targetManager.addModelListener(SDK.DOMModel, SDK.DOMModel.Events.NodeRemoved, this._nodeRemoved, this);
- SDK.targetManager.observeTargets(this, SDK.Target.Capability.DOM);
+ SDK.targetManager.observeModels(Animation.AnimationModel, this);
UI.context.addFlavorChangeListener(SDK.DOMNode, this._nodeChanged, this);
}
@@ -41,41 +41,40 @@ Animation.AnimationTimeline = class extends UI.VBox {
* @override
*/
wasShown() {
- for (var target of SDK.targetManager.targets(SDK.Target.Capability.DOM))
- this._addEventListeners(target);
+ for (var animationModel of SDK.targetManager.models(Animation.AnimationModel))
+ this._addEventListeners(animationModel);
}
/**
* @override
*/
willHide() {
- for (var target of SDK.targetManager.targets(SDK.Target.Capability.DOM))
- this._removeEventListeners(target);
+ for (var animationModel of SDK.targetManager.models(Animation.AnimationModel))
+ this._removeEventListeners(animationModel);
this._popoverHelper.hidePopover();
}
/**
* @override
- * @param {!SDK.Target} target
+ * @param {!Animation.AnimationModel} animationModel
*/
- targetAdded(target) {
+ modelAdded(animationModel) {
if (this.isShowing())
- this._addEventListeners(target);
+ this._addEventListeners(animationModel);
}
/**
* @override
- * @param {!SDK.Target} target
+ * @param {!Animation.AnimationModel} animationModel
*/
- targetRemoved(target) {
- this._removeEventListeners(target);
+ modelRemoved(animationModel) {
+ this._removeEventListeners(animationModel);
}
/**
- * @param {!SDK.Target} target
+ * @param {!Animation.AnimationModel} animationModel
*/
- _addEventListeners(target) {
- var animationModel = Animation.AnimationModel.fromTarget(target);
+ _addEventListeners(animationModel) {
animationModel.ensureEnabled();
animationModel.addEventListener(
Animation.AnimationModel.Events.AnimationGroupStarted, this._animationGroupStarted, this);
@@ -83,10 +82,9 @@ Animation.AnimationTimeline = class extends UI.VBox {
}
/**
- * @param {!SDK.Target} target
+ * @param {!Animation.AnimationModel} animationModel
*/
- _removeEventListeners(target) {
- var animationModel = Animation.AnimationModel.fromTarget(target);
+ _removeEventListeners(animationModel) {
animationModel.removeEventListener(
Animation.AnimationModel.Events.AnimationGroupStarted, this._animationGroupStarted, this);
animationModel.removeEventListener(Animation.AnimationModel.Events.ModelReset, this._reset, this);
@@ -218,9 +216,8 @@ Animation.AnimationTimeline = class extends UI.VBox {
*/
_setPlaybackRate(playbackRate) {
this._playbackRate = playbackRate;
- var target = SDK.targetManager.mainTarget();
- if (target)
- Animation.AnimationModel.fromTarget(target).setPlaybackRate(this._allPaused ? 0 : this._playbackRate);
+ for (var animationModel of SDK.targetManager.models(Animation.AnimationModel))
+ animationModel.setPlaybackRate(this._allPaused ? 0 : this._playbackRate);
Host.userMetrics.actionTaken(Host.UserMetrics.Action.AnimationsPlaybackRateChanged);
if (this._scrubberPlayer)
this._scrubberPlayer.playbackRate = this._effectivePlaybackRate();
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/animation/AnimationModel.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698