Commit d3913419 authored by Abhijeet Kandalkar's avatar Abhijeet Kandalkar Committed by Commit Bot

Remove DEFINE_TYPE_CASTS from blink::EmptyNodeList

This CL removes old downcast helpers generated by macro
DEFINE_TYPE_CASTS.The primary goal of this CL is to use new downcast
helpers implemented using C++11 type traits.

Bug: 891908
Change-Id: Ib00118d7419f371124317376076772ef81d41580
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1906613
Commit-Queue: Abhijeet Kandalkar <abhijeet@igalia.com>
Reviewed-by: default avatarChristian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714158}
parent 53eada7a
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_EMPTY_NODE_LIST_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_EMPTY_NODE_LIST_H_
#include "third_party/blink/renderer/core/dom/node_list.h" #include "third_party/blink/renderer/core/dom/node_list.h"
#include "third_party/blink/renderer/platform/wtf/casting.h"
namespace blink { namespace blink {
...@@ -55,11 +56,15 @@ class EmptyNodeList final : public NodeList { ...@@ -55,11 +56,15 @@ class EmptyNodeList final : public NodeList {
Member<Node> owner_; Member<Node> owner_;
}; };
DEFINE_TYPE_CASTS(EmptyNodeList, template <>
NodeList, struct DowncastTraits<EmptyNodeList> {
nodeList, static bool AllowFrom(const NodeList& nodeList) {
nodeList->IsEmptyNodeList(), return nodeList.IsEmptyNodeList();
nodeList.IsEmptyNodeList()); }
static bool AllowFrom(const NodeList* nodeList) {
return nodeList->IsEmptyNodeList();
}
};
} // namespace blink } // namespace blink
......
...@@ -54,7 +54,7 @@ class NodeListsNodeData final : public GarbageCollected<NodeListsNodeData> { ...@@ -54,7 +54,7 @@ class NodeListsNodeData final : public GarbageCollected<NodeListsNodeData> {
EmptyNodeList* EnsureEmptyChildNodeList(Node& node) { EmptyNodeList* EnsureEmptyChildNodeList(Node& node) {
DCHECK(ThreadState::Current()->IsGCForbidden()); DCHECK(ThreadState::Current()->IsGCForbidden());
if (child_node_list_) if (child_node_list_)
return ToEmptyNodeList(child_node_list_); return To<EmptyNodeList>(child_node_list_.Get());
auto* list = MakeGarbageCollected<EmptyNodeList>(node); auto* list = MakeGarbageCollected<EmptyNodeList>(node);
child_node_list_ = list; child_node_list_ = list;
return list; return list;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment