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

Side by Side Diff: Source/core/animation/SampledEffect.cpp

Issue 967523002: Revert of Web Animations: Remove AnimationPlayer discarding logic (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « Source/core/animation/SampledEffect.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "core/animation/StyleInterpolation.h" 8 #include "core/animation/StyleInterpolation.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 SampledEffect::SampledEffect(Animation* animation, PassOwnPtrWillBeRawPtr<WillBe HeapVector<RefPtrWillBeMember<Interpolation> > > interpolations) 12 SampledEffect::SampledEffect(Animation* animation, PassOwnPtrWillBeRawPtr<WillBe HeapVector<RefPtrWillBeMember<Interpolation> > > interpolations)
13 : m_animation(animation) 13 : m_animation(animation)
14 #if !ENABLE(OILPAN)
14 , m_player(animation->player()) 15 , m_player(animation->player())
16 #endif
15 , m_interpolations(interpolations) 17 , m_interpolations(interpolations)
16 , m_sequenceNumber(animation->player()->sequenceNumber()) 18 , m_sequenceNumber(animation->player()->sequenceNumber())
17 , m_priority(animation->priority()) 19 , m_priority(animation->priority())
18 { 20 {
19 ASSERT(m_interpolations && !m_interpolations->isEmpty()); 21 ASSERT(m_interpolations && !m_interpolations->isEmpty());
20 } 22 }
21 23
24 bool SampledEffect::canChange() const
25 {
26 #if ENABLE(OILPAN)
27 return m_animation;
28 #else
29 if (!m_animation)
30 return false;
31 // FIXME: This check won't be needed when Animation and AnimationPlayer are moved to Oilpan.
32 return !m_player->canFree();
33 #endif
34 }
35
22 void SampledEffect::clear() 36 void SampledEffect::clear()
23 { 37 {
38 #if !ENABLE(OILPAN)
24 m_player = nullptr; 39 m_player = nullptr;
40 #endif
25 m_animation = nullptr; 41 m_animation = nullptr;
26 m_interpolations->clear(); 42 m_interpolations->clear();
27 } 43 }
28 44
45 void SampledEffect::removeReplacedInterpolationsIfNeeded(const BitArray<numCSSPr operties>& replacedProperties)
46 {
47 if (canChange() && m_animation->isCurrent())
48 return;
49
50 size_t dest = 0;
51 for (auto& interpolation : *m_interpolations) {
52 if (!replacedProperties.get(toStyleInterpolation(interpolation.get())->i d()))
53 m_interpolations->at(dest++) = interpolation;
54 }
55 m_interpolations->shrink(dest);
56 }
57
29 DEFINE_TRACE(SampledEffect) 58 DEFINE_TRACE(SampledEffect)
30 { 59 {
31 visitor->trace(m_animation); 60 visitor->trace(m_animation);
32 #if ENABLE(OILPAN) 61 #if ENABLE(OILPAN)
33 visitor->trace(m_interpolations); 62 visitor->trace(m_interpolations);
34 #endif 63 #endif
35 } 64 }
36 65
37 } // namespace blink 66 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/animation/SampledEffect.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698