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

Unified Diff: third_party/WebKit/Source/core/dom/CSSSelectorWatch.cpp

Issue 2541853002: CSSSelectorWatch: avoid unnecessary hash table lookups. (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/CSSSelectorWatch.cpp
diff --git a/third_party/WebKit/Source/core/dom/CSSSelectorWatch.cpp b/third_party/WebKit/Source/core/dom/CSSSelectorWatch.cpp
index d07eafc119d7ac41d971ec98afc692f04f209faa..f01b29cc6e4c0b3bc691a0191d425568b51bc567 100644
--- a/third_party/WebKit/Source/core/dom/CSSSelectorWatch.cpp
+++ b/third_party/WebKit/Source/core/dom/CSSSelectorWatch.cpp
@@ -99,8 +99,9 @@ void CSSSelectorWatch::updateSelectorMatches(
// Count reached 0.
shouldUpdateTimer = true;
- if (m_addedSelectors.contains(selector))
- m_addedSelectors.remove(selector);
+ auto it = m_addedSelectors.find(selector);
+ if (it != m_addedSelectors.end())
+ m_addedSelectors.remove(it);
else
m_removedSelectors.add(selector);
}
@@ -113,8 +114,9 @@ void CSSSelectorWatch::updateSelectorMatches(
continue;
shouldUpdateTimer = true;
- if (m_removedSelectors.contains(selector))
- m_removedSelectors.remove(selector);
+ auto it = m_removedSelectors.find(selector);
+ if (it != m_removedSelectors.end())
+ m_removedSelectors.remove(it);
else
m_addedSelectors.add(selector);
}
« 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