diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-07-16 11:45:35 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-07-17 08:59:23 +0000 |
commit | 552906b0f222c5d5dd11b9fd73829d510980461a (patch) | |
tree | 3a11e6ed0538a81dd83b20cf3a4783e297f26d91 /chromium/third_party/blink/renderer/core/dom/node_rare_data.cc | |
parent | 1b05827804eaf047779b597718c03e7d38344261 (diff) | |
download | qtwebengine-chromium-552906b0f222c5d5dd11b9fd73829d510980461a.tar.gz |
BASELINE: Update Chromium to 83.0.4103.122
Change-Id: Ie3a82f5bb0076eec2a7c6a6162326b4301ee291e
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/core/dom/node_rare_data.cc')
-rw-r--r-- | chromium/third_party/blink/renderer/core/dom/node_rare_data.cc | 54 |
1 files changed, 38 insertions, 16 deletions
diff --git a/chromium/third_party/blink/renderer/core/dom/node_rare_data.cc b/chromium/third_party/blink/renderer/core/dom/node_rare_data.cc index 8b4d8a63bd0..50a72f9dee0 100644 --- a/chromium/third_party/blink/renderer/core/dom/node_rare_data.cc +++ b/chromium/third_party/blink/renderer/core/dom/node_rare_data.cc @@ -37,13 +37,13 @@ #include "third_party/blink/renderer/core/dom/mutation_observer_registration.h" #include "third_party/blink/renderer/core/dom/node_lists_node_data.h" #include "third_party/blink/renderer/core/page/page.h" +#include "third_party/blink/renderer/core/style/computed_style.h" #include "third_party/blink/renderer/platform/heap/handle.h" namespace blink { struct SameSizeAsNodeRareData { - void* pointer_; - Member<void*> willbe_member_[3]; + Member<void*> willbe_member_[4]; unsigned bitfields_; }; @@ -77,25 +77,47 @@ void NodeMutationObserverData::RemoveRegistration( registry_.EraseAt(registry_.Find(registration)); } -void NodeRareData::TraceAfterDispatch(blink::Visitor* visitor) { - visitor->Trace(mutation_observer_data_); - visitor->Trace(flat_tree_node_data_); - // Do not keep empty NodeListsNodeData objects around. - if (node_lists_ && node_lists_->IsEmpty()) - node_lists_.Clear(); - else - visitor->Trace(node_lists_); +void NodeData::Trace(Visitor* visitor) { + if (bit_field_.get_concurrently<IsRareData>()) { + if (bit_field_.get_concurrently<IsElementRareData>()) + static_cast<ElementRareData*>(this)->TraceAfterDispatch(visitor); + else + static_cast<NodeRareData*>(this)->TraceAfterDispatch(visitor); + } else { + static_cast<NodeRenderingData*>(this)->TraceAfterDispatch(visitor); + } } -void NodeRareData::Trace(Visitor* visitor) { - if (is_element_rare_data_) - static_cast<ElementRareData*>(this)->TraceAfterDispatch(visitor); - else - TraceAfterDispatch(visitor); +NodeRenderingData::NodeRenderingData( + LayoutObject* layout_object, + scoped_refptr<const ComputedStyle> computed_style) + : NodeData(false, false), + layout_object_(layout_object), + computed_style_(computed_style) {} + +void NodeRenderingData::SetComputedStyle( + scoped_refptr<const ComputedStyle> computed_style) { + DCHECK_NE(&SharedEmptyData(), this); + computed_style_ = computed_style; +} + +NodeRenderingData& NodeRenderingData::SharedEmptyData() { + DEFINE_STATIC_LOCAL( + Persistent<NodeRenderingData>, shared_empty_data, + (MakeGarbageCollected<NodeRenderingData>(nullptr, nullptr))); + return *shared_empty_data; +} + +void NodeRareData::TraceAfterDispatch(blink::Visitor* visitor) const { + visitor->Trace(mutation_observer_data_); + visitor->Trace(flat_tree_node_data_); + visitor->Trace(node_layout_data_); + visitor->Trace(node_lists_); + NodeData::TraceAfterDispatch(visitor); } void NodeRareData::FinalizeGarbageCollectedObject() { - if (is_element_rare_data_) + if (bit_field_.get<IsElementRareData>()) static_cast<ElementRareData*>(this)->~ElementRareData(); else this->~NodeRareData(); |