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

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

Issue 285213003: Oilpan: move Node traversal objects to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Drop nullptr type conversions Created 6 years, 7 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/NodeFilterCondition.h ('k') | Source/core/dom/NodeIterator.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/NodeIterator.h
diff --git a/Source/core/dom/NodeIterator.h b/Source/core/dom/NodeIterator.h
index 345511fc5ed13809034a869846318a205375b4e2..c2c5de1b05f15d6416b8adb42dbbb4e3900a9ca4 100644
--- a/Source/core/dom/NodeIterator.h
+++ b/Source/core/dom/NodeIterator.h
@@ -28,6 +28,7 @@
#include "bindings/v8/ScriptWrappable.h"
#include "core/dom/NodeFilter.h"
#include "core/dom/NodeIteratorBase.h"
+#include "platform/heap/Handle.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefCounted.h"
@@ -35,16 +36,18 @@ namespace WebCore {
class ExceptionState;
-class NodeIterator : public ScriptWrappable, public RefCounted<NodeIterator>, public NodeIteratorBase {
+class NodeIterator FINAL : public RefCountedWillBeGarbageCollectedFinalized<NodeIterator>, public ScriptWrappable, public NodeIteratorBase {
+ WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(NodeIterator);
public:
- static PassRefPtr<NodeIterator> create(PassRefPtr<Node> rootNode, unsigned whatToShow, PassRefPtr<NodeFilter> filter)
+ static PassRefPtrWillBeRawPtr<NodeIterator> create(PassRefPtrWillBeRawPtr<Node> rootNode, unsigned whatToShow, PassRefPtrWillBeRawPtr<NodeFilter> filter)
{
- return adoptRef(new NodeIterator(rootNode, whatToShow, filter));
+ return adoptRefWillBeNoop(new NodeIterator(rootNode, whatToShow, filter));
}
- ~NodeIterator();
- PassRefPtr<Node> nextNode(ExceptionState&);
- PassRefPtr<Node> previousNode(ExceptionState&);
+ virtual ~NodeIterator();
+
+ PassRefPtrWillBeRawPtr<Node> nextNode(ExceptionState&);
+ PassRefPtrWillBeRawPtr<Node> previousNode(ExceptionState&);
void detach();
Node* referenceNode() const { return m_referenceNode.node.get(); }
@@ -53,17 +56,28 @@ public:
// This function is called before any node is removed from the document tree.
void nodeWillBeRemoved(Node&);
+ virtual void trace(Visitor*) OVERRIDE;
+
private:
- NodeIterator(PassRefPtr<Node>, unsigned whatToShow, PassRefPtr<NodeFilter>);
+ NodeIterator(PassRefPtrWillBeRawPtr<Node>, unsigned whatToShow, PassRefPtrWillBeRawPtr<NodeFilter>);
- struct NodePointer {
- RefPtr<Node> node;
- bool isPointerBeforeNode;
+ class NodePointer {
+ DISALLOW_ALLOCATION();
+ public:
NodePointer();
- NodePointer(PassRefPtr<Node>, bool);
+ NodePointer(PassRefPtrWillBeRawPtr<Node>, bool);
+
void clear();
bool moveToNext(Node* root);
bool moveToPrevious(Node* root);
+
+ RefPtrWillBeMember<Node> node;
+ bool isPointerBeforeNode;
+
+ void trace(Visitor* visitor)
+ {
+ visitor->trace(node);
+ }
};
void updateForNodeRemoval(Node& nodeToBeRemoved, NodePointer&) const;
« no previous file with comments | « Source/core/dom/NodeFilterCondition.h ('k') | Source/core/dom/NodeIterator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698