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() |