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

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: 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..7388afb0e23ac1cf7653bc6faea749a662fbc567 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::createAndAdopt(CSSSelectorList& selectorList)
esprehn 2014/06/13 03:47:41 Just ::adopt(), that's what we use for NodeLists t
Inactive 2014/06/13 12:25:27 Right, I missed that StaticNodeList was using adop
{
+ 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::createAndAdopt(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