Chromium Code Reviews

Side by Side Diff: Source/core/dom/custom/CustomElementUpgradeCandidateMap.cpp

Issue 152883002: (Concept patch) Simplify WTF::HashTable::add() return value for size and performance (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 33 matching lines...)
44 44
45 void CustomElementUpgradeCandidateMap::add(const CustomElementDescriptor& descri ptor, Element* element) 45 void CustomElementUpgradeCandidateMap::add(const CustomElementDescriptor& descri ptor, Element* element)
46 { 46 {
47 observe(element); 47 observe(element);
48 48
49 UpgradeCandidateMap::AddResult result = m_upgradeCandidates.add(element, des criptor); 49 UpgradeCandidateMap::AddResult result = m_upgradeCandidates.add(element, des criptor);
50 ASSERT_UNUSED(result, result.isNewEntry); 50 ASSERT_UNUSED(result, result.isNewEntry);
51 51
52 UnresolvedDefinitionMap::iterator it = m_unresolvedDefinitions.find(descript or); 52 UnresolvedDefinitionMap::iterator it = m_unresolvedDefinitions.find(descript or);
53 if (it == m_unresolvedDefinitions.end()) 53 if (it == m_unresolvedDefinitions.end())
54 it = m_unresolvedDefinitions.add(descriptor, ElementSet()).iterator; 54 m_unresolvedDefinitions.add(descriptor, ElementSet()).iterator->value.ad d(element);
Inactive 2014/02/04 14:21:33 This sort of change leads to some code duplication
55 it->value.add(element); 55 else
56 it->value.add(element);
56 } 57 }
57 58
58 void CustomElementUpgradeCandidateMap::remove(Element* element) 59 void CustomElementUpgradeCandidateMap::remove(Element* element)
59 { 60 {
60 unobserve(element); 61 unobserve(element);
61 removeCommon(element); 62 removeCommon(element);
62 } 63 }
63 64
64 void CustomElementUpgradeCandidateMap::elementWasDestroyed(Element* element) 65 void CustomElementUpgradeCandidateMap::elementWasDestroyed(Element* element)
65 { 66 {
(...skipping 35 matching lines...)
101 102
102 for (ElementSet::const_iterator candidate = candidates.begin(); candidate != candidates.end(); ++candidate) { 103 for (ElementSet::const_iterator candidate = candidates.begin(); candidate != candidates.end(); ++candidate) {
103 unobserve(*candidate); 104 unobserve(*candidate);
104 m_upgradeCandidates.remove(*candidate); 105 m_upgradeCandidates.remove(*candidate);
105 } 106 }
106 107
107 return candidates; 108 return candidates;
108 } 109 }
109 110
110 } 111 }
OLDNEW

Powered by Google App Engine