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

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

Issue 1318543009: Oilpan: Partially ship Oilpan for core/animations (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/animation/AnimationStack.h ('k') | Source/core/animation/AnimationStackTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 namespace { 43 namespace {
44 44
45 void copyToActiveInterpolationMap(const WillBeHeapVector<RefPtrWillBeMember<Inte rpolation>>& source, ActiveInterpolationMap& target) 45 void copyToActiveInterpolationMap(const WillBeHeapVector<RefPtrWillBeMember<Inte rpolation>>& source, ActiveInterpolationMap& target)
46 { 46 {
47 for (const auto& interpolation : source) { 47 for (const auto& interpolation : source) {
48 target.set(interpolation->property(), interpolation.get()); 48 target.set(interpolation->property(), interpolation.get());
49 } 49 }
50 } 50 }
51 51
52 bool compareEffects(const OwnPtrWillBeMember<SampledEffect>& effect1, const OwnP trWillBeMember<SampledEffect>& effect2) 52 bool compareEffects(const Member<SampledEffect>& effect1, const Member<SampledEf fect>& effect2)
53 { 53 {
54 ASSERT(effect1 && effect2); 54 ASSERT(effect1 && effect2);
55 return effect1->sequenceNumber() < effect2->sequenceNumber(); 55 return effect1->sequenceNumber() < effect2->sequenceNumber();
56 } 56 }
57 57
58 void copyNewAnimationsToActiveInterpolationMap(const WillBeHeapVector<RawPtrWill BeMember<InertEffect>>& newAnimations, ActiveInterpolationMap& result) 58 void copyNewAnimationsToActiveInterpolationMap(const HeapVector<Member<InertEffe ct>>& newAnimations, ActiveInterpolationMap& result)
59 { 59 {
60 for (const auto& newAnimation : newAnimations) { 60 for (const auto& newAnimation : newAnimations) {
61 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> sample = nullptr; 61 OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>> sample = nullptr;
62 newAnimation->sample(sample); 62 newAnimation->sample(sample);
63 if (sample) 63 if (sample)
64 copyToActiveInterpolationMap(*sample, result); 64 copyToActiveInterpolationMap(*sample, result);
65 } 65 }
66 } 66 }
67 67
68 } // namespace 68 } // namespace
69 69
70 AnimationStack::AnimationStack() 70 AnimationStack::AnimationStack()
71 { 71 {
72 } 72 }
73 73
74 bool AnimationStack::hasActiveAnimationsOnCompositor(CSSPropertyID property) con st 74 bool AnimationStack::hasActiveAnimationsOnCompositor(CSSPropertyID property) con st
75 { 75 {
76 for (const auto& sampledEffect : m_effects) { 76 for (const auto& sampledEffect : m_effects) {
77 // TODO(dstockwell): move the playing check into AnimationEffect and exp ose both hasAnimations and hasActiveAnimations 77 // TODO(dstockwell): move the playing check into AnimationEffect and exp ose both hasAnimations and hasActiveAnimations
78 if (sampledEffect->effect() && sampledEffect->effect()->animation()->pla ying() && sampledEffect->effect()->hasActiveAnimationsOnCompositor(property)) 78 if (sampledEffect->effect() && sampledEffect->effect()->animation()->pla ying() && sampledEffect->effect()->hasActiveAnimationsOnCompositor(property))
79 return true; 79 return true;
80 } 80 }
81 return false; 81 return false;
82 } 82 }
83 83
84 ActiveInterpolationMap AnimationStack::activeInterpolations(AnimationStack* anim ationStack, const WillBeHeapVector<RawPtrWillBeMember<InertEffect>>* newAnimatio ns, const WillBeHeapHashSet<RawPtrWillBeMember<const Animation>>* suppressedAnim ations, KeyframeEffect::Priority priority, double timelineCurrentTime) 84 ActiveInterpolationMap AnimationStack::activeInterpolations(AnimationStack* anim ationStack, const HeapVector<Member<InertEffect>>* newAnimations, const HeapHash Set<Member<const Animation>>* suppressedAnimations, KeyframeEffect::Priority pri ority, double timelineCurrentTime)
85 { 85 {
86 // We don't exactly know when new animations will start, but timelineCurrent Time is a good estimate. 86 // We don't exactly know when new animations will start, but timelineCurrent Time is a good estimate.
87 87
88 ActiveInterpolationMap result; 88 ActiveInterpolationMap result;
89 89
90 if (animationStack) { 90 if (animationStack) {
91 WillBeHeapVector<OwnPtrWillBeMember<SampledEffect>>& effects = animation Stack->m_effects; 91 HeapVector<Member<SampledEffect>>& effects = animationStack->m_effects;
92 // std::sort doesn't work with OwnPtrs 92 // std::sort doesn't work with OwnPtrs
93 nonCopyingSort(effects.begin(), effects.end(), compareEffects); 93 nonCopyingSort(effects.begin(), effects.end(), compareEffects);
94 animationStack->removeClearedEffects(); 94 animationStack->removeClearedEffects();
95 for (const auto& effect : effects) { 95 for (const auto& effect : effects) {
96 if (effect->priority() != priority || (suppressedAnimations && effec t->effect() && suppressedAnimations->contains(effect->effect()->animation()))) 96 if (effect->priority() != priority || (suppressedAnimations && effec t->effect() && suppressedAnimations->contains(effect->effect()->animation())))
97 continue; 97 continue;
98 copyToActiveInterpolationMap(effect->interpolations(), result); 98 copyToActiveInterpolationMap(effect->interpolations(), result);
99 } 99 }
100 } 100 }
101 101
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 FloatBox expandingBox(originalBox); 133 FloatBox expandingBox(originalBox);
134 if (!CompositorAnimations::instance()->getAnimatedBoundingBox(expand ingBox, *effect->model(), startRange, endRange)) 134 if (!CompositorAnimations::instance()->getAnimatedBoundingBox(expand ingBox, *effect->model(), startRange, endRange))
135 return false; 135 return false;
136 box.expandTo(expandingBox); 136 box.expandTo(expandingBox);
137 } 137 }
138 } 138 }
139 return true; 139 return true;
140 } 140 }
141 141
142 } // namespace blink 142 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/animation/AnimationStack.h ('k') | Source/core/animation/AnimationStackTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698