Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: third_party/WebKit/Source/platform/CompositorFactory.cpp

Issue 1616653002: CC Animation: Move files from cc_blink to Source/platform/animation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: GC Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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/CompositorAnimation.h"
10 #include "platform/animation/CompositorAnimationPlayer.h"
11 #include "platform/animation/CompositorAnimationTimeline.h"
12 #include "platform/animation/CompositorFilterAnimationCurve.h"
13 #include "platform/animation/CompositorFloatAnimationCurve.h"
14 #include "platform/animation/CompositorTransformAnimationCurve.h"
15 #include "platform/animation/CompositorTransformOperations.h"
16 #include "platform/graphics/CompositorFilterOperations.h"
17
18 namespace blink {
19
20 class CompositorFactoryImpl : public CompositorFactory {
21 public:
22 CompositorFilterAnimationCurve* createFilterAnimationCurve() override
23 {
24 return new CompositorFilterAnimationCurve();
25 }
26
27 CompositorFloatAnimationCurve* createFloatAnimationCurve() override
28 {
29 return new CompositorFloatAnimationCurve();
30 }
31
32 CompositorScrollOffsetAnimationCurve* createScrollOffsetAnimationCurve(
33 WebFloatPoint targetValue,
34 CompositorAnimationCurve::TimingFunctionType timingFunctionType,
35 CompositorScrollOffsetAnimationCurve::ScrollDurationBehavior durationBeh avior)
36 {
37 return new CompositorScrollOffsetAnimationCurve(targetValue, timingFunct ionType,
38 durationBehavior);
39 }
40
41 CompositorTransformAnimationCurve* createTransformAnimationCurve() override
42 {
43 return new CompositorTransformAnimationCurve();
44 }
45
46 CompositorTransformOperations* createTransformOperations() override
47 {
48 return new CompositorTransformOperations();
49 }
50
51 CompositorFilterOperations* createFilterOperations() override
52 {
53 return new CompositorFilterOperations();
54 }
55
56 CompositorAnimation* createAnimation(const blink::CompositorAnimationCurve& curve, blink::CompositorAnimation::TargetProperty target, int groupId, int anima tionId) override
57 {
58 return new CompositorAnimation(curve, target, animationId, groupId);
59 }
60
61 CompositorAnimationPlayer* createAnimationPlayer()
62 {
63 return new CompositorAnimationPlayer();
64 }
65
66 CompositorAnimationTimeline* createAnimationTimeline()
67 {
68 return new CompositorAnimationTimeline();
69 }
70 };
71
72 static CompositorFactory* s_factory = 0;
73
74 void CompositorFactory::initializeDefault()
75 {
76 delete s_factory;
77 s_factory = new CompositorFactoryImpl();
78 }
79
80 void CompositorFactory::initializeForTesting(CompositorFactory* factory)
jbroman 2016/01/29 15:29:18 Passing ownership through a raw pointer = :(.
loyso (OOO) 2016/02/01 05:31:32 Actually, I have CompositorFactoryMock-type pointe
jbroman 2016/02/01 15:44:36 The delete calls make this an owning pointer, and
81 {
82 delete s_factory;
83 s_factory = factory;
84 }
85
86 void CompositorFactory::shutdown()
87 {
88 delete s_factory;
jbroman 2016/01/29 15:29:18 Why is it necessary to shut down this factory?
loyso (OOO) 2016/02/01 05:31:32 In this CL I want to preserve the behavior of Comp
89 s_factory = nullptr;
90 }
91
92 CompositorFactory& CompositorFactory::current()
93 {
94 ASSERT(s_factory);
jbroman 2016/01/29 15:29:18 How about something like: // Does not assume owne
loyso (OOO) 2016/02/01 05:31:32 Technically, this is an extra conditional branch i
jbroman 2016/02/01 15:44:36 I'm not too worried about that (there's a lot of m
95 return *s_factory;
96 }
97
98 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698