[webkit-reviews] review denied: [Bug 52963] Enable O(1) access to root from any node in shadow DOM subtree : [Attachment 88341] new, smaller patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Apr 5 18:26:32 PDT 2011
Dimitri Glazkov (Google) <dglazkov at chromium.org> has denied Roland Steiner
<rolandsteiner at chromium.org>'s request for review:
Bug 52963: Enable O(1) access to root from any node in shadow DOM subtree
Attachment 88341: new, smaller patch
------- Additional Comments from Dimitri Glazkov (Google)
<dglazkov at chromium.org>
View in context: https://bugs.webkit.org/attachment.cgi?id=88341&action=review
Can you remind me why we need to have this guardRef logic on the tree scopes?
Isn't having this done on Document enough? The code looks very awkward with
these refs/derefs and I am not sure we need it.
> + Document pointer) to allow direct access to the containing tree
I am not convinced we have a solution for O(1) document pointer access at the
moment. Perhaps the document ptr will be on the TreeScope? If so, it may make
sense to consider including it into this change. Growing a pointer on each node
is quite expensive, and this could be shipping code.
> + * dom/ContainerNode.cpp:
> + (WebCore::ContainerNode::insertBefore):
> + (WebCore::ContainerNode::replaceChild):
> + (WebCore::ContainerNode::appendChild):
> + * dom/Document.cpp:
> + (WebCore::Document::Document):
> + (WebCore::Document::setDocType):
> + * dom/Document.h:
> + (WebCore::Node::Node):
> + * dom/Node.cpp:
> + (WebCore::Node::setTreeScope):
> + (WebCore::Node::setTreeScopeRecursively):
> + * dom/Node.h:
> + (WebCore::Node::treeScope):
> + * dom/TreeScope.cpp:
> + (WebCore::TreeScope::TreeScope):
> + (WebCore::TreeScope::~TreeScope):
> + (WebCore::TreeScope::removedLastRef):
> + (WebCore::TreeScope::setParentTreeScope):
> + * dom/TreeScope.h:
> + (WebCore::TreeScope::parentTreeScope):
For a change as fundamental as this one, I would definitely provide detailed
explanation of each modification.
> +// === Node inline methods ===
This is unnecessary.
> +// here because these methods require the Document definition, but we really
want to inline them.
Please make it into a sentence.
> + newTreeScope->guardRef();
> + m_treeScope = newTreeScope;
> + setDocument(newTreeScope->document());
> + if (oldTreeScope)
> + oldTreeScope->guardDeref();
This ref/deref code looks an awful lot like a typical RefPtr assignment. Having
these manual refs/derefs reeks of maintenance pain further down the road.
Usually, we try to actively get rid of them. Can we somehow avoid them here?
> + // FIXME: adapt to ShadowFragment
> + // ...->setParentTreeScope(newTreeScope);
This comment doesn't make sense yet. So let's yank it.
> + // But: need to traverse shadow tree if document has changed.
This comment is unnecessary.
> + TreeScope* m_treeScope;
We must measure weight impact of this before thinking of landing. This is why I
was suggesting using RareNodeData.
> + TreeScope* oldParentScope = m_parentTreeScope;
> + newParentScope->guardRef();
> + m_parentTreeScope = newParentScope;
> + oldParentScope->guardDeref();
This is a classic RefPtr assignment, just with different names. I loathe
landing code like this.
More information about the webkit-reviews