Commit 304bb952 authored by Hector Carmona's avatar Hector Carmona Committed by Commit Bot

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/+/1696007Reviewed-by: default avatarHector Carmona <hcarmona@chromium.org>
Commit-Queue: Hector Carmona <hcarmona@chromium.org>
Cr-Commit-Position: refs/heads/master@{#676073}
parent fa84bfd7
......@@ -30,6 +30,8 @@
#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_engine.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
......@@ -397,15 +399,14 @@ void HTMLSlotElement::NotifySlottedNodesOfFlatTreeChangeByDynamicProgramming(
const HeapVector<Member<Node>>& old_slotted,
const HeapVector<Member<Node>>& new_slotted) {
// Use dynamic programming to minimize the number of nodes being reattached.
using LCSTable =
Vector<LCSArray<wtf_size_t, kLCSTableSizeLimit>, kLCSTableSizeLimit>;
using LCSTable = std::array<std::array<wtf_size_t, kLCSTableSizeLimit>,
kLCSTableSizeLimit>;
using Backtrack = std::pair<wtf_size_t, wtf_size_t>;
using BacktrackTable =
Vector<LCSArray<Backtrack, kLCSTableSizeLimit>, kLCSTableSizeLimit>;
std::array<std::array<Backtrack, kLCSTableSizeLimit>, kLCSTableSizeLimit>;
DEFINE_STATIC_LOCAL(LCSTable*, lcs_table, (new LCSTable(kLCSTableSizeLimit)));
DEFINE_STATIC_LOCAL(BacktrackTable*, backtrack_table,
(new BacktrackTable(kLCSTableSizeLimit)));
DEFINE_STATIC_LOCAL(LCSTable*, lcs_table, (new LCSTable));
DEFINE_STATIC_LOCAL(BacktrackTable*, backtrack_table, (new BacktrackTable));
FillLongestCommonSubsequenceDynamicProgrammingTable(
old_slotted, new_slotted, *lcs_table, *backtrack_table);
......
......@@ -148,14 +148,6 @@ class CORE_EXPORT HTMLSlotElement final : public HTMLElement {
// For imperative Shadow DOM distribution APIs
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)
// if there are more than one usages.
template <typename Container, typename LCSTable, typename BacktrackTable>
......
......@@ -4,6 +4,8 @@
#include "third_party/blink/renderer/core/html/html_slot_element.h"
#include <array>
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/core/css/style_engine.h"
#include "third_party/blink/renderer/core/dom/node_computed_style.h"
......@@ -20,12 +22,10 @@ using Backtrack = std::pair<size_t, size_t>;
class HTMLSlotElementTest : public testing::Test {
protected:
HTMLSlotElementTest()
: lcs_table_(kTableSize), backtrack_table_(kTableSize) {}
HTMLSlotElementTest() = default;
Seq LongestCommonSubsequence(const Seq& seq1, const Seq& seq2);
Vector<HTMLSlotElement::LCSArray<size_t, kTableSize>, kTableSize> lcs_table_;
Vector<HTMLSlotElement::LCSArray<Backtrack, kTableSize>, kTableSize>
backtrack_table_;
std::array<std::array<size_t, kTableSize>, kTableSize> lcs_table_;
std::array<std::array<Backtrack, kTableSize>, kTableSize> backtrack_table_;
};
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