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

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

Issue 425903003: Use HeapHashCountedSet for AnimationPlayerCountedSet (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/animation/ActiveAnimations.h ('k') | Source/core/animation/Animation.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 26 matching lines...) Expand all
37 37
38 ActiveAnimations::~ActiveAnimations() 38 ActiveAnimations::~ActiveAnimations()
39 { 39 {
40 #if !ENABLE(OILPAN) 40 #if !ENABLE(OILPAN)
41 for (size_t i = 0; i < m_animations.size(); ++i) 41 for (size_t i = 0; i < m_animations.size(); ++i)
42 m_animations[i]->notifyElementDestroyed(); 42 m_animations[i]->notifyElementDestroyed();
43 m_animations.clear(); 43 m_animations.clear();
44 #endif 44 #endif
45 } 45 }
46 46
47 void ActiveAnimations::addPlayer(AnimationPlayer* player)
48 {
49 ++m_players.add(player, 0).storedValue->value;
50 }
51
52 void ActiveAnimations::removePlayer(AnimationPlayer* player)
53 {
54 AnimationPlayerCountedSet::iterator it = m_players.find(player);
55 ASSERT(it != m_players.end());
56 ASSERT(it->value > 0);
57 --it->value;
58 if (!it->value)
59 m_players.remove(it);
60 }
61
62 void ActiveAnimations::updateAnimationFlags(RenderStyle& style) 47 void ActiveAnimations::updateAnimationFlags(RenderStyle& style)
63 { 48 {
64 for (AnimationPlayerCountedSet::const_iterator it = m_players.begin(); it != m_players.end(); ++it) { 49 for (AnimationPlayerCountedSet::const_iterator it = m_players.begin(); it != m_players.end(); ++it) {
65 const AnimationPlayer& player = *it->key; 50 const AnimationPlayer& player = *it->key;
66 ASSERT(player.source()); 51 ASSERT(player.source());
67 // FIXME: Needs to consider AnimationGroup once added. 52 // FIXME: Needs to consider AnimationGroup once added.
68 ASSERT(player.source()->isAnimation()); 53 ASSERT(player.source()->isAnimation());
69 const Animation& animation = *toAnimation(player.source()); 54 const Animation& animation = *toAnimation(player.source());
70 if (animation.isCurrent()) { 55 if (animation.isCurrent()) {
71 if (animation.affects(CSSPropertyOpacity)) 56 if (animation.affects(CSSPropertyOpacity))
(...skipping 22 matching lines...) Expand all
94 void ActiveAnimations::trace(Visitor* visitor) 79 void ActiveAnimations::trace(Visitor* visitor)
95 { 80 {
96 #if ENABLE(OILPAN) 81 #if ENABLE(OILPAN)
97 visitor->trace(m_cssAnimations); 82 visitor->trace(m_cssAnimations);
98 visitor->trace(m_defaultStack); 83 visitor->trace(m_defaultStack);
99 visitor->trace(m_players); 84 visitor->trace(m_players);
100 #endif 85 #endif
101 } 86 }
102 87
103 } // namespace blink 88 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/animation/ActiveAnimations.h ('k') | Source/core/animation/Animation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698