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

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 on top of crrev.com/2701353002 Created 3 years, 10 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 for (size_t j = 1; j < offsets.size(); ++j) { 124 for (size_t j = 1; j < offsets.size(); ++j) {
125 keyframes.push_back( 125 keyframes.push_back(
126 toStringKeyframe(keyframe->cloneWithOffset(offsets[j]).get())); 126 toStringKeyframe(keyframe->cloneWithOffset(offsets[j]).get()));
127 } 127 }
128 } 128 }
129 129
130 DEFINE_STATIC_LOCAL(SparseHistogram, propertyHistogram, 130 DEFINE_STATIC_LOCAL(SparseHistogram, propertyHistogram,
131 ("WebCore.Animation.CSSProperties")); 131 ("WebCore.Animation.CSSProperties"));
132 for (CSSPropertyID property : specifiedPropertiesForUseCounter) { 132 for (CSSPropertyID property : specifiedPropertiesForUseCounter) {
133 DCHECK(isValidCSSPropertyID(property)); 133 DCHECK(isValidCSSPropertyID(property));
134 UseCounter::countAnimatedCSS(elementForScoping->document(), property);
135
136 // TODO(crbug.com/458925): Remove legacy histogram and counts
134 propertyHistogram.sample( 137 propertyHistogram.sample(
135 UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(property)); 138 UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(property));
136 } 139 }
137 140
138 // Merge duplicate keyframes. 141 // Merge duplicate keyframes.
139 std::stable_sort(keyframes.begin(), keyframes.end(), 142 std::stable_sort(keyframes.begin(), keyframes.end(),
140 Keyframe::compareOffsets); 143 Keyframe::compareOffsets);
141 size_t targetIndex = 0; 144 size_t targetIndex = 0;
142 for (size_t i = 1; i < keyframes.size(); i++) { 145 for (size_t i = 1; i < keyframes.size(); i++) {
143 if (keyframes[i]->offset() == keyframes[targetIndex]->offset()) { 146 if (keyframes[i]->offset() == keyframes[targetIndex]->offset()) {
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 KeyframeEffectReadOnly::TransitionPriority, eventDelegate); 587 KeyframeEffectReadOnly::TransitionPriority, eventDelegate);
585 Animation* animation = element->document().timeline().play(transition); 588 Animation* animation = element->document().timeline().play(transition);
586 animation->setId(getPropertyName(newTransition.id)); 589 animation->setId(getPropertyName(newTransition.id));
587 // Set the current time as the start time for retargeted transitions 590 // Set the current time as the start time for retargeted transitions
588 if (retargetedCompositorTransitions.contains(id)) 591 if (retargetedCompositorTransitions.contains(id))
589 animation->setStartTime(element->document().timeline().currentTime()); 592 animation->setStartTime(element->document().timeline().currentTime());
590 animation->update(TimingUpdateOnDemand); 593 animation->update(TimingUpdateOnDemand);
591 runningTransition.animation = animation; 594 runningTransition.animation = animation;
592 m_transitions.set(id, runningTransition); 595 m_transitions.set(id, runningTransition);
593 DCHECK(isValidCSSPropertyID(id)); 596 DCHECK(isValidCSSPropertyID(id));
597 UseCounter::countAnimatedCSS(element->document(), id);
594 598
599 // TODO(crbug.com/458925): Remove legacy histogram and counts
595 DEFINE_STATIC_LOCAL(SparseHistogram, propertyHistogram, 600 DEFINE_STATIC_LOCAL(SparseHistogram, propertyHistogram,
596 ("WebCore.Animation.CSSProperties")); 601 ("WebCore.Animation.CSSProperties"));
597 propertyHistogram.sample( 602 propertyHistogram.sample(
598 UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(id)); 603 UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(id));
599 } 604 }
600 clearPendingUpdate(); 605 clearPendingUpdate();
601 } 606 }
602 607
603 void CSSAnimations::calculateTransitionUpdateForProperty( 608 void CSSAnimations::calculateTransitionUpdateForProperty(
604 CSSPropertyID id, 609 CSSPropertyID id,
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 isCustomPropertyHandle); 1073 isCustomPropertyHandle);
1069 } 1074 }
1070 1075
1071 DEFINE_TRACE(CSSAnimations) { 1076 DEFINE_TRACE(CSSAnimations) {
1072 visitor->trace(m_transitions); 1077 visitor->trace(m_transitions);
1073 visitor->trace(m_pendingUpdate); 1078 visitor->trace(m_pendingUpdate);
1074 visitor->trace(m_runningAnimations); 1079 visitor->trace(m_runningAnimations);
1075 } 1080 }
1076 1081
1077 } // namespace blink 1082 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698