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 s_factory = nullptr; |
| 57 } |
| 58 |
| 59 void CompositorFactory::initializeForTesting(scoped_ptr<CompositorFactory> facto
ry) |
| 60 { |
| 61 s_factory = factory.release(); |
| 62 } |
| 63 |
| 64 void CompositorFactory::shutdown() |
| 65 { |
| 66 delete s_factory; |
| 67 s_factory = nullptr; |
| 68 } |
| 69 |
| 70 CompositorFactory& CompositorFactory::current() |
| 71 { |
| 72 ASSERT(s_factory); |
| 73 return *s_factory; |
| 74 } |
| 75 |
| 76 } // namespace blink |
OLD | NEW |