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

Unified Diff: Source/core/dom/NodeWithIndex.h

Issue 176863009: Have NodeWithIndex deal with references instead of pointers (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
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/dom/Range.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/NodeWithIndex.h
diff --git a/Source/core/dom/NodeWithIndex.h b/Source/core/dom/NodeWithIndex.h
index 8c75ccc86822b00b93cbf5030da24cabea7d82a3..02b6d33c15acdadcd3abdffe27003c6f37e2500e 100644
--- a/Source/core/dom/NodeWithIndex.h
+++ b/Source/core/dom/NodeWithIndex.h
@@ -34,27 +34,26 @@ namespace WebCore {
// only want to walk the child list to figure out the index once.
class NodeWithIndex {
public:
- explicit NodeWithIndex(Node* node)
+ explicit NodeWithIndex(Node& node)
: m_node(node)
, m_haveIndex(false)
{
- ASSERT(node);
}
- Node* node() const { return m_node; }
+ Node& node() const { return m_node; }
int index() const
{
if (!m_haveIndex) {
- m_index = m_node->nodeIndex();
+ m_index = m_node.nodeIndex();
m_haveIndex = true;
}
- ASSERT(m_index == static_cast<int>(m_node->nodeIndex()));
+ ASSERT(m_index == static_cast<int>(m_node.nodeIndex()));
return m_index;
}
private:
- Node* m_node;
+ Node& m_node;
mutable bool m_haveIndex;
mutable int m_index;
};
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/dom/Range.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698