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

Side by Side Diff: Source/core/svg/properties/SVGAnimatedProperty.cpp

Issue 180243018: Remove SVGAnimatedProperty::animatedPropertyCache (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 23 matching lines...) Expand all
34 { 34 {
35 contextElement->setContextElement(); 35 contextElement->setContextElement();
36 } 36 }
37 37
38 SVGAnimatedProperty::~SVGAnimatedProperty() 38 SVGAnimatedProperty::~SVGAnimatedProperty()
39 { 39 {
40 // Assure that animationEnded() was called, if animationStarted() was called before. 40 // Assure that animationEnded() was called, if animationStarted() was called before.
41 ASSERT(!m_isAnimating); 41 ASSERT(!m_isAnimating);
42 } 42 }
43 43
44 void SVGAnimatedProperty::detachAnimatedPropertiesForElement(SVGElement* element )
45 {
46 // Remove wrappers from cache.
47 Cache* cache = animatedPropertyCache();
48
49 Vector<SVGAnimatedPropertyDescription> keysToRemove;
50
51 const Cache::const_iterator end = cache->end();
52 for (Cache::const_iterator it = cache->begin(); it != end; ++it) {
53 if (it->key.m_element == element) {
54 it->value->resetContextElement();
55 keysToRemove.append(it->key);
56 }
57 }
58
59 for (Vector<SVGAnimatedPropertyDescription>::const_iterator it = keysToRemov e.begin(); it != keysToRemove.end(); ++it) {
60 // http://crbug.com/333156 :
61 // There are cases where detachAnimatedPropertiesForElement is called re cursively from ~SVGAnimatedProperty.
62 // This below protect makes this function safe by deferring the recursiv e call until we finish touching the HashMap.
63 RefPtr<SVGAnimatedProperty> protect = cache->get(*it);
64 cache->remove(*it);
65 }
66 }
67
68 void SVGAnimatedProperty::commitChange() 44 void SVGAnimatedProperty::commitChange()
69 { 45 {
70 ASSERT(m_contextElement); 46 ASSERT(m_contextElement);
71 ASSERT_WITH_SECURITY_IMPLICATION(!m_contextElement->m_deletionHasBegun); 47 ASSERT_WITH_SECURITY_IMPLICATION(!m_contextElement->m_deletionHasBegun);
72 m_contextElement->invalidateSVGAttributes(); 48 m_contextElement->invalidateSVGAttributes();
73 m_contextElement->svgAttributeChanged(m_attributeName); 49 m_contextElement->svgAttributeChanged(m_attributeName);
74 } 50 }
75 51
76 SVGAnimatedProperty::Cache* SVGAnimatedProperty::animatedPropertyCache()
77 {
78 static Cache* s_cache = new Cache;
79 return s_cache;
80 }
81
82 } // namespace WebCore 52 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/svg/properties/SVGAnimatedProperty.h ('k') | Source/core/svg/properties/SVGAnimatedPropertyMacros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698