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 "platform/animation/WebFilterAnimationCurve.h" |
| 8 #include "platform/animation/WebFilterOperations.h" |
| 9 #include "platform/animation/WebFloatAnimationCurve.h" |
| 10 #include "platform/animation/WebTransformAnimationCurve.h" |
| 11 #include "platform/animation/WebTransformOperations.h" |
| 12 |
| 13 namespace blink { |
| 14 |
| 15 class CompositorFactoryImpl : public CompositorFactory { |
| 16 public: |
| 17 WebFilterAnimationCurve* createFilterAnimationCurve() override |
| 18 { |
| 19 return new WebFilterAnimationCurve(); |
| 20 } |
| 21 |
| 22 WebFloatAnimationCurve* createFloatAnimationCurve() override |
| 23 { |
| 24 return new WebFloatAnimationCurve(); |
| 25 } |
| 26 |
| 27 WebScrollOffsetAnimationCurve* createScrollOffsetAnimationCurve( |
| 28 WebFloatPoint targetValue, |
| 29 WebCompositorAnimationCurve::TimingFunctionType timingFunctionType, |
| 30 WebScrollOffsetAnimationCurve::ScrollDurationBehavior durationBehavior) |
| 31 { |
| 32 return new WebScrollOffsetAnimationCurve(targetValue, timingFunctionType
, |
| 33 durationBehavior); |
| 34 } |
| 35 |
| 36 WebTransformAnimationCurve* createTransformAnimationCurve() override |
| 37 { |
| 38 return new WebTransformAnimationCurve(); |
| 39 } |
| 40 |
| 41 WebTransformOperations* createTransformOperations() override |
| 42 { |
| 43 return new WebTransformOperations(); |
| 44 } |
| 45 |
| 46 WebFilterOperations* createFilterOperations() override |
| 47 { |
| 48 return new WebFilterOperations(); |
| 49 } |
| 50 }; |
| 51 |
| 52 static CompositorFactory* s_factory = 0; |
| 53 |
| 54 void CompositorFactory::initializeDefault() |
| 55 { |
| 56 delete s_factory; |
| 57 s_factory = new CompositorFactoryImpl(); |
| 58 } |
| 59 |
| 60 void CompositorFactory::initializeForTesting(CompositorFactory* factory) |
| 61 { |
| 62 delete s_factory; |
| 63 s_factory = factory; |
| 64 } |
| 65 |
| 66 void CompositorFactory::shutdown() |
| 67 { |
| 68 delete s_factory; |
| 69 s_factory = nullptr; |
| 70 } |
| 71 |
| 72 CompositorFactory& CompositorFactory::current() |
| 73 { |
| 74 ASSERT(s_factory); |
| 75 return *s_factory; |
| 76 } |
| 77 |
| 78 } // namespace blink |
OLD | NEW |