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

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: Rebased onto updated parent branch 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') | Source/core/frame/UseCounter.h » ('J')
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 21 matching lines...) Expand all
32 #include "core/animation/Animation.h" 32 #include "core/animation/Animation.h"
33 33
34 #include "bindings/v8/Dictionary.h" 34 #include "bindings/v8/Dictionary.h"
35 #include "core/animation/ActiveAnimations.h" 35 #include "core/animation/ActiveAnimations.h"
36 #include "core/animation/AnimationHelpers.h" 36 #include "core/animation/AnimationHelpers.h"
37 #include "core/animation/CompositorAnimations.h" 37 #include "core/animation/CompositorAnimations.h"
38 #include "core/animation/DocumentTimeline.h" 38 #include "core/animation/DocumentTimeline.h"
39 #include "core/animation/KeyframeEffectModel.h" 39 #include "core/animation/KeyframeEffectModel.h"
40 #include "core/animation/Player.h" 40 #include "core/animation/Player.h"
41 #include "core/dom/Element.h" 41 #include "core/dom/Element.h"
42 #include "core/frame/UseCounter.h"
42 #include "core/rendering/RenderLayer.h" 43 #include "core/rendering/RenderLayer.h"
43 44
44 namespace WebCore { 45 namespace WebCore {
45 46
46 PassRefPtr<Animation> Animation::create(PassRefPtr<Element> target, PassRefPtrWi llBeRawPtr<AnimationEffect> effect, const Timing& timing, Priority priority, Pas sOwnPtr<EventDelegate> eventDelegate) 47 PassRefPtr<Animation> Animation::create(PassRefPtr<Element> target, PassRefPtrWi llBeRawPtr<AnimationEffect> effect, const Timing& timing, Priority priority, Pas sOwnPtr<EventDelegate> eventDelegate)
47 { 48 {
48 return adoptRef(new Animation(target, effect, timing, priority, eventDelegat e)); 49 return adoptRef(new Animation(target, effect, timing, priority, eventDelegat e));
49 } 50 }
50 51
51 PassRefPtr<Animation> Animation::create(Element* element, PassRefPtrWillBeRawPtr <AnimationEffect> effect, const Dictionary& timingInputDictionary) 52 PassRefPtr<Animation> Animation::create(Element* element, PassRefPtrWillBeRawPtr <AnimationEffect> effect, const Dictionary& timingInputDictionary)
52 { 53 {
53 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); 54 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
54 return create(element, effect, TimingInput::convert(timingInputDictionary)); 55 return create(element, effect, TimingInput::convert(timingInputDictionary));
55 } 56 }
56 PassRefPtr<Animation> Animation::create(Element* element, PassRefPtrWillBeRawPtr <AnimationEffect> effect, double duration) 57 PassRefPtr<Animation> Animation::create(Element* element, PassRefPtrWillBeRawPtr <AnimationEffect> effect, double duration)
57 { 58 {
58 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); 59 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
59 return create(element, effect, TimingInput::convert(duration)); 60 return create(element, effect, TimingInput::convert(duration));
60 } 61 }
61 PassRefPtr<Animation> Animation::create(Element* element, PassRefPtrWillBeRawPtr <AnimationEffect> effect) 62 PassRefPtr<Animation> Animation::create(Element* element, PassRefPtrWillBeRawPtr <AnimationEffect> effect)
62 { 63 {
63 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); 64 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
64 return create(element, effect, Timing()); 65 return create(element, effect, Timing());
65 } 66 }
66 PassRefPtr<Animation> Animation::create(Element* element, const Vector<Dictionar y>& keyframeDictionaryVector, const Dictionary& timingInputDictionary) 67 PassRefPtr<Animation> Animation::create(Element* element, const Vector<Dictionar y>& keyframeDictionaryVector, const Dictionary& timingInputDictionary)
67 { 68 {
68 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); 69 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
70 UseCounter::count(element->document(), UseCounter::NewAnimationKeyframeListE ffectObjectTiming);
69 return create(element, EffectInput::convert(element, keyframeDictionaryVecto r), TimingInput::convert(timingInputDictionary)); 71 return create(element, EffectInput::convert(element, keyframeDictionaryVecto r), TimingInput::convert(timingInputDictionary));
70 } 72 }
71 PassRefPtr<Animation> Animation::create(Element* element, const Vector<Dictionar y>& keyframeDictionaryVector, double duration) 73 PassRefPtr<Animation> Animation::create(Element* element, const Vector<Dictionar y>& keyframeDictionaryVector, double duration)
72 { 74 {
73 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); 75 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
76 UseCounter::count(element->document(), UseCounter::NewAnimationKeyframeListE ffectDoubleTiming);
74 return create(element, EffectInput::convert(element, keyframeDictionaryVecto r), TimingInput::convert(duration)); 77 return create(element, EffectInput::convert(element, keyframeDictionaryVecto r), TimingInput::convert(duration));
75 } 78 }
76 PassRefPtr<Animation> Animation::create(Element* element, const Vector<Dictionar y>& keyframeDictionaryVector) 79 PassRefPtr<Animation> Animation::create(Element* element, const Vector<Dictionar y>& keyframeDictionaryVector)
77 { 80 {
78 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); 81 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
82 UseCounter::count(element->document(), UseCounter::NewAnimationKeyframeListE ffectNoTiming);
79 return create(element, EffectInput::convert(element, keyframeDictionaryVecto r), Timing()); 83 return create(element, EffectInput::convert(element, keyframeDictionaryVecto r), Timing());
80 } 84 }
81 85
82 Animation::Animation(PassRefPtr<Element> target, PassRefPtrWillBeRawPtr<Animatio nEffect> effect, const Timing& timing, Priority priority, PassOwnPtr<EventDelega te> eventDelegate) 86 Animation::Animation(PassRefPtr<Element> target, PassRefPtrWillBeRawPtr<Animatio nEffect> effect, const Timing& timing, Priority priority, PassOwnPtr<EventDelega te> eventDelegate)
83 : TimedItem(timing, eventDelegate) 87 : TimedItem(timing, eventDelegate)
84 , m_target(target) 88 , m_target(target)
85 , m_effect(effect) 89 , m_effect(effect)
86 , m_activeInAnimationStack(false) 90 , m_activeInAnimationStack(false)
87 , m_priority(priority) 91 , m_priority(priority)
88 { 92 {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 void Animation::pauseAnimationForTestingOnCompositor(double pauseTime) 244 void Animation::pauseAnimationForTestingOnCompositor(double pauseTime)
241 { 245 {
242 ASSERT(hasActiveAnimationsOnCompositor()); 246 ASSERT(hasActiveAnimationsOnCompositor());
243 if (!m_target || !m_target->renderer()) 247 if (!m_target || !m_target->renderer())
244 return; 248 return;
245 for (size_t i = 0; i < m_compositorAnimationIds.size(); ++i) 249 for (size_t i = 0; i < m_compositorAnimationIds.size(); ++i)
246 CompositorAnimations::instance()->pauseAnimationForTestingOnCompositor(* m_target.get(), m_compositorAnimationIds[i], pauseTime); 250 CompositorAnimations::instance()->pauseAnimationForTestingOnCompositor(* m_target.get(), m_compositorAnimationIds[i], pauseTime);
247 } 251 }
248 252
249 } // namespace WebCore 253 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/frame/UseCounter.h » ('j') | Source/core/frame/UseCounter.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698