| OLD | NEW |
| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 { | 71 { |
| 72 UpgradeCandidateMap::iterator candidate = m_upgradeCandidates.find(element); | 72 UpgradeCandidateMap::iterator candidate = m_upgradeCandidates.find(element); |
| 73 ASSERT(candidate != m_upgradeCandidates.end()); | 73 ASSERT(candidate != m_upgradeCandidates.end()); |
| 74 | 74 |
| 75 UnresolvedDefinitionMap::iterator elements = m_unresolvedDefinitions.find(ca
ndidate->value); | 75 UnresolvedDefinitionMap::iterator elements = m_unresolvedDefinitions.find(ca
ndidate->value); |
| 76 ASSERT(elements != m_unresolvedDefinitions.end()); | 76 ASSERT(elements != m_unresolvedDefinitions.end()); |
| 77 elements->value.remove(element); | 77 elements->value.remove(element); |
| 78 m_upgradeCandidates.remove(candidate); | 78 m_upgradeCandidates.remove(candidate); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void CustomElementUpgradeCandidateMap::elementDidFinishParsingChildren(Element*
element) |
| 82 { |
| 83 // An upgrade candidate finished parsing; reorder so that eventual |
| 84 // upgrade order matches finished-parsing order. |
| 85 moveToEnd(element); |
| 86 } |
| 87 |
| 88 void CustomElementUpgradeCandidateMap::moveToEnd(Element* element) |
| 89 { |
| 90 UpgradeCandidateMap::iterator candidate = m_upgradeCandidates.find(element); |
| 91 ASSERT(candidate != m_upgradeCandidates.end()); |
| 92 |
| 93 UnresolvedDefinitionMap::iterator elements = m_unresolvedDefinitions.find(ca
ndidate->value); |
| 94 ASSERT(elements != m_unresolvedDefinitions.end()); |
| 95 elements->value.appendOrMoveToLast(element); |
| 96 } |
| 97 |
| 81 ListHashSet<Element*> CustomElementUpgradeCandidateMap::takeUpgradeCandidatesFor
(const CustomElementDescriptor& descriptor) | 98 ListHashSet<Element*> CustomElementUpgradeCandidateMap::takeUpgradeCandidatesFor
(const CustomElementDescriptor& descriptor) |
| 82 { | 99 { |
| 83 const ListHashSet<Element*>& candidates = m_unresolvedDefinitions.take(descr
iptor); | 100 const ListHashSet<Element*>& candidates = m_unresolvedDefinitions.take(descr
iptor); |
| 84 | 101 |
| 85 for (ElementSet::const_iterator candidate = candidates.begin(); candidate !=
candidates.end(); ++candidate) { | 102 for (ElementSet::const_iterator candidate = candidates.begin(); candidate !=
candidates.end(); ++candidate) { |
| 86 unobserve(*candidate); | 103 unobserve(*candidate); |
| 87 m_upgradeCandidates.remove(*candidate); | 104 m_upgradeCandidates.remove(*candidate); |
| 88 } | 105 } |
| 89 | 106 |
| 90 return candidates; | 107 return candidates; |
| 91 } | 108 } |
| 92 | 109 |
| 93 } | 110 } |
| OLD | NEW |