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

Unified Diff: Source/core/dom/SelectorQuery.cpp

Issue 330713003: Update SelectorQuery constructor to adopt CSSSelectorList object (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rename to adopt Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/SelectorQuery.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/SelectorQuery.cpp
diff --git a/Source/core/dom/SelectorQuery.cpp b/Source/core/dom/SelectorQuery.cpp
index 8957245887589c1b908df99adbf105b4aa95cc53..2cb913e0bc88e712b94c14f7e59f30fad52802c1 100644
--- a/Source/core/dom/SelectorQuery.cpp
+++ b/Source/core/dom/SelectorQuery.cpp
@@ -465,9 +465,14 @@ void SelectorDataList::execute(ContainerNode& rootNode, typename SelectorQueryTr
findTraverseRootsAndExecute<SelectorQueryTrait>(rootNode, output);
}
-SelectorQuery::SelectorQuery(const CSSSelectorList& selectorList)
- : m_selectorList(selectorList)
+PassOwnPtr<SelectorQuery> SelectorQuery::adopt(CSSSelectorList& selectorList)
{
+ return adoptPtr(new SelectorQuery(selectorList));
+}
+
+SelectorQuery::SelectorQuery(CSSSelectorList& selectorList)
+{
+ m_selectorList.adopt(selectorList);
m_selectors.initialize(m_selectorList);
}
@@ -511,10 +516,7 @@ SelectorQuery* SelectorQueryCache::add(const AtomicString& selectors, const Docu
if (m_entries.size() == maximumSelectorQueryCacheSize)
m_entries.remove(m_entries.begin());
- OwnPtr<SelectorQuery> selectorQuery = adoptPtr(new SelectorQuery(selectorList));
- SelectorQuery* rawSelectorQuery = selectorQuery.get();
- m_entries.add(selectors, selectorQuery.release());
- return rawSelectorQuery;
+ return m_entries.add(selectors, SelectorQuery::adopt(selectorList)).storedValue->value.get();
}
void SelectorQueryCache::invalidate()
« no previous file with comments | « Source/core/dom/SelectorQuery.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698