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

Unified Diff: third_party/WebKit/Source/core/html/HTMLSlotElement.h

Issue 1611413005: Make HTMLSlotElement.distributedNodeNextTo&distributedNodePreviousTo faster (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean up code Created 4 years, 11 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: third_party/WebKit/Source/core/html/HTMLSlotElement.h
diff --git a/third_party/WebKit/Source/core/html/HTMLSlotElement.h b/third_party/WebKit/Source/core/html/HTMLSlotElement.h
index 90f2cca132fceb496c986a8e6726ffe65920f3d2..931573cb051845400c313e5f5d2547a71a9895e7 100644
--- a/third_party/WebKit/Source/core/html/HTMLSlotElement.h
+++ b/third_party/WebKit/Source/core/html/HTMLSlotElement.h
@@ -50,7 +50,6 @@ public:
Node* firstDistributedNode() const { return m_distributedNodes.isEmpty() ? nullptr : m_distributedNodes.first().get(); }
Node* lastDistributedNode() const { return m_distributedNodes.isEmpty() ? nullptr : m_distributedNodes.last().get(); }
- // TODO(hayato): This takes O(N). Make it O(1) with node-to-index hash table.
Node* distributedNodeNextTo(const Node&) const;
Node* distributedNodePreviousTo(const Node&) const;
@@ -76,8 +75,8 @@ private:
void removedFrom(ContainerNode*) override;
WillBeHeapVector<RefPtrWillBeMember<Node>> m_assignedNodes;
- // TODO(hayato): Share code with DistributedNode class
WillBeHeapVector<RefPtrWillBeMember<Node>> m_distributedNodes;
+ WillBeHeapHashMap<RawPtrWillBeMember<const Node>, size_t> m_distributedIndices;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698