| Index: third_party/WebKit/Source/platform/CompositorFactory.cpp
|
| diff --git a/third_party/WebKit/Source/platform/CompositorFactory.cpp b/third_party/WebKit/Source/platform/CompositorFactory.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..4344e789e6ea03bef3e511a58bb76b8a4bf50f31
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/platform/CompositorFactory.cpp
|
| @@ -0,0 +1,102 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "platform/CompositorFactory.h"
|
| +
|
| +#include "cc/animation/animation_player.h"
|
| +#include "cc/animation/animation_timeline.h"
|
| +#include "platform/animation/WebCompositorAnimation.h"
|
| +#include "platform/animation/WebCompositorAnimationPlayer.h"
|
| +#include "platform/animation/WebCompositorAnimationTimeline.h"
|
| +#include "platform/animation/WebFilterAnimationCurve.h"
|
| +#include "platform/animation/WebFilterOperations.h"
|
| +#include "platform/animation/WebFloatAnimationCurve.h"
|
| +#include "platform/animation/WebTransformAnimationCurve.h"
|
| +#include "platform/animation/WebTransformOperations.h"
|
| +
|
| +namespace blink {
|
| +
|
| +class CompositorFactoryImpl : public CompositorFactory {
|
| +public:
|
| + WebFilterAnimationCurve* createFilterAnimationCurve() override
|
| + {
|
| + return new WebFilterAnimationCurve();
|
| + }
|
| +
|
| + WebFloatAnimationCurve* createFloatAnimationCurve() override
|
| + {
|
| + return new WebFloatAnimationCurve();
|
| + }
|
| +
|
| + WebScrollOffsetAnimationCurve* createScrollOffsetAnimationCurve(
|
| + WebFloatPoint targetValue,
|
| + WebCompositorAnimationCurve::TimingFunctionType timingFunctionType,
|
| + WebScrollOffsetAnimationCurve::ScrollDurationBehavior durationBehavior)
|
| + {
|
| + return new WebScrollOffsetAnimationCurve(targetValue, timingFunctionType,
|
| + durationBehavior);
|
| + }
|
| +
|
| + WebTransformAnimationCurve* createTransformAnimationCurve() override
|
| + {
|
| + return new WebTransformAnimationCurve();
|
| + }
|
| +
|
| + WebTransformOperations* createTransformOperations() override
|
| + {
|
| + return new WebTransformOperations();
|
| + }
|
| +
|
| + WebFilterOperations* createFilterOperations() override
|
| + {
|
| + return new WebFilterOperations();
|
| + }
|
| +
|
| + WebCompositorAnimation* createAnimation(
|
| + const blink::WebCompositorAnimationCurve& curve,
|
| + blink::WebCompositorAnimation::TargetProperty target,
|
| + int groupId,
|
| + int animationId) override
|
| + {
|
| + return new WebCompositorAnimation(curve, target, animationId, groupId);
|
| + }
|
| +
|
| + WebCompositorAnimationPlayer* createAnimationPlayer()
|
| + {
|
| + return new WebCompositorAnimationPlayer();
|
| + }
|
| +
|
| + WebCompositorAnimationTimeline* createAnimationTimeline()
|
| + {
|
| + return new WebCompositorAnimationTimeline();
|
| + }
|
| +};
|
| +
|
| +static CompositorFactory* s_factory = 0;
|
| +
|
| +void CompositorFactory::initializeDefault()
|
| +{
|
| + delete s_factory;
|
| + s_factory = new CompositorFactoryImpl();
|
| +}
|
| +
|
| +void CompositorFactory::initializeForTesting(CompositorFactory* factory)
|
| +{
|
| + delete s_factory;
|
| + s_factory = factory;
|
| +}
|
| +
|
| +void CompositorFactory::shutdown()
|
| +{
|
| + delete s_factory;
|
| + s_factory = nullptr;
|
| +}
|
| +
|
| +CompositorFactory& CompositorFactory::current()
|
| +{
|
| + ASSERT(s_factory);
|
| + return *s_factory;
|
| +}
|
| +
|
| +} // namespace blink
|
|
|