OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 #include "platform/CompositorFactory.h" |
| 6 |
| 7 #include "cc/animation/animation_player.h" |
| 8 #include "cc/animation/animation_timeline.h" |
| 9 #include "platform/animation/WebCompositorAnimation.h" |
| 10 #include "platform/animation/WebCompositorAnimationPlayer.h" |
| 11 #include "platform/animation/WebCompositorAnimationTimeline.h" |
| 12 #include "platform/animation/WebFilterAnimationCurve.h" |
| 13 #include "platform/animation/WebFilterOperations.h" |
| 14 #include "platform/animation/WebFloatAnimationCurve.h" |
| 15 #include "platform/animation/WebTransformAnimationCurve.h" |
| 16 #include "platform/animation/WebTransformOperations.h" |
| 17 |
| 18 namespace blink { |
| 19 |
| 20 class CompositorFactoryImpl : public CompositorFactory { |
| 21 public: |
| 22 WebFilterAnimationCurve* createFilterAnimationCurve() override |
| 23 { |
| 24 return new WebFilterAnimationCurve(); |
| 25 } |
| 26 |
| 27 WebFloatAnimationCurve* createFloatAnimationCurve() override |
| 28 { |
| 29 return new WebFloatAnimationCurve(); |
| 30 } |
| 31 |
| 32 WebScrollOffsetAnimationCurve* createScrollOffsetAnimationCurve( |
| 33 WebFloatPoint targetValue, |
| 34 WebCompositorAnimationCurve::TimingFunctionType timingFunctionType, |
| 35 WebScrollOffsetAnimationCurve::ScrollDurationBehavior durationBehavior) |
| 36 { |
| 37 return new WebScrollOffsetAnimationCurve(targetValue, timingFunctionType
, |
| 38 durationBehavior); |
| 39 } |
| 40 |
| 41 WebTransformAnimationCurve* createTransformAnimationCurve() override |
| 42 { |
| 43 return new WebTransformAnimationCurve(); |
| 44 } |
| 45 |
| 46 WebTransformOperations* createTransformOperations() override |
| 47 { |
| 48 return new WebTransformOperations(); |
| 49 } |
| 50 |
| 51 WebFilterOperations* createFilterOperations() override |
| 52 { |
| 53 return new WebFilterOperations(); |
| 54 } |
| 55 |
| 56 WebCompositorAnimation* createAnimation( |
| 57 const blink::WebCompositorAnimationCurve& curve, |
| 58 blink::WebCompositorAnimation::TargetProperty target, |
| 59 int groupId, |
| 60 int animationId) override |
| 61 { |
| 62 return new WebCompositorAnimation(curve, target, animationId, groupId); |
| 63 } |
| 64 |
| 65 WebCompositorAnimationPlayer* createAnimationPlayer() |
| 66 { |
| 67 return new WebCompositorAnimationPlayer(); |
| 68 } |
| 69 |
| 70 WebCompositorAnimationTimeline* createAnimationTimeline() |
| 71 { |
| 72 return new WebCompositorAnimationTimeline(); |
| 73 } |
| 74 }; |
| 75 |
| 76 static CompositorFactory* s_factory = 0; |
| 77 |
| 78 void CompositorFactory::initializeDefault() |
| 79 { |
| 80 delete s_factory; |
| 81 s_factory = new CompositorFactoryImpl(); |
| 82 } |
| 83 |
| 84 void CompositorFactory::initializeForTesting(CompositorFactory* factory) |
| 85 { |
| 86 delete s_factory; |
| 87 s_factory = factory; |
| 88 } |
| 89 |
| 90 void CompositorFactory::shutdown() |
| 91 { |
| 92 delete s_factory; |
| 93 s_factory = nullptr; |
| 94 } |
| 95 |
| 96 CompositorFactory& CompositorFactory::current() |
| 97 { |
| 98 ASSERT(s_factory); |
| 99 return *s_factory; |
| 100 } |
| 101 |
| 102 } // namespace blink |
OLD | NEW |