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

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

Issue 133273005: [SVG] Defer recursive detachAnimatedProperty call to avoid touching invalidated iterator (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: removed vec Created 6 years, 11 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 | « no previous file | no next file » | 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) 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 Vector<SVGAnimatedPropertyDescription> keysToRemove; 49 Vector<SVGAnimatedPropertyDescription> keysToRemove;
50 50
51 const Cache::const_iterator end = cache->end(); 51 const Cache::const_iterator end = cache->end();
52 for (Cache::const_iterator it = cache->begin(); it != end; ++it) { 52 for (Cache::const_iterator it = cache->begin(); it != end; ++it) {
53 if (it->key.m_element == element) { 53 if (it->key.m_element == element) {
54 it->value->resetContextElement(); 54 it->value->resetContextElement();
55 keysToRemove.append(it->key); 55 keysToRemove.append(it->key);
56 } 56 }
57 } 57 }
58 58
59 for (Vector<SVGAnimatedPropertyDescription>::const_iterator it = keysToRemov e.begin(); it != keysToRemove.end(); ++it) 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);
60 cache->remove(*it); 64 cache->remove(*it);
65 }
61 } 66 }
62 67
63 void SVGAnimatedProperty::commitChange() 68 void SVGAnimatedProperty::commitChange()
64 { 69 {
65 ASSERT(m_contextElement); 70 ASSERT(m_contextElement);
66 ASSERT_WITH_SECURITY_IMPLICATION(!m_contextElement->m_deletionHasBegun); 71 ASSERT_WITH_SECURITY_IMPLICATION(!m_contextElement->m_deletionHasBegun);
67 m_contextElement->invalidateSVGAttributes(); 72 m_contextElement->invalidateSVGAttributes();
68 m_contextElement->svgAttributeChanged(m_attributeName); 73 m_contextElement->svgAttributeChanged(m_attributeName);
69 } 74 }
70 75
71 SVGAnimatedProperty::Cache* SVGAnimatedProperty::animatedPropertyCache() 76 SVGAnimatedProperty::Cache* SVGAnimatedProperty::animatedPropertyCache()
72 { 77 {
73 static Cache* s_cache = new Cache; 78 static Cache* s_cache = new Cache;
74 return s_cache; 79 return s_cache;
75 } 80 }
76 81
77 } // namespace WebCore 82 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698