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

Side by Side Diff: third_party/WebKit/Source/core/dom/CSSSelectorWatch.cpp

Issue 2657443005: Migrate WTF::HashSet::add() to ::insert() [part 1 of N] (Closed)
Patch Set: Created 3 years, 10 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) 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 for (const auto& selector : removedSelectors) { 97 for (const auto& selector : removedSelectors) {
98 if (!m_matchingCallbackSelectors.remove(selector)) 98 if (!m_matchingCallbackSelectors.remove(selector))
99 continue; 99 continue;
100 100
101 // Count reached 0. 101 // Count reached 0.
102 shouldUpdateTimer = true; 102 shouldUpdateTimer = true;
103 auto it = m_addedSelectors.find(selector); 103 auto it = m_addedSelectors.find(selector);
104 if (it != m_addedSelectors.end()) 104 if (it != m_addedSelectors.end())
105 m_addedSelectors.remove(it); 105 m_addedSelectors.remove(it);
106 else 106 else
107 m_removedSelectors.add(selector); 107 m_removedSelectors.insert(selector);
108 } 108 }
109 109
110 for (const auto& selector : addedSelectors) { 110 for (const auto& selector : addedSelectors) {
111 HashCountedSet<String>::AddResult result = 111 HashCountedSet<String>::AddResult result =
112 m_matchingCallbackSelectors.add(selector); 112 m_matchingCallbackSelectors.add(selector);
113 if (!result.isNewEntry) 113 if (!result.isNewEntry)
114 continue; 114 continue;
115 115
116 shouldUpdateTimer = true; 116 shouldUpdateTimer = true;
117 auto it = m_removedSelectors.find(selector); 117 auto it = m_removedSelectors.find(selector);
118 if (it != m_removedSelectors.end()) 118 if (it != m_removedSelectors.end())
119 m_removedSelectors.remove(it); 119 m_removedSelectors.remove(it);
120 else 120 else
121 m_addedSelectors.add(selector); 121 m_addedSelectors.insert(selector);
122 } 122 }
123 123
124 if (!shouldUpdateTimer) 124 if (!shouldUpdateTimer)
125 return; 125 return;
126 126
127 if (m_removedSelectors.isEmpty() && m_addedSelectors.isEmpty()) { 127 if (m_removedSelectors.isEmpty() && m_addedSelectors.isEmpty()) {
128 if (m_callbackSelectorChangeTimer.isActive()) { 128 if (m_callbackSelectorChangeTimer.isActive()) {
129 m_timerExpirations = 0; 129 m_timerExpirations = 0;
130 m_callbackSelectorChangeTimer.stop(); 130 m_callbackSelectorChangeTimer.stop();
131 } 131 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 167 }
168 supplementable()->styleEngine().watchedSelectorsChanged(); 168 supplementable()->styleEngine().watchedSelectorsChanged();
169 } 169 }
170 170
171 DEFINE_TRACE(CSSSelectorWatch) { 171 DEFINE_TRACE(CSSSelectorWatch) {
172 visitor->trace(m_watchedCallbackSelectors); 172 visitor->trace(m_watchedCallbackSelectors);
173 Supplement<Document>::trace(visitor); 173 Supplement<Document>::trace(visitor);
174 } 174 }
175 175
176 } // namespace blink 176 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/resolver/StyleRuleUsageTracker.h ('k') | third_party/WebKit/Source/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698