Commit 0fafc4d4 authored by Gyuyoung Kim's avatar Gyuyoung Kim Committed by Commit Bot

Replace WTF::MakeUnique with std::make_unique in wtf of blink

 - Replacing base::MakeUnique|WTF::MakeUnique with std::make_unique
 - Replacing PtrUtil.h with <memory>

Bug: 755727
Change-Id: I7199bc382a3f9e81abaad7fc24b33d730d6c4909
Reviewed-on: https://chromium-review.googlesource.com/689816
Commit-Queue: Kent Tamura <tkent@chromium.org>
Commit-Queue: Gyuyoung Kim <gyuyoung.kim@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#505318}
parent 19e812ea
......@@ -25,7 +25,6 @@
#include "platform/wtf/FilePrintStream.h"
#include "platform/wtf/PtrUtil.h"
#include <memory>
namespace WTF {
......@@ -45,7 +44,7 @@ std::unique_ptr<FilePrintStream> FilePrintStream::Open(const char* filename,
if (!file)
return std::unique_ptr<FilePrintStream>();
return WTF::MakeUnique<FilePrintStream>(file);
return std::make_unique<FilePrintStream>(file);
}
void FilePrintStream::Vprintf(const char* format, va_list arg_list) {
......
......@@ -25,10 +25,11 @@
#include "platform/wtf/Functional.h"
#include <memory>
#include <utility>
#include "platform/wtf/RefCounted.h"
#include "platform/wtf/WeakPtr.h"
#include "testing/gtest/include/gtest/gtest.h"
#include <utility>
namespace WTF {
......@@ -306,13 +307,13 @@ TEST(FunctionalTest, MemberFunctionPartBind) {
}
TEST(FunctionalTest, MemberFunctionBindByUniquePtr) {
Function<int()> function1 = WTF::Bind(&A::F, WTF::MakeUnique<A>(10));
Function<int()> function1 = WTF::Bind(&A::F, std::make_unique<A>(10));
EXPECT_EQ(10, function1());
}
TEST(FunctionalTest, MemberFunctionBindByPassedUniquePtr) {
Function<int()> function1 =
WTF::Bind(&A::F, WTF::Passed(WTF::MakeUnique<A>(10)));
WTF::Bind(&A::F, WTF::Passed(std::make_unique<A>(10)));
EXPECT_EQ(10, function1());
}
......
......@@ -251,7 +251,7 @@ TEST(HashMapTest, AddResult) {
EXPECT_EQ(simple1, map.at(1));
IntSimpleMap::AddResult result2 =
map.insert(1, WTF::MakeUnique<SimpleClass>(2));
map.insert(1, std::make_unique<SimpleClass>(2));
EXPECT_FALSE(result2.is_new_entry);
EXPECT_EQ(1, result.stored_value->key);
EXPECT_EQ(1, result.stored_value->value->V());
......
......@@ -130,8 +130,8 @@ TEST(HashSetTest, HashSetOwnPtr) {
deleted2 = false;
{
OwnPtrSet set;
set.insert(WTF::MakeUnique<Dummy>(deleted1));
set.insert(WTF::MakeUnique<Dummy>(deleted2));
set.insert(std::make_unique<Dummy>(deleted1));
set.insert(std::make_unique<Dummy>(deleted2));
}
EXPECT_TRUE(deleted1);
EXPECT_TRUE(deleted2);
......
......@@ -147,14 +147,14 @@ class HashTableStatsPtr<Allocator, false> final {
public:
static std::unique_ptr<HashTableStats> Create() {
return base::MakeUnique<HashTableStats>();
return std::make_unique<HashTableStats>();
}
static std::unique_ptr<HashTableStats> copy(
const std::unique_ptr<HashTableStats>& other) {
if (!other)
return nullptr;
return base::MakeUnique<HashTableStats>(*other);
return std::make_unique<HashTableStats>(*other);
}
static void swap(std::unique_ptr<HashTableStats>& stats,
......
......@@ -586,8 +586,8 @@ TEST(ListHashSetTest, WithOwnPtr) {
deleted2 = false;
{
OwnPtrSet set;
set.insert(WTF::MakeUnique<Dummy>(deleted1));
set.insert(WTF::MakeUnique<Dummy>(deleted2));
set.insert(std::make_unique<Dummy>(deleted1));
set.insert(std::make_unique<Dummy>(deleted2));
}
EXPECT_TRUE(deleted1);
EXPECT_TRUE(deleted2);
......
......@@ -25,7 +25,6 @@
#include "platform/wtf/text/TextCodecUTF16.h"
#include "platform/wtf/PtrUtil.h"
#include "platform/wtf/text/CString.h"
#include "platform/wtf/text/CharacterNames.h"
#include "platform/wtf/text/StringBuffer.h"
......@@ -51,13 +50,13 @@ void TextCodecUTF16::RegisterEncodingNames(EncodingNameRegistrar registrar) {
static std::unique_ptr<TextCodec> NewStreamingTextDecoderUTF16LE(
const TextEncoding&,
const void*) {
return WTF::MakeUnique<TextCodecUTF16>(true);
return std::make_unique<TextCodecUTF16>(true);
}
static std::unique_ptr<TextCodec> NewStreamingTextDecoderUTF16BE(
const TextEncoding&,
const void*) {
return WTF::MakeUnique<TextCodecUTF16>(false);
return std::make_unique<TextCodecUTF16>(false);
}
void TextCodecUTF16::RegisterCodecs(TextCodecRegistrar registrar) {
......
......@@ -25,7 +25,6 @@
#include "platform/wtf/text/TextPosition.h"
#include "platform/wtf/PtrUtil.h"
#include "platform/wtf/StdLibExtras.h"
#include <algorithm>
#include <memory>
......@@ -33,7 +32,8 @@
namespace WTF {
std::unique_ptr<Vector<unsigned>> GetLineEndings(const String& text) {
std::unique_ptr<Vector<unsigned>> result(WTF::MakeUnique<Vector<unsigned>>());
std::unique_ptr<Vector<unsigned>> result(
std::make_unique<Vector<unsigned>>());
unsigned start = 0;
while (start < text.length()) {
......
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