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

Side by Side Diff: third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp

Issue 2620303002: Refactor how UseCounter::SyntheticKeyframesInCompositedCSSAnimation is counted (Closed)
Patch Set: g cl set-commit Created 3 years, 11 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 | « third_party/WebKit/Source/core/animation/animatable/AnimatableValueKeyframe.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 /* 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 if (endKeyframe->offset() != 1) { 165 if (endKeyframe->offset() != 1) {
166 endKeyframe = StringKeyframe::create(); 166 endKeyframe = StringKeyframe::create();
167 endKeyframe->setOffset(1); 167 endKeyframe->setOffset(1);
168 endKeyframe->setEasing(defaultTimingFunction); 168 endKeyframe->setEasing(defaultTimingFunction);
169 keyframes.push_back(endKeyframe); 169 keyframes.push_back(endKeyframe);
170 } 170 }
171 DCHECK_GE(keyframes.size(), 2U); 171 DCHECK_GE(keyframes.size(), 2U);
172 DCHECK(!keyframes.front()->offset()); 172 DCHECK(!keyframes.front()->offset());
173 DCHECK_EQ(keyframes.back()->offset(), 1); 173 DCHECK_EQ(keyframes.back()->offset(), 1);
174 174
175 // This is used for use counting neutral keyframes running on the compositor.
176 PropertySet allProperties;
177 for (const auto& keyframe : keyframes) {
178 for (const auto& property : keyframe->properties())
179 allProperties.add(property.cssProperty());
180 }
181 const PropertyHandleSet& startKeyframeProperties =
182 startKeyframe->properties();
183 const PropertyHandleSet& endKeyframeProperties = endKeyframe->properties();
184 bool missingStartValues =
185 startKeyframeProperties.size() < allProperties.size();
186 bool missingEndValues = endKeyframeProperties.size() < allProperties.size();
187 if (missingStartValues || missingEndValues) {
188 for (CSSPropertyID property : allProperties) {
189 bool startNeedsValue =
190 missingStartValues &&
191 !startKeyframeProperties.contains(PropertyHandle(property));
192 bool endNeedsValue =
193 missingEndValues &&
194 !endKeyframeProperties.contains(PropertyHandle(property));
195 if (!startNeedsValue && !endNeedsValue)
196 continue;
197 if (CompositorAnimations::isCompositableProperty(property))
198 UseCounter::count(
199 elementForScoping->document(),
200 UseCounter::SyntheticKeyframesInCompositedCSSAnimation);
201 }
202 }
203
204 StringKeyframeEffectModel* model = 175 StringKeyframeEffectModel* model =
205 StringKeyframeEffectModel::create(keyframes, &keyframes[0]->easing()); 176 StringKeyframeEffectModel::create(keyframes, &keyframes[0]->easing());
206 if (animationIndex > 0 && model->hasSyntheticKeyframes()) 177 if (animationIndex > 0 && model->hasSyntheticKeyframes())
207 UseCounter::count(elementForScoping->document(), 178 UseCounter::count(elementForScoping->document(),
208 UseCounter::CSSAnimationsStackedNeutralKeyframe); 179 UseCounter::CSSAnimationsStackedNeutralKeyframe);
209 return model; 180 return model;
210 } 181 }
211 182
212 } // namespace 183 } // namespace
213 184
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 isCustomPropertyHandle); 1068 isCustomPropertyHandle);
1098 } 1069 }
1099 1070
1100 DEFINE_TRACE(CSSAnimations) { 1071 DEFINE_TRACE(CSSAnimations) {
1101 visitor->trace(m_transitions); 1072 visitor->trace(m_transitions);
1102 visitor->trace(m_pendingUpdate); 1073 visitor->trace(m_pendingUpdate);
1103 visitor->trace(m_runningAnimations); 1074 visitor->trace(m_runningAnimations);
1104 } 1075 }
1105 1076
1106 } // namespace blink 1077 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/animation/animatable/AnimatableValueKeyframe.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698