OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/animation/SampledEffect.h" | 6 #include "core/animation/SampledEffect.h" |
7 | 7 |
8 namespace WebCore { | 8 namespace WebCore { |
9 | 9 |
10 SampledEffect::SampledEffect(Animation* animation, PassOwnPtrWillBeRawPtr<WillBe
HeapVector<RefPtrWillBeMember<Interpolation> > > interpolations) | 10 SampledEffect::SampledEffect(Animation* animation, PassOwnPtrWillBeRawPtr<WillBe
HeapVector<RefPtrWillBeMember<Interpolation> > > interpolations) |
11 : m_player(animation->player()) | 11 : m_player(animation->player()) |
12 , m_animation(animation) | 12 , m_animation(animation) |
13 , m_interpolations(interpolations) | 13 , m_interpolations(interpolations) |
14 , m_playerSortInfo(m_player->sortInfo()) | 14 , m_playerSortInfo(m_player->sortInfo()) |
15 , m_priority(animation->priority()) | 15 , m_priority(animation->priority()) |
16 { | 16 { |
17 ASSERT(m_interpolations && !m_interpolations->isEmpty()); | 17 ASSERT(m_interpolations && !m_interpolations->isEmpty()); |
18 } | 18 } |
19 | 19 |
20 bool SampledEffect::canChange() const | 20 bool SampledEffect::canChange() const |
21 { | 21 { |
| 22 #if ENABLE(OILPAN) |
| 23 return m_animation; |
| 24 #else |
22 if (!m_animation) | 25 if (!m_animation) |
23 return false; | 26 return false; |
24 // FIXME: This check won't be needed when Animation and AnimationPlayer are
moved to Oilpan. | 27 // FIXME: This check won't be needed when Animation and AnimationPlayer are
moved to Oilpan. |
25 return !m_player->canFree(); | 28 return !m_player->canFree(); |
| 29 #endif |
26 } | 30 } |
27 | 31 |
28 void SampledEffect::clear() | 32 void SampledEffect::detach() |
29 { | 33 { |
30 m_player.clear(); | 34 m_player = nullptr; |
31 m_animation = 0; | 35 m_animation = nullptr; |
32 m_interpolations->clear(); | 36 m_interpolations->clear(); |
33 } | 37 } |
34 | 38 |
35 void SampledEffect::removeReplacedInterpolationsIfNeeded(const BitArray<numCSSPr
operties>& replacedProperties) | 39 void SampledEffect::removeReplacedInterpolationsIfNeeded(const BitArray<numCSSPr
operties>& replacedProperties) |
36 { | 40 { |
37 if (canChange() && m_animation->isCurrent()) | 41 if (canChange() && m_animation->isCurrent()) |
38 return; | 42 return; |
39 | 43 |
40 size_t dest = 0; | 44 size_t dest = 0; |
41 for (size_t i = 0; i < m_interpolations->size(); i++) { | 45 for (size_t i = 0; i < m_interpolations->size(); i++) { |
42 if (!replacedProperties.get(toStyleInterpolation(m_interpolations->at(i)
.get())->id())) | 46 if (!replacedProperties.get(toStyleInterpolation(m_interpolations->at(i)
.get())->id())) |
43 m_interpolations->at(dest++) = m_interpolations->at(i); | 47 m_interpolations->at(dest++) = m_interpolations->at(i); |
44 } | 48 } |
45 m_interpolations->shrink(dest); | 49 m_interpolations->shrink(dest); |
46 } | 50 } |
47 | 51 |
| 52 void SampledEffect::trace(Visitor* visitor) |
| 53 { |
| 54 visitor->trace(m_player); |
| 55 visitor->trace(m_animation); |
| 56 visitor->trace(m_interpolations); |
| 57 } |
| 58 |
48 } // namespace WebCore | 59 } // namespace WebCore |
OLD | NEW |