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

Unified Diff: Source/core/animation/css/CSSAnimations.cpp

Issue 57683002: Web Animations CSS: Add use counter analytics to CSSAnimations. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@MoveKeyframeStyleResovler
Patch Set: Rebased onto new local changes Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/css/CSSAnimations.cpp
diff --git a/Source/core/animation/css/CSSAnimations.cpp b/Source/core/animation/css/CSSAnimations.cpp
index 17a5da55ba5131531649d59395ade00081884fc1..1b5b96b2638cafc4972baccbfd642cbfce3fc142 100644
--- a/Source/core/animation/css/CSSAnimations.cpp
+++ b/Source/core/animation/css/CSSAnimations.cpp
@@ -42,10 +42,12 @@
#include "core/events/ThreadLocalEventNames.h"
#include "core/events/TransitionEvent.h"
#include "core/events/WebKitAnimationEvent.h"
+#include "core/frame/UseCounter.h"
#include "core/frame/animation/CSSPropertyAnimation.h"
#include "core/platform/animation/CSSAnimationDataList.h"
#include "core/platform/animation/TimingFunction.h"
#include "core/rendering/style/KeyframeList.h"
+#include "public/platform/Platform.h"
#include "wtf/HashSet.h"
namespace WebCore {
@@ -253,6 +255,7 @@ static void resolveKeyframes(StyleResolver* resolver, Element* element, const Re
return;
// Construct and populate the style for each keyframe
+ PropertySet specifiedProperties;
KeyframeAnimationEffect::KeyframeVector keyframes;
HashMap<double, RefPtr<TimingFunction> > perKeyframeTimingFunctions;
for (size_t i = 0; i < styleKeyframes.size(); ++i) {
@@ -266,6 +269,7 @@ static void resolveKeyframes(StyleResolver* resolver, Element* element, const Re
const StylePropertySet* properties = styleKeyframe->properties();
for (unsigned j = 0; j < properties->propertyCount(); j++) {
CSSPropertyID property = properties->propertyAt(j).id();
+ specifiedProperties.add(property);
if (property == CSSPropertyWebkitAnimationTimingFunction || property == CSSPropertyAnimationTimingFunction) {
// FIXME: This sometimes gets the wrong timing function. See crbug.com/288540.
timingFunction = KeyframeValue::timingFunction(keyframeStyle.get(), name);
@@ -286,6 +290,12 @@ static void resolveKeyframes(StyleResolver* resolver, Element* element, const Re
if (!perKeyframeTimingFunctions.contains(0))
perKeyframeTimingFunctions.set(0, defaultTimingFunction);
+ for (PropertySet::const_iterator iter = specifiedProperties.begin(); iter != specifiedProperties.end(); ++iter) {
+ const CSSPropertyID property = *iter;
+ ASSERT(property != CSSPropertyInvalid);
+ blink::Platform::current()->histogramSparse("WebCore.Animation.CSSProperties", UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(property));
+ }
+
// Remove duplicate keyframes. In CSS the last keyframe at a given offset takes priority.
std::stable_sort(keyframes.begin(), keyframes.end(), Keyframe::compareOffsets);
size_t targetIndex = 0;
@@ -538,6 +548,8 @@ void CSSAnimations::maybeApplyPendingUpdate(Element* element)
element->document().transitionTimeline()->play(transition.get());
runningTransition.transition = transition.get();
m_transitions.set(id, runningTransition);
+ ASSERT(id != CSSPropertyInvalid);
+ blink::Platform::current()->histogramSparse("WebCore.Animation.CSSProperties", UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(id));
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698