Commit 8bdf10df authored by Hector Carmona's avatar Hector Carmona Committed by Commit Bot

Reland "Replace use of std containers with WTF's equivalents in html_slot_element.h"

This reverts commit 304bb952.

Reason for revert: This was not the cause of the test failure, reverting this revert and creating a new CL to disable the test in linux. See pre-existing issue: https://crbug.com/972822

Original change's description:
> Revert "Replace use of std containers with WTF's equivalents in html_slot_element.h"
> 
> This reverts commit c2d3f186.
> 
> Reason for revert: Suspecting this CL for test failures in Linux CFI
> https://ci.chromium.org/p/chromium/builders/ci/Linux%20CFI
> 
> See first test failure of AdsPageLoadMetricsObserverResourceBrowserTest.AdFrameSizeInterventionMediaStatusPlayed here:
> https://ci.chromium.org/p/chromium/builders/ci/Linux%20CFI/14253
> 
> Suspecting this CL since it was the only one that touched code in t/p/b/r/c/html for that blamelist and crash shows blink::HTMLParserScheduler::ScheduleForUnpause within stack trace.
> 
> Original change's description:
> > Replace use of std containers with WTF's equivalents in html_slot_element.h
> > 
> > This CL replaces the use of std::array of std containers with WTF::Vector
> > and introduces LCSArray struct in html_slot_element.h.
> > 
> > Bug: 952716
> > Change-Id: I45d0dcbb63aed5198440bd7b94c5c693a05bd6fd
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1694801
> > Reviewed-by: Kentaro Hara <haraken@chromium.org>
> > Commit-Queue: Miyoung Shin <myid.shin@igalia.com>
> > Cr-Commit-Position: refs/heads/master@{#675985}
> 
> TBR=haraken@chromium.org,myid.shin@igalia.com
> 
> Change-Id: Ibf0a3bb5b4d4f579085986b941a5d6e710d0e6fc
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: 952716
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1696007
> Reviewed-by: Hector Carmona <hcarmona@chromium.org>
> Commit-Queue: Hector Carmona <hcarmona@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#676073}

TBR=haraken@chromium.org,hcarmona@chromium.org,myid.shin@igalia.com

Change-Id: I3c1efe12f7fd40512bc5a32f41945512916585df
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 952716
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1696179Reviewed-by: default avatarHector Carmona <hcarmona@chromium.org>
Commit-Queue: Hector Carmona <hcarmona@chromium.org>
Cr-Commit-Position: refs/heads/master@{#676126}
parent a27d1657
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
#include "third_party/blink/renderer/core/html/html_slot_element.h" #include "third_party/blink/renderer/core/html/html_slot_element.h"
#include <array>
#include "third_party/blink/renderer/core/css/style_change_reason.h" #include "third_party/blink/renderer/core/css/style_change_reason.h"
#include "third_party/blink/renderer/core/css/style_engine.h" #include "third_party/blink/renderer/core/css/style_engine.h"
#include "third_party/blink/renderer/core/dom/events/event.h" #include "third_party/blink/renderer/core/dom/events/event.h"
...@@ -399,14 +397,15 @@ void HTMLSlotElement::NotifySlottedNodesOfFlatTreeChangeByDynamicProgramming( ...@@ -399,14 +397,15 @@ void HTMLSlotElement::NotifySlottedNodesOfFlatTreeChangeByDynamicProgramming(
const HeapVector<Member<Node>>& old_slotted, const HeapVector<Member<Node>>& old_slotted,
const HeapVector<Member<Node>>& new_slotted) { const HeapVector<Member<Node>>& new_slotted) {
// Use dynamic programming to minimize the number of nodes being reattached. // Use dynamic programming to minimize the number of nodes being reattached.
using LCSTable = std::array<std::array<wtf_size_t, kLCSTableSizeLimit>, using LCSTable =
kLCSTableSizeLimit>; Vector<LCSArray<wtf_size_t, kLCSTableSizeLimit>, kLCSTableSizeLimit>;
using Backtrack = std::pair<wtf_size_t, wtf_size_t>; using Backtrack = std::pair<wtf_size_t, wtf_size_t>;
using BacktrackTable = using BacktrackTable =
std::array<std::array<Backtrack, kLCSTableSizeLimit>, kLCSTableSizeLimit>; Vector<LCSArray<Backtrack, kLCSTableSizeLimit>, kLCSTableSizeLimit>;
DEFINE_STATIC_LOCAL(LCSTable*, lcs_table, (new LCSTable)); DEFINE_STATIC_LOCAL(LCSTable*, lcs_table, (new LCSTable(kLCSTableSizeLimit)));
DEFINE_STATIC_LOCAL(BacktrackTable*, backtrack_table, (new BacktrackTable)); DEFINE_STATIC_LOCAL(BacktrackTable*, backtrack_table,
(new BacktrackTable(kLCSTableSizeLimit)));
FillLongestCommonSubsequenceDynamicProgrammingTable( FillLongestCommonSubsequenceDynamicProgrammingTable(
old_slotted, new_slotted, *lcs_table, *backtrack_table); old_slotted, new_slotted, *lcs_table, *backtrack_table);
......
...@@ -148,6 +148,14 @@ class CORE_EXPORT HTMLSlotElement final : public HTMLElement { ...@@ -148,6 +148,14 @@ class CORE_EXPORT HTMLSlotElement final : public HTMLElement {
// For imperative Shadow DOM distribution APIs // For imperative Shadow DOM distribution APIs
HeapHashSet<Member<Node>> assigned_nodes_candidates_; HeapHashSet<Member<Node>> assigned_nodes_candidates_;
template <typename T, wtf_size_t S>
struct LCSArray {
LCSArray() : values(S) {}
T& operator[](wtf_size_t i) { return values[i]; }
wtf_size_t size() { return values.size(); }
Vector<T, S> values;
};
// TODO(hayato): Move this to more appropriate directory (e.g. platform/wtf) // TODO(hayato): Move this to more appropriate directory (e.g. platform/wtf)
// if there are more than one usages. // if there are more than one usages.
template <typename Container, typename LCSTable, typename BacktrackTable> template <typename Container, typename LCSTable, typename BacktrackTable>
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
#include "third_party/blink/renderer/core/html/html_slot_element.h" #include "third_party/blink/renderer/core/html/html_slot_element.h"
#include <array>
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/core/css/style_engine.h" #include "third_party/blink/renderer/core/css/style_engine.h"
#include "third_party/blink/renderer/core/dom/node_computed_style.h" #include "third_party/blink/renderer/core/dom/node_computed_style.h"
...@@ -22,10 +20,12 @@ using Backtrack = std::pair<size_t, size_t>; ...@@ -22,10 +20,12 @@ using Backtrack = std::pair<size_t, size_t>;
class HTMLSlotElementTest : public testing::Test { class HTMLSlotElementTest : public testing::Test {
protected: protected:
HTMLSlotElementTest() = default; HTMLSlotElementTest()
: lcs_table_(kTableSize), backtrack_table_(kTableSize) {}
Seq LongestCommonSubsequence(const Seq& seq1, const Seq& seq2); Seq LongestCommonSubsequence(const Seq& seq1, const Seq& seq2);
std::array<std::array<size_t, kTableSize>, kTableSize> lcs_table_; Vector<HTMLSlotElement::LCSArray<size_t, kTableSize>, kTableSize> lcs_table_;
std::array<std::array<Backtrack, kTableSize>, kTableSize> backtrack_table_; Vector<HTMLSlotElement::LCSArray<Backtrack, kTableSize>, kTableSize>
backtrack_table_;
}; };
Vector<char> HTMLSlotElementTest::LongestCommonSubsequence(const Seq& seq1, Vector<char> HTMLSlotElementTest::LongestCommonSubsequence(const Seq& seq1,
......
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