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

Side by Side Diff: Source/core/animation/Animation.cpp

Issue 199743003: Web Animation API: Add use counter for Animation constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@APIUseCounter
Patch Set: Fixed bad rebase Created 6 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
« no previous file with comments | « no previous file | Source/core/frame/UseCounter.h » ('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 23 matching lines...) Expand all
34 #include "bindings/v8/Dictionary.h" 34 #include "bindings/v8/Dictionary.h"
35 #include "bindings/v8/ExceptionState.h" 35 #include "bindings/v8/ExceptionState.h"
36 #include "core/animation/ActiveAnimations.h" 36 #include "core/animation/ActiveAnimations.h"
37 #include "core/animation/AnimationHelpers.h" 37 #include "core/animation/AnimationHelpers.h"
38 #include "core/animation/AnimationPlayer.h" 38 #include "core/animation/AnimationPlayer.h"
39 #include "core/animation/CompositorAnimations.h" 39 #include "core/animation/CompositorAnimations.h"
40 #include "core/animation/DocumentTimeline.h" 40 #include "core/animation/DocumentTimeline.h"
41 #include "core/animation/Interpolation.h" 41 #include "core/animation/Interpolation.h"
42 #include "core/animation/KeyframeEffectModel.h" 42 #include "core/animation/KeyframeEffectModel.h"
43 #include "core/dom/Element.h" 43 #include "core/dom/Element.h"
44 #include "core/frame/UseCounter.h"
44 #include "core/rendering/RenderLayer.h" 45 #include "core/rendering/RenderLayer.h"
45 46
46 namespace WebCore { 47 namespace WebCore {
47 48
48 PassRefPtr<Animation> Animation::create(PassRefPtr<Element> target, PassRefPtrWi llBeRawPtr<AnimationEffect> effect, const Timing& timing, Priority priority, Pas sOwnPtr<EventDelegate> eventDelegate) 49 PassRefPtr<Animation> Animation::create(PassRefPtr<Element> target, PassRefPtrWi llBeRawPtr<AnimationEffect> effect, const Timing& timing, Priority priority, Pas sOwnPtr<EventDelegate> eventDelegate)
49 { 50 {
50 return adoptRef(new Animation(target, effect, timing, priority, eventDelegat e)); 51 return adoptRef(new Animation(target, effect, timing, priority, eventDelegat e));
51 } 52 }
52 53
53 PassRefPtr<Animation> Animation::create(Element* element, PassRefPtrWillBeRawPtr <AnimationEffect> effect, const Dictionary& timingInputDictionary) 54 PassRefPtr<Animation> Animation::create(Element* element, PassRefPtrWillBeRawPtr <AnimationEffect> effect, const Dictionary& timingInputDictionary)
54 { 55 {
55 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); 56 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
56 return create(element, effect, TimingInput::convert(timingInputDictionary)); 57 return create(element, effect, TimingInput::convert(timingInputDictionary));
57 } 58 }
58 PassRefPtr<Animation> Animation::create(Element* element, PassRefPtrWillBeRawPtr <AnimationEffect> effect, double duration) 59 PassRefPtr<Animation> Animation::create(Element* element, PassRefPtrWillBeRawPtr <AnimationEffect> effect, double duration)
59 { 60 {
60 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); 61 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
61 return create(element, effect, TimingInput::convert(duration)); 62 return create(element, effect, TimingInput::convert(duration));
62 } 63 }
63 PassRefPtr<Animation> Animation::create(Element* element, PassRefPtrWillBeRawPtr <AnimationEffect> effect) 64 PassRefPtr<Animation> Animation::create(Element* element, PassRefPtrWillBeRawPtr <AnimationEffect> effect)
64 { 65 {
65 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); 66 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
66 return create(element, effect, Timing()); 67 return create(element, effect, Timing());
67 } 68 }
68 PassRefPtr<Animation> Animation::create(Element* element, const Vector<Dictionar y>& keyframeDictionaryVector, const Dictionary& timingInputDictionary, Exception State& exceptionState) 69 PassRefPtr<Animation> Animation::create(Element* element, const Vector<Dictionar y>& keyframeDictionaryVector, const Dictionary& timingInputDictionary, Exception State& exceptionState)
69 { 70 {
70 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); 71 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
72 UseCounter::count(element->document(), UseCounter::AnimationConstructorKeyfr ameListEffectObjectTiming);
71 return create(element, EffectInput::convert(element, keyframeDictionaryVecto r, exceptionState), TimingInput::convert(timingInputDictionary)); 73 return create(element, EffectInput::convert(element, keyframeDictionaryVecto r, exceptionState), TimingInput::convert(timingInputDictionary));
72 } 74 }
73 PassRefPtr<Animation> Animation::create(Element* element, const Vector<Dictionar y>& keyframeDictionaryVector, double duration, ExceptionState& exceptionState) 75 PassRefPtr<Animation> Animation::create(Element* element, const Vector<Dictionar y>& keyframeDictionaryVector, double duration, ExceptionState& exceptionState)
74 { 76 {
75 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); 77 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
78 UseCounter::count(element->document(), UseCounter::AnimationConstructorKeyfr ameListEffectDoubleTiming);
76 return create(element, EffectInput::convert(element, keyframeDictionaryVecto r, exceptionState), TimingInput::convert(duration)); 79 return create(element, EffectInput::convert(element, keyframeDictionaryVecto r, exceptionState), TimingInput::convert(duration));
77 } 80 }
78 PassRefPtr<Animation> Animation::create(Element* element, const Vector<Dictionar y>& keyframeDictionaryVector, ExceptionState& exceptionState) 81 PassRefPtr<Animation> Animation::create(Element* element, const Vector<Dictionar y>& keyframeDictionaryVector, ExceptionState& exceptionState)
79 { 82 {
80 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); 83 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
84 UseCounter::count(element->document(), UseCounter::AnimationConstructorKeyfr ameListEffectNoTiming);
81 return create(element, EffectInput::convert(element, keyframeDictionaryVecto r, exceptionState), Timing()); 85 return create(element, EffectInput::convert(element, keyframeDictionaryVecto r, exceptionState), Timing());
82 } 86 }
83 87
84 Animation::Animation(PassRefPtr<Element> target, PassRefPtrWillBeRawPtr<Animatio nEffect> effect, const Timing& timing, Priority priority, PassOwnPtr<EventDelega te> eventDelegate) 88 Animation::Animation(PassRefPtr<Element> target, PassRefPtrWillBeRawPtr<Animatio nEffect> effect, const Timing& timing, Priority priority, PassOwnPtr<EventDelega te> eventDelegate)
85 : TimedItem(timing, eventDelegate) 89 : TimedItem(timing, eventDelegate)
86 , m_target(target) 90 , m_target(target)
87 , m_effect(effect) 91 , m_effect(effect)
88 , m_activeInAnimationStack(false) 92 , m_activeInAnimationStack(false)
89 , m_priority(priority) 93 , m_priority(priority)
90 { 94 {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 void Animation::pauseAnimationForTestingOnCompositor(double pauseTime) 246 void Animation::pauseAnimationForTestingOnCompositor(double pauseTime)
243 { 247 {
244 ASSERT(hasActiveAnimationsOnCompositor()); 248 ASSERT(hasActiveAnimationsOnCompositor());
245 if (!m_target || !m_target->renderer()) 249 if (!m_target || !m_target->renderer())
246 return; 250 return;
247 for (size_t i = 0; i < m_compositorAnimationIds.size(); ++i) 251 for (size_t i = 0; i < m_compositorAnimationIds.size(); ++i)
248 CompositorAnimations::instance()->pauseAnimationForTestingOnCompositor(* m_target.get(), m_compositorAnimationIds[i], pauseTime); 252 CompositorAnimations::instance()->pauseAnimationForTestingOnCompositor(* m_target.get(), m_compositorAnimationIds[i], pauseTime);
249 } 253 }
250 254
251 } // namespace WebCore 255 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698