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

Unified Diff: Source/core/xml/DocumentXPathEvaluator.cpp

Issue 171333003: Pass implementation object to supplemental classes by reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/xml/DocumentXPathEvaluator.cpp
diff --git a/Source/core/xml/DocumentXPathEvaluator.cpp b/Source/core/xml/DocumentXPathEvaluator.cpp
index ce8cff59aab7cab40a844890e866b7e28107aaf2..10dff253a3b13b1b62fee02d01cbc4921602f551 100644
--- a/Source/core/xml/DocumentXPathEvaluator.cpp
+++ b/Source/core/xml/DocumentXPathEvaluator.cpp
@@ -41,41 +41,41 @@ DocumentXPathEvaluator::~DocumentXPathEvaluator()
{
}
-DocumentXPathEvaluator* DocumentXPathEvaluator::from(DocumentSupplementable* document)
+DocumentXPathEvaluator& DocumentXPathEvaluator::from(DocumentSupplementable& document)
{
DocumentXPathEvaluator* cache = static_cast<DocumentXPathEvaluator*>(DocumentSupplement::from(document, supplementName()));
if (!cache) {
cache = new DocumentXPathEvaluator();
DocumentSupplement::provideTo(document, supplementName(), adoptPtr(cache));
}
- return cache;
+ return *cache;
}
-PassRefPtrWillBeRawPtr<XPathExpression> DocumentXPathEvaluator::createExpression(DocumentSupplementable* document,
+PassRefPtrWillBeRawPtr<XPathExpression> DocumentXPathEvaluator::createExpression(DocumentSupplementable& document,
const String& expression, PassRefPtrWillBeRawPtr<XPathNSResolver> resolver, ExceptionState& exceptionState)
{
- DocumentXPathEvaluator* suplement = from(document);
- if (!suplement->m_xpathEvaluator)
- suplement->m_xpathEvaluator = XPathEvaluator::create();
- return suplement->m_xpathEvaluator->createExpression(expression, resolver, exceptionState);
+ DocumentXPathEvaluator& suplement = from(document);
+ if (!suplement.m_xpathEvaluator)
+ suplement.m_xpathEvaluator = XPathEvaluator::create();
+ return suplement.m_xpathEvaluator->createExpression(expression, resolver, exceptionState);
}
-PassRefPtrWillBeRawPtr<XPathNSResolver> DocumentXPathEvaluator::createNSResolver(DocumentSupplementable* document, Node* nodeResolver)
+PassRefPtrWillBeRawPtr<XPathNSResolver> DocumentXPathEvaluator::createNSResolver(DocumentSupplementable& document, Node* nodeResolver)
{
- DocumentXPathEvaluator* suplement = from(document);
- if (!suplement->m_xpathEvaluator)
- suplement->m_xpathEvaluator = XPathEvaluator::create();
- return suplement->m_xpathEvaluator->createNSResolver(nodeResolver);
+ DocumentXPathEvaluator& suplement = from(document);
+ if (!suplement.m_xpathEvaluator)
+ suplement.m_xpathEvaluator = XPathEvaluator::create();
+ return suplement.m_xpathEvaluator->createNSResolver(nodeResolver);
}
-PassRefPtrWillBeRawPtr<XPathResult> DocumentXPathEvaluator::evaluate(DocumentSupplementable* document, const String& expression,
+PassRefPtrWillBeRawPtr<XPathResult> DocumentXPathEvaluator::evaluate(DocumentSupplementable& document, const String& expression,
Node* contextNode, PassRefPtrWillBeRawPtr<XPathNSResolver> resolver, unsigned short type,
XPathResult* result, ExceptionState& exceptionState)
{
- DocumentXPathEvaluator* suplement = from(document);
- if (!suplement->m_xpathEvaluator)
- suplement->m_xpathEvaluator = XPathEvaluator::create();
- return suplement->m_xpathEvaluator->evaluate(expression, contextNode, resolver, type, result, exceptionState);
+ DocumentXPathEvaluator& suplement = from(document);
+ if (!suplement.m_xpathEvaluator)
+ suplement.m_xpathEvaluator = XPathEvaluator::create();
+ return suplement.m_xpathEvaluator->evaluate(expression, contextNode, resolver, type, result, exceptionState);
}
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698