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

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

Issue 1653043002: Remove Sparse Histograms from Blink Platform API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_blink_histograms
Patch Set: Fix android code path Created 4 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
« no previous file with comments | « content/child/blink_platform_impl.cc ('k') | third_party/WebKit/Source/core/dom/Document.cpp » ('j') | 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "core/css/resolver/CSSToStyleMap.h" 46 #include "core/css/resolver/CSSToStyleMap.h"
47 #include "core/css/resolver/StyleResolver.h" 47 #include "core/css/resolver/StyleResolver.h"
48 #include "core/dom/Element.h" 48 #include "core/dom/Element.h"
49 #include "core/dom/PseudoElement.h" 49 #include "core/dom/PseudoElement.h"
50 #include "core/dom/StyleEngine.h" 50 #include "core/dom/StyleEngine.h"
51 #include "core/events/AnimationEvent.h" 51 #include "core/events/AnimationEvent.h"
52 #include "core/events/TransitionEvent.h" 52 #include "core/events/TransitionEvent.h"
53 #include "core/frame/UseCounter.h" 53 #include "core/frame/UseCounter.h"
54 #include "core/layout/LayoutObject.h" 54 #include "core/layout/LayoutObject.h"
55 #include "core/paint/PaintLayer.h" 55 #include "core/paint/PaintLayer.h"
56 #include "platform/Histogram.h"
56 #include "platform/animation/TimingFunction.h" 57 #include "platform/animation/TimingFunction.h"
57 #include "public/platform/Platform.h" 58 #include "public/platform/Platform.h"
58 #include "wtf/BitArray.h" 59 #include "wtf/BitArray.h"
59 #include "wtf/HashSet.h" 60 #include "wtf/HashSet.h"
60 #include <algorithm> 61 #include <algorithm>
61 62
62 namespace blink { 63 namespace blink {
63 64
64 using PropertySet = HashSet<CSSPropertyID>; 65 using PropertySet = HashSet<CSSPropertyID>;
65 66
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 keyframe->setCSSPropertyValue(property, properties.propertyAt(j) .value()); 110 keyframe->setCSSPropertyValue(property, properties.propertyAt(j) .value());
110 } 111 }
111 } 112 }
112 keyframes.append(keyframe); 113 keyframes.append(keyframe);
113 // The last keyframe specified at a given offset is used. 114 // The last keyframe specified at a given offset is used.
114 for (size_t j = 1; j < offsets.size(); ++j) { 115 for (size_t j = 1; j < offsets.size(); ++j) {
115 keyframes.append(toStringKeyframe(keyframe->cloneWithOffset(offsets[ j]).get())); 116 keyframes.append(toStringKeyframe(keyframe->cloneWithOffset(offsets[ j]).get()));
116 } 117 }
117 } 118 }
118 119
120 DEFINE_STATIC_LOCAL(SparseHistogram, propertyHistogram, ("WebCore.Animation. CSSProperties"));
119 for (CSSPropertyID property : specifiedPropertiesForUseCounter) { 121 for (CSSPropertyID property : specifiedPropertiesForUseCounter) {
120 ASSERT(property != CSSPropertyInvalid); 122 ASSERT(property != CSSPropertyInvalid);
121 Platform::current()->histogramSparse("WebCore.Animation.CSSProperties", UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(property)); 123 propertyHistogram.sample(UseCounter::mapCSSPropertyIdToCSSSampleIdForHis togram(property));
122 } 124 }
123 125
124 // Merge duplicate keyframes. 126 // Merge duplicate keyframes.
125 std::stable_sort(keyframes.begin(), keyframes.end(), Keyframe::compareOffset s); 127 std::stable_sort(keyframes.begin(), keyframes.end(), Keyframe::compareOffset s);
126 size_t targetIndex = 0; 128 size_t targetIndex = 0;
127 for (size_t i = 1; i < keyframes.size(); i++) { 129 for (size_t i = 1; i < keyframes.size(); i++) {
128 if (keyframes[i]->offset() == keyframes[targetIndex]->offset()) { 130 if (keyframes[i]->offset() == keyframes[targetIndex]->offset()) {
129 for (const auto& property : keyframes[i]->properties()) 131 for (const auto& property : keyframes[i]->properties())
130 keyframes[targetIndex]->setCSSPropertyValue(property.cssProperty (), keyframes[i]->cssPropertyValue(property.cssProperty())); 132 keyframes[targetIndex]->setCSSPropertyValue(property.cssProperty (), keyframes[i]->cssPropertyValue(property.cssProperty()));
131 } else { 133 } else {
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 KeyframeEffect* transition = KeyframeEffect::create(element, model, iner tAnimation->specifiedTiming(), KeyframeEffect::TransitionPriority, eventDelegate ); 485 KeyframeEffect* transition = KeyframeEffect::create(element, model, iner tAnimation->specifiedTiming(), KeyframeEffect::TransitionPriority, eventDelegate );
484 transition->setName(getPropertyName(newTransition.id)); 486 transition->setName(getPropertyName(newTransition.id));
485 Animation* animation = element->document().timeline().play(transition); 487 Animation* animation = element->document().timeline().play(transition);
486 // Set the current time as the start time for retargeted transitions 488 // Set the current time as the start time for retargeted transitions
487 if (retargetedCompositorTransitions.contains(id)) 489 if (retargetedCompositorTransitions.contains(id))
488 animation->setStartTime(element->document().timeline().currentTime() ); 490 animation->setStartTime(element->document().timeline().currentTime() );
489 animation->update(TimingUpdateOnDemand); 491 animation->update(TimingUpdateOnDemand);
490 runningTransition.animation = animation; 492 runningTransition.animation = animation;
491 m_transitions.set(id, runningTransition); 493 m_transitions.set(id, runningTransition);
492 ASSERT(id != CSSPropertyInvalid); 494 ASSERT(id != CSSPropertyInvalid);
493 Platform::current()->histogramSparse("WebCore.Animation.CSSProperties", UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(id)); 495
496 DEFINE_STATIC_LOCAL(SparseHistogram, propertyHistogram, ("WebCore.Animat ion.CSSProperties"));
497 propertyHistogram.sample(UseCounter::mapCSSPropertyIdToCSSSampleIdForHis togram(id));
Alexei Svitkine (slow) 2016/02/01 21:30:31 Perhaps there should be a macro that wraps the ext
494 } 498 }
495 clearPendingUpdate(); 499 clearPendingUpdate();
496 } 500 }
497 501
498 void CSSAnimations::calculateTransitionUpdateForProperty(CSSPropertyID id, const CSSTransitionData& transitionData, size_t transitionIndex, const ComputedStyle& oldStyle, const ComputedStyle& style, const TransitionMap* activeTransitions, C SSAnimationUpdate& update, const Element* element) 502 void CSSAnimations::calculateTransitionUpdateForProperty(CSSPropertyID id, const CSSTransitionData& transitionData, size_t transitionIndex, const ComputedStyle& oldStyle, const ComputedStyle& style, const TransitionMap* activeTransitions, C SSAnimationUpdate& update, const Element* element)
499 { 503 {
500 RefPtr<AnimatableValue> to = nullptr; 504 RefPtr<AnimatableValue> to = nullptr;
501 if (activeTransitions) { 505 if (activeTransitions) {
502 TransitionMap::const_iterator activeTransitionIter = activeTransitions-> find(id); 506 TransitionMap::const_iterator activeTransitionIter = activeTransitions-> find(id);
503 if (activeTransitionIter != activeTransitions->end()) { 507 if (activeTransitionIter != activeTransitions->end()) {
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 } 842 }
839 843
840 DEFINE_TRACE(CSSAnimations) 844 DEFINE_TRACE(CSSAnimations)
841 { 845 {
842 visitor->trace(m_transitions); 846 visitor->trace(m_transitions);
843 visitor->trace(m_pendingUpdate); 847 visitor->trace(m_pendingUpdate);
844 visitor->trace(m_runningAnimations); 848 visitor->trace(m_runningAnimations);
845 } 849 }
846 850
847 } // namespace blink 851 } // namespace blink
OLDNEW
« no previous file with comments | « content/child/blink_platform_impl.cc ('k') | third_party/WebKit/Source/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698