blob: 7e909bd9141862ed1cfce96fa24b152b0f109d25 [file] [log] [blame]
[email protected]9034a282014-06-05 03:11:471// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef UI_COMPOSITOR_LAYER_ANIMATOR_COLLECTION_H_
6#define UI_COMPOSITOR_LAYER_ANIMATOR_COLLECTION_H_
7
8#include <set>
9
10#include "base/callback.h"
avi87b8b582015-12-24 21:35:2511#include "base/macros.h"
[email protected]9034a282014-06-05 03:11:4712#include "base/memory/ref_counted.h"
13#include "base/time/time.h"
[email protected]5ffe6d142014-08-01 16:04:3814#include "ui/compositor/compositor_animation_observer.h"
[email protected]9034a282014-06-05 03:11:4715#include "ui/compositor/compositor_export.h"
16
[email protected]9034a282014-06-05 03:11:4717namespace ui {
18
[email protected]5ffe6d142014-08-01 16:04:3819class Compositor;
[email protected]9034a282014-06-05 03:11:4720class LayerAnimator;
21
[email protected]9034a282014-06-05 03:11:4722// A collection of LayerAnimators that should be updated at each animation step
23// in the compositor.
[email protected]5ffe6d142014-08-01 16:04:3824class COMPOSITOR_EXPORT LayerAnimatorCollection
25 : public CompositorAnimationObserver {
[email protected]9034a282014-06-05 03:11:4726 public:
[email protected]5ffe6d142014-08-01 16:04:3827 explicit LayerAnimatorCollection(Compositor* compositor);
dcheng08038792014-10-21 10:53:2628 ~LayerAnimatorCollection() override;
[email protected]9034a282014-06-05 03:11:4729
30 void StartAnimator(scoped_refptr<LayerAnimator> animator);
31 void StopAnimator(scoped_refptr<LayerAnimator> animator);
32
33 bool HasActiveAnimators() const;
34
[email protected]9034a282014-06-05 03:11:4735 base::TimeTicks last_tick_time() const { return last_tick_time_; }
36
[email protected]5ffe6d142014-08-01 16:04:3837 // CompositorAnimationObserver:
dcheng08038792014-10-21 10:53:2638 void OnAnimationStep(base::TimeTicks timestamp) override;
lof84adf2ce862015-06-02 22:23:3239 void OnCompositingShuttingDown(Compositor* compositor) override;
[email protected]5ffe6d142014-08-01 16:04:3840
[email protected]9034a282014-06-05 03:11:4741 private:
[email protected]5ffe6d142014-08-01 16:04:3842 Compositor* compositor_;
[email protected]9034a282014-06-05 03:11:4743 base::TimeTicks last_tick_time_;
44 std::set<scoped_refptr<LayerAnimator> > animators_;
45
46 DISALLOW_COPY_AND_ASSIGN(LayerAnimatorCollection);
47};
48
49} // namespace ui
50
51#endif // UI_COMPOSITOR_LAYER_ANIMATOR_COLLECTION_H_