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

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

Issue 2678143003: Move CSS animations use counters to UseCounter (Closed)
Patch Set: Rebase incl FrameHost->Page change, tweak test Created 3 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
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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 for (size_t j = 1; j < offsets.size(); ++j) { 127 for (size_t j = 1; j < offsets.size(); ++j) {
128 keyframes.push_back( 128 keyframes.push_back(
129 toStringKeyframe(keyframe->cloneWithOffset(offsets[j]).get())); 129 toStringKeyframe(keyframe->cloneWithOffset(offsets[j]).get()));
130 } 130 }
131 } 131 }
132 132
133 DEFINE_STATIC_LOCAL(SparseHistogram, propertyHistogram, 133 DEFINE_STATIC_LOCAL(SparseHistogram, propertyHistogram,
134 ("WebCore.Animation.CSSProperties")); 134 ("WebCore.Animation.CSSProperties"));
135 for (CSSPropertyID property : specifiedPropertiesForUseCounter) { 135 for (CSSPropertyID property : specifiedPropertiesForUseCounter) {
136 DCHECK(isValidCSSPropertyID(property)); 136 DCHECK(isValidCSSPropertyID(property));
137 UseCounter::countAnimatedCSS(elementForScoping->document(), property);
138
139 // TODO(crbug.com/458925): Remove legacy histogram and counts
137 propertyHistogram.sample( 140 propertyHistogram.sample(
138 UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(property)); 141 UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(property));
139 } 142 }
140 143
141 // Merge duplicate keyframes. 144 // Merge duplicate keyframes.
142 std::stable_sort(keyframes.begin(), keyframes.end(), 145 std::stable_sort(keyframes.begin(), keyframes.end(),
143 Keyframe::compareOffsets); 146 Keyframe::compareOffsets);
144 size_t targetIndex = 0; 147 size_t targetIndex = 0;
145 for (size_t i = 1; i < keyframes.size(); i++) { 148 for (size_t i = 1; i < keyframes.size(); i++) {
146 if (keyframes[i]->offset() == keyframes[targetIndex]->offset()) { 149 if (keyframes[i]->offset() == keyframes[targetIndex]->offset()) {
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 } else { 598 } else {
596 animation->setId(getPropertyName(property.cssProperty())); 599 animation->setId(getPropertyName(property.cssProperty()));
597 } 600 }
598 // Set the current time as the start time for retargeted transitions 601 // Set the current time as the start time for retargeted transitions
599 if (retargetedCompositorTransitions.contains(property)) 602 if (retargetedCompositorTransitions.contains(property))
600 animation->setStartTime(element->document().timeline().currentTime()); 603 animation->setStartTime(element->document().timeline().currentTime());
601 animation->update(TimingUpdateOnDemand); 604 animation->update(TimingUpdateOnDemand);
602 runningTransition.animation = animation; 605 runningTransition.animation = animation;
603 m_transitions.set(property, runningTransition); 606 m_transitions.set(property, runningTransition);
604 DCHECK(isValidCSSPropertyID(property.cssProperty())); 607 DCHECK(isValidCSSPropertyID(property.cssProperty()));
608 UseCounter::countAnimatedCSS(element->document(), property.cssProperty());
605 609
610 // TODO(crbug.com/458925): Remove legacy histogram and counts
606 DEFINE_STATIC_LOCAL(SparseHistogram, propertyHistogram, 611 DEFINE_STATIC_LOCAL(SparseHistogram, propertyHistogram,
607 ("WebCore.Animation.CSSProperties")); 612 ("WebCore.Animation.CSSProperties"));
608 propertyHistogram.sample( 613 propertyHistogram.sample(
609 UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram( 614 UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(
610 property.cssProperty())); 615 property.cssProperty()));
611 } 616 }
612 clearPendingUpdate(); 617 clearPendingUpdate();
613 } 618 }
614 619
615 void CSSAnimations::calculateTransitionUpdateForProperty( 620 void CSSAnimations::calculateTransitionUpdateForProperty(
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 isCustomPropertyHandle); 1135 isCustomPropertyHandle);
1131 } 1136 }
1132 1137
1133 DEFINE_TRACE(CSSAnimations) { 1138 DEFINE_TRACE(CSSAnimations) {
1134 visitor->trace(m_transitions); 1139 visitor->trace(m_transitions);
1135 visitor->trace(m_pendingUpdate); 1140 visitor->trace(m_pendingUpdate);
1136 visitor->trace(m_runningAnimations); 1141 visitor->trace(m_runningAnimations);
1137 } 1142 }
1138 1143
1139 } // namespace blink 1144 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698