Fix NULL deref in safe browsing preference validation delegate.
[chromium-blink-merge.git] / ui / compositor / layer_animator_collection.h
blob2789eda3cb4fbdb9e7427714a307ce786253cc56
1 // 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.
5 #ifndef UI_COMPOSITOR_LAYER_ANIMATOR_COLLECTION_H_
6 #define UI_COMPOSITOR_LAYER_ANIMATOR_COLLECTION_H_
8 #include <set>
10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/time/time.h"
13 #include "ui/compositor/compositor_export.h"
15 namespace base {
16 class TimeTicks;
19 namespace ui {
21 class LayerAnimator;
23 class COMPOSITOR_EXPORT LayerAnimatorCollectionDelegate {
24 public:
25 virtual ~LayerAnimatorCollectionDelegate() {}
27 virtual void ScheduleAnimationForLayerCollection() = 0;
30 // A collection of LayerAnimators that should be updated at each animation step
31 // in the compositor.
32 class COMPOSITOR_EXPORT LayerAnimatorCollection {
33 public:
34 explicit LayerAnimatorCollection(LayerAnimatorCollectionDelegate* delegate);
35 ~LayerAnimatorCollection();
37 void StartAnimator(scoped_refptr<LayerAnimator> animator);
38 void StopAnimator(scoped_refptr<LayerAnimator> animator);
40 bool HasActiveAnimators() const;
42 void Progress(base::TimeTicks now);
44 base::TimeTicks last_tick_time() const { return last_tick_time_; }
46 private:
47 LayerAnimatorCollectionDelegate* delegate_;
48 base::TimeTicks last_tick_time_;
49 std::set<scoped_refptr<LayerAnimator> > animators_;
51 DISALLOW_COPY_AND_ASSIGN(LayerAnimatorCollection);
54 } // namespace ui
56 #endif // UI_COMPOSITOR_LAYER_ANIMATOR_COLLECTION_H_