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

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: Include non-animatable properties in use counter for CSSAnimations. 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 8ee3e8d673d1e2b7b1a0c71e48594f536d5e8fae..e5f13996dabe1e3d42895085b3a689eeebcfbbab 100644
--- a/Source/core/animation/css/CSSAnimations.cpp
+++ b/Source/core/animation/css/CSSAnimations.cpp
@@ -43,9 +43,11 @@
#include "core/events/TransitionEvent.h"
#include "core/events/WebKitAnimationEvent.h"
#include "core/frame/animation/CSSPropertyAnimation.h"
+#include "core/page/UseCounter.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 {
@@ -307,6 +309,7 @@ void CSSAnimations::resolveKeyframes(Element* element, const RenderStyle* style,
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) {
@@ -320,6 +323,7 @@ void CSSAnimations::resolveKeyframes(Element* element, const RenderStyle* style,
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);
@@ -340,6 +344,13 @@ void CSSAnimations::resolveKeyframes(Element* element, const RenderStyle* style,
if (!perKeyframeTimingFunctions.contains(0))
perKeyframeTimingFunctions.set(0, defaultTimingFunction);
+ // Update use counter.
dstockwell 2013/11/05 22:54:18 This comment is not necessary.
rjwright1 2013/11/11 12:18:25 Done.
+ for (PropertySet::const_iterator iter = specifiedProperties.begin(); iter != specifiedProperties.end(); ++iter) {
+ const CSSPropertyID property = *iter;
+ ASSERT(property != CSSPropertyInvalid);
+ WebKit::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;
@@ -592,6 +603,8 @@ void CSSAnimations::maybeApplyPendingUpdate(Element* element)
element->document().transitionTimeline()->play(transition.get());
runningTransition.transition = transition.get();
m_transitions.set(id, runningTransition);
+ ASSERT(id != CSSPropertyInvalid);
+ WebKit::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