Commit 37701981 authored by Miyoung Shin's avatar Miyoung Shin Committed by Commit Bot

Replace use of std containers with WTF's equivalents in *test.cc

This CL replaces the use of std::array of std containers with
WTF::Vector in *test.cc files and removes unnecessary including
<array> header.

Bug: 952716
Change-Id: Ifb5349c03921a61394fc438e5d0501f3c8f9ac99
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1695361Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Miyoung Shin <myid.shin@igalia.com>
Cr-Commit-Position: refs/heads/master@{#676298}
parent 4b284f29
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "third_party/blink/renderer/platform/audio/vector_math.h" #include "third_party/blink/renderer/platform/audio/vector_math.h"
#include <algorithm> #include <algorithm>
#include <array>
#include <cmath> #include <cmath>
#include <limits> #include <limits>
#include <numeric> #include <numeric>
...@@ -168,10 +167,8 @@ class TestVector { ...@@ -168,10 +167,8 @@ class TestVector {
// Get primary input vectors with difference memory layout and size // Get primary input vectors with difference memory layout and size
// combinations. // combinations.
template <typename T> template <typename T>
std::array<TestVector<const T>, kVectorSizeCount * kMemoryLayoutCount> Vector<TestVector<const T>> GetPrimaryVectors(const T* base) {
GetPrimaryVectors(const T* base) { Vector<TestVector<const T>> vectors(kVectorSizeCount * kMemoryLayoutCount);
std::array<TestVector<const T>, kVectorSizeCount * kMemoryLayoutCount>
vectors;
for (auto& vector : vectors) { for (auto& vector : vectors) {
ptrdiff_t i = &vector - &vectors[0]; ptrdiff_t i = &vector - &vectors[0];
ptrdiff_t memory_layout_index = i % kMemoryLayoutCount; ptrdiff_t memory_layout_index = i % kMemoryLayoutCount;
...@@ -191,11 +188,11 @@ GetPrimaryVectors(const T* base) { ...@@ -191,11 +188,11 @@ GetPrimaryVectors(const T* base) {
// and which therefore is not aligned when the primary input vector is // and which therefore is not aligned when the primary input vector is
// aligned. // aligned.
template <typename T> template <typename T>
std::array<TestVector<T>, 2u> GetSecondaryVectors( Vector<TestVector<T>> GetSecondaryVectors(
T* base, T* base,
const MemoryLayout* primary_memory_layout, const MemoryLayout* primary_memory_layout,
size_t size) { size_t size) {
std::array<TestVector<T>, 2u> vectors; Vector<TestVector<T>> vectors(2u);
const MemoryLayout* other_memory_layout = const MemoryLayout* other_memory_layout =
&kMemoryLayouts[primary_memory_layout == &kMemoryLayouts[0]]; &kMemoryLayouts[primary_memory_layout == &kMemoryLayouts[0]];
CHECK_NE(primary_memory_layout, other_memory_layout); CHECK_NE(primary_memory_layout, other_memory_layout);
...@@ -207,7 +204,7 @@ std::array<TestVector<T>, 2u> GetSecondaryVectors( ...@@ -207,7 +204,7 @@ std::array<TestVector<T>, 2u> GetSecondaryVectors(
} }
template <typename T> template <typename T>
std::array<TestVector<T>, 2u> GetSecondaryVectors( Vector<TestVector<T>> GetSecondaryVectors(
T* base, T* base,
const TestVector<const float>& primary_vector) { const TestVector<const float>& primary_vector) {
return GetSecondaryVectors(base, primary_vector.memory_layout(), return GetSecondaryVectors(base, primary_vector.memory_layout(),
...@@ -440,8 +437,9 @@ TEST_F(VectorMathTest, Vsvesq) { ...@@ -440,8 +437,9 @@ TEST_F(VectorMathTest, Vsvesq) {
TEST_F(VectorMathTest, Zvmul) { TEST_F(VectorMathTest, Zvmul) {
constexpr float kMax = std::numeric_limits<float>::max(); constexpr float kMax = std::numeric_limits<float>::max();
Vector<std::array<float, kFloatArraySize + 1u>> sources(4u); Vector<Vector<float>> sources(4u);
for (size_t i = 0u; i < sources.size(); ++i) { for (size_t i = 0u; i < sources.size(); ++i) {
sources[i].resize(kFloatArraySize);
// Initialize a local source with a randomized test case source. // Initialize a local source with a randomized test case source.
std::copy_n(GetSource(i), kFloatArraySize, sources[i].begin()); std::copy_n(GetSource(i), kFloatArraySize, sources[i].begin());
// Put +FLT_MAX and -FLT_MAX in the middle of the source. Use a different // Put +FLT_MAX and -FLT_MAX in the middle of the source. Use a different
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_LAB_COLOR_SPACE_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_LAB_COLOR_SPACE_H_
#include <algorithm> #include <algorithm>
#include <array>
#include <cmath> #include <cmath>
#include <initializer_list> #include <initializer_list>
#include <iterator> #include <iterator>
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "third_party/blink/renderer/platform/image-decoders/segment_stream.h" #include "third_party/blink/renderer/platform/image-decoders/segment_stream.h"
#include <array>
#include "base/memory/scoped_refptr.h" #include "base/memory/scoped_refptr.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/platform/image-decoders/segment_reader.h" #include "third_party/blink/renderer/platform/image-decoders/segment_reader.h"
...@@ -671,7 +670,7 @@ SegmentStream CreatePopulatedSegmentStream() { ...@@ -671,7 +670,7 @@ SegmentStream CreatePopulatedSegmentStream() {
} }
scoped_refptr<SegmentReader> CreateSegmentReader() { scoped_refptr<SegmentReader> CreateSegmentReader() {
std::array<char, kBufferAllocationSize> raw_buffer; Vector<char> raw_buffer(kBufferAllocationSize);
scoped_refptr<SharedBuffer> shared_buffer = scoped_refptr<SharedBuffer> shared_buffer =
SharedBuffer::Create(raw_buffer.data(), kBufferAllocationSize); SharedBuffer::Create(raw_buffer.data(), kBufferAllocationSize);
...@@ -684,13 +683,13 @@ scoped_refptr<SegmentReader> CreateSegmentReader() { ...@@ -684,13 +683,13 @@ scoped_refptr<SegmentReader> CreateSegmentReader() {
size_t ReadFromSegmentStream(SegmentStream& segment_stream, size_t ReadFromSegmentStream(SegmentStream& segment_stream,
size_t amount_to_read) { size_t amount_to_read) {
std::array<char, kBufferAllocationSize> read_buffer; Vector<char> read_buffer(kBufferAllocationSize);
return segment_stream.read(read_buffer.data(), amount_to_read); return segment_stream.read(read_buffer.data(), amount_to_read);
} }
size_t PeekIntoSegmentStream(SegmentStream& segment_stream, size_t PeekIntoSegmentStream(SegmentStream& segment_stream,
size_t amount_to_peek) { size_t amount_to_peek) {
std::array<char, kBufferAllocationSize> peek_buffer; Vector<char> peek_buffer(kBufferAllocationSize);
return segment_stream.peek(peek_buffer.data(), amount_to_peek); return segment_stream.peek(peek_buffer.data(), amount_to_peek);
} }
......
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