Commit 29de4727 authored by Hidehiko Abe's avatar Hidehiko Abe Committed by Commit Bot

s/base::MakeUnique/std::make_unique/ in components/arc.

BUG=None
TEST=Ran bots.

Change-Id: Ica33fca6c8e2d4e52f9f6ece39b5082cdba61dbf
Reviewed-on: https://chromium-review.googlesource.com/675024
Commit-Queue: Hidehiko Abe <hidehiko@chromium.org>
Reviewed-by: default avatarLuis Hector Chavez <lhchavez@chromium.org>
Reviewed-by: default avatarMattias Nissler <mnissler@chromium.org>
Cr-Commit-Position: refs/heads/master@{#505311}
parent 18a1bc36
......@@ -5,7 +5,6 @@
#include "components/arc/arc_service_manager.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "components/arc/arc_bridge_service.h"
#include "components/arc/arc_session.h"
#include "components/arc/arc_session_runner.h"
......@@ -19,7 +18,7 @@ ArcServiceManager* g_arc_service_manager = nullptr;
} // namespace
ArcServiceManager::ArcServiceManager()
: arc_bridge_service_(base::MakeUnique<ArcBridgeService>()) {
: arc_bridge_service_(std::make_unique<ArcBridgeService>()) {
DCHECK(!g_arc_service_manager);
g_arc_service_manager = this;
}
......
......@@ -15,7 +15,6 @@
#include "base/files/file_util.h"
#include "base/location.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/posix/eintr_wrapper.h"
#include "base/sys_info.h"
#include "base/task_scheduler/post_task.h"
......@@ -511,7 +510,7 @@ void ArcSessionImpl::OnMojoConnected(
mojom::ArcBridgeInstancePtr instance;
instance.Bind(mojo::InterfacePtrInfo<mojom::ArcBridgeInstance>(
std::move(server_pipe), 0u));
arc_bridge_host_ = base::MakeUnique<ArcBridgeHostImpl>(arc_bridge_service_,
arc_bridge_host_ = std::make_unique<ArcBridgeHostImpl>(arc_bridge_service_,
std::move(instance));
VLOG(0) << "ARC ready.";
......@@ -699,7 +698,7 @@ void ArcSession::RemoveObserver(Observer* observer) {
// static
std::unique_ptr<ArcSession> ArcSession::Create(
ArcBridgeService* arc_bridge_service) {
return base::MakeUnique<ArcSessionImpl>(arc_bridge_service);
return std::make_unique<ArcSessionImpl>(arc_bridge_service);
}
} // namespace arc
......@@ -9,7 +9,6 @@
#include "base/bind_helpers.h"
#include "base/callback_helpers.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/test/scoped_task_environment.h"
......@@ -45,7 +44,7 @@ class ArcSessionRunnerTest : public testing::Test,
void SetUp() override {
chromeos::DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient(
base::MakeUnique<chromeos::FakeSessionManagerClient>());
std::make_unique<chromeos::FakeSessionManagerClient>());
chromeos::DBusThreadManager::Initialize();
stop_reason_ = ArcStopReason::SHUTDOWN;
......@@ -55,7 +54,7 @@ class ArcSessionRunnerTest : public testing::Test,
// We inject FakeArcSession here so we do not need task_runner.
arc_session_runner_ =
base::MakeUnique<ArcSessionRunner>(base::Bind(FakeArcSession::Create));
std::make_unique<ArcSessionRunner>(base::Bind(FakeArcSession::Create));
arc_session_runner_->AddObserver(this);
}
......@@ -89,19 +88,19 @@ class ArcSessionRunnerTest : public testing::Test,
void ResetArcSessionFactory(
const ArcSessionRunner::ArcSessionFactory& factory) {
arc_session_runner_->RemoveObserver(this);
arc_session_runner_ = base::MakeUnique<ArcSessionRunner>(factory);
arc_session_runner_ = std::make_unique<ArcSessionRunner>(factory);
arc_session_runner_->AddObserver(this);
}
static std::unique_ptr<ArcSession> CreateSuspendedArcSession() {
auto arc_session = base::MakeUnique<FakeArcSession>();
auto arc_session = std::make_unique<FakeArcSession>();
arc_session->SuspendBoot();
return std::move(arc_session);
}
static std::unique_ptr<ArcSession> CreateBootFailureArcSession(
ArcStopReason reason) {
auto arc_session = base::MakeUnique<FakeArcSession>();
auto arc_session = std::make_unique<FakeArcSession>();
arc_session->EnableBootFailureEmulation(reason);
return std::move(arc_session);
}
......
......@@ -4,12 +4,12 @@
#include "components/arc/bluetooth/bluetooth_struct_traits.h"
#include <initializer_list>
#include <map>
#include <string>
#include <utility>
#include <vector>
#include "base/memory/ptr_util.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
......@@ -43,7 +43,7 @@ struct ServiceUUIDEntry : public AdvertisementEntry {
~ServiceUUIDEntry() override {}
void AddTo(device::BluetoothAdvertisement::Data* data) override {
auto string_uuids = base::MakeUnique<std::vector<std::string>>();
auto string_uuids = std::make_unique<std::vector<std::string>>();
for (const auto& uuid : service_uuids) {
string_uuids->emplace_back(uuid.value());
}
......@@ -59,9 +59,10 @@ struct ServiceDataEntry : public AdvertisementEntry {
void AddTo(device::BluetoothAdvertisement::Data* data) override {
std::string string_uuid = base::StringPrintf("%04x", service_uuid);
using MapType = std::map<std::string, std::vector<uint8_t>>;
data->set_service_data(
base::WrapUnique(new std::map<std::string, std::vector<uint8_t>>{
{string_uuid, service_data}}));
std::make_unique<MapType, std::initializer_list<MapType::value_type>>(
{{string_uuid, service_data}}));
}
};
......@@ -72,8 +73,10 @@ struct ManufacturerDataEntry : public AdvertisementEntry {
~ManufacturerDataEntry() override {}
void AddTo(device::BluetoothAdvertisement::Data* data) override {
data->set_manufacturer_data(base::WrapUnique(
new std::map<uint16_t, std::vector<uint8_t>>{{company_id_code, blob}}));
using MapType = std::map<uint16_t, std::vector<uint8_t>>;
data->set_manufacturer_data(
std::make_unique<MapType, std::initializer_list<MapType::value_type>>(
{{company_id_code, blob}}));
}
};
......@@ -166,7 +169,7 @@ struct UnionTraits<arc::mojom::BluetoothAdvertisingDataDataView,
switch (data.tag()) {
case arc::mojom::BluetoothAdvertisingDataDataView::Tag::SERVICE_UUIDS: {
std::unique_ptr<ServiceUUIDEntry> service_uuids =
base::MakeUnique<ServiceUUIDEntry>();
std::make_unique<ServiceUUIDEntry>();
if (!data.ReadServiceUuids(&service_uuids->service_uuids))
return false;
*output = std::move(service_uuids);
......@@ -174,7 +177,7 @@ struct UnionTraits<arc::mojom::BluetoothAdvertisingDataDataView,
}
case arc::mojom::BluetoothAdvertisingDataDataView::Tag::SERVICE_DATA: {
std::unique_ptr<ServiceDataEntry> service_data =
base::MakeUnique<ServiceDataEntry>();
std::make_unique<ServiceDataEntry>();
if (!data.ReadServiceData(service_data.get()))
return false;
*output = std::move(service_data);
......@@ -183,7 +186,7 @@ struct UnionTraits<arc::mojom::BluetoothAdvertisingDataDataView,
case arc::mojom::BluetoothAdvertisingDataDataView::Tag::
MANUFACTURER_DATA: {
std::unique_ptr<ManufacturerDataEntry> manufacturer_data =
base::MakeUnique<ManufacturerDataEntry>();
std::make_unique<ManufacturerDataEntry>();
// We get manufacturer data as a big blob. The first two bytes
// should be a company identifier code and the rest is manufacturer-
// specific.
......@@ -207,7 +210,7 @@ struct UnionTraits<arc::mojom::BluetoothAdvertisingDataDataView,
// device::BluetoothAdvertisement::AdvertisementData, so data we
// don't know how to handle yet will be dropped but won't cause a
// failure to deserialize.
*output = base::MakeUnique<AdvertisementEntry>();
*output = std::make_unique<AdvertisementEntry>();
break;
}
}
......@@ -223,7 +226,7 @@ bool StructTraits<arc::mojom::BluetoothAdvertisementDataView,
device::BluetoothAdvertisement::AdvertisementType adv_type;
if (!advertisement.ReadType(&adv_type))
return false;
auto data = base::MakeUnique<device::BluetoothAdvertisement::Data>(adv_type);
auto data = std::make_unique<device::BluetoothAdvertisement::Data>(adv_type);
std::vector<std::unique_ptr<AdvertisementEntry>> adv_entries;
if (!advertisement.ReadData(&adv_entries))
......
......@@ -10,7 +10,6 @@
#include <string>
#include <vector>
#include "base/memory/ptr_util.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
......@@ -125,7 +124,7 @@ TypeConverter<arc::mojom::BluetoothSdpAttributePtr,
switch (result->type) {
case bluez::BluetoothServiceAttributeValueBlueZ::NULLTYPE:
result->value.Append(base::MakeUnique<base::Value>());
result->value.Append(std::make_unique<base::Value>());
break;
case bluez::BluetoothServiceAttributeValueBlueZ::UINT:
case bluez::BluetoothServiceAttributeValueBlueZ::INT:
......@@ -140,7 +139,7 @@ TypeConverter<arc::mojom::BluetoothSdpAttributePtr,
if (depth + 1 >= arc::kBluetoothSDPMaxDepth) {
result->type = bluez::BluetoothServiceAttributeValueBlueZ::NULLTYPE;
result->type_size = 0;
result->value.Append(base::MakeUnique<base::Value>());
result->value.Append(std::make_unique<base::Value>());
return result;
}
for (const auto& child : attr_bluez.sequence()) {
......@@ -175,7 +174,7 @@ TypeConverter<bluez::BluetoothServiceAttributeValueBlueZ,
if (attr->value.GetSize() != 1) {
return bluez::BluetoothServiceAttributeValueBlueZ(
bluez::BluetoothServiceAttributeValueBlueZ::NULLTYPE, 0,
base::MakeUnique<base::Value>());
std::make_unique<base::Value>());
}
std::unique_ptr<base::Value> value;
......@@ -188,10 +187,10 @@ TypeConverter<bluez::BluetoothServiceAttributeValueBlueZ,
if (depth + 1 >= arc::kBluetoothSDPMaxDepth || attr->sequence.empty()) {
return bluez::BluetoothServiceAttributeValueBlueZ(
bluez::BluetoothServiceAttributeValueBlueZ::NULLTYPE, 0,
base::MakeUnique<base::Value>());
std::make_unique<base::Value>());
}
auto bluez_sequence = base::MakeUnique<
auto bluez_sequence = std::make_unique<
bluez::BluetoothServiceAttributeValueBlueZ::Sequence>();
for (const auto& child : attr->sequence) {
bluez_sequence->push_back(Convert(child, depth + 1));
......@@ -205,7 +204,7 @@ TypeConverter<bluez::BluetoothServiceAttributeValueBlueZ,
}
return bluez::BluetoothServiceAttributeValueBlueZ(
bluez::BluetoothServiceAttributeValueBlueZ::NULLTYPE, 0,
base::MakeUnique<base::Value>());
std::make_unique<base::Value>());
}
// static
......
......@@ -9,7 +9,6 @@
#include <string>
#include <vector>
#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "device/bluetooth/bluetooth_gatt_service.h"
#include "device/bluetooth/bluetooth_uuid.h"
......@@ -114,7 +113,7 @@ TEST(BluetoothTypeConvertorTest, ConvertMojoValueAttributeToBlueZAttribute) {
nulltypeAttributeMojo->type =
bluez::BluetoothServiceAttributeValueBlueZ::NULLTYPE;
nulltypeAttributeMojo->type_size = 0;
nulltypeAttributeMojo->value.Append(base::MakeUnique<base::Value>());
nulltypeAttributeMojo->value.Append(std::make_unique<base::Value>());
auto nulltypeAttributeBlueZ =
nulltypeAttributeMojo.To<bluez::BluetoothServiceAttributeValueBlueZ>();
......@@ -287,7 +286,7 @@ TEST(BluetoothTypeConvertorTest,
auto sequenceNoData = arc::mojom::BluetoothSdpAttribute::New();
sequenceNoData->type = bluez::BluetoothServiceAttributeValueBlueZ::SEQUENCE;
sequenceNoData->type_size = 0;
sequenceNoData->value.Append(base::MakeUnique<base::Value>());
sequenceNoData->value.Append(std::make_unique<base::Value>());
auto sequenceNoDataBlueZ =
sequenceNoData.To<bluez::BluetoothServiceAttributeValueBlueZ>();
......@@ -329,7 +328,7 @@ TEST(BluetoothTypeConvertorTest, ConvertBlueZValueAttributeToMojoAttribute) {
int valueUint16AsInt;
auto uintAttributeBlueZ = bluez::BluetoothServiceAttributeValueBlueZ(
bluez::BluetoothServiceAttributeValueBlueZ::UINT, sizeof(valueUint16),
base::MakeUnique<base::Value>(static_cast<int>(valueUint16)));
std::make_unique<base::Value>(static_cast<int>(valueUint16)));
auto uintAttributeMojo =
ConvertTo<arc::mojom::BluetoothSdpAttributePtr>(uintAttributeBlueZ);
......@@ -345,7 +344,7 @@ TEST(BluetoothTypeConvertorTest, ConvertBlueZValueAttributeToMojoAttribute) {
bool actualBool = true;
auto boolAttributeBlueZ = bluez::BluetoothServiceAttributeValueBlueZ(
bluez::BluetoothServiceAttributeValueBlueZ::BOOL, sizeof(bool),
base::MakeUnique<base::Value>(valueBool));
std::make_unique<base::Value>(valueBool));
auto boolAttributeMojo =
ConvertTo<arc::mojom::BluetoothSdpAttributePtr>(boolAttributeBlueZ);
......@@ -362,7 +361,7 @@ TEST(BluetoothTypeConvertorTest, ConvertBlueZValueAttributeToMojoAttribute) {
std::string actualUUID;
auto uuidAttributeBlueZ = bluez::BluetoothServiceAttributeValueBlueZ(
bluez::BluetoothServiceAttributeValueBlueZ::UUID, sizeof(uint16_t),
base::MakeUnique<base::Value>(valueUUID));
std::make_unique<base::Value>(valueUUID));
auto uuidAttributeMojo =
ConvertTo<arc::mojom::BluetoothSdpAttributePtr>(uuidAttributeBlueZ);
......@@ -379,7 +378,7 @@ TEST(BluetoothTypeConvertorTest, ConvertBlueZValueAttributeToMojoAttribute) {
std::string actualString;
auto stringAttributeBlueZ = bluez::BluetoothServiceAttributeValueBlueZ(
bluez::BluetoothServiceAttributeValueBlueZ::STRING, valueString.length(),
base::MakeUnique<base::Value>(valueString));
std::make_unique<base::Value>(valueString));
auto stringAttributeMojo =
ConvertTo<arc::mojom::BluetoothSdpAttributePtr>(stringAttributeBlueZ);
......@@ -400,10 +399,10 @@ TEST(BluetoothTypeConvertorTest, ConvertBlueZSequenceAttributeToMojoAttribute) {
sequence(new bluez::BluetoothServiceAttributeValueBlueZ::Sequence());
sequence->push_back(bluez::BluetoothServiceAttributeValueBlueZ(
bluez::BluetoothServiceAttributeValueBlueZ::UUID, sizeof(uint16_t),
base::MakeUnique<base::Value>(l2capUUID)));
std::make_unique<base::Value>(l2capUUID)));
sequence->push_back(bluez::BluetoothServiceAttributeValueBlueZ(
bluez::BluetoothServiceAttributeValueBlueZ::UINT, sizeof(uint16_t),
base::MakeUnique<base::Value>(l2capChannel)));
std::make_unique<base::Value>(l2capChannel)));
auto sequenceBlueZ =
bluez::BluetoothServiceAttributeValueBlueZ(std::move(sequence));
......
......@@ -145,13 +145,13 @@ class ArcImeServiceTest : public testing::Test {
private:
void SetUp() override {
arc_bridge_service_ = base::MakeUnique<ArcBridgeService>();
arc_bridge_service_ = std::make_unique<ArcBridgeService>();
instance_ =
base::MakeUnique<ArcImeService>(nullptr, arc_bridge_service_.get());
std::make_unique<ArcImeService>(nullptr, arc_bridge_service_.get());
fake_arc_ime_bridge_ = new FakeArcImeBridge();
instance_->SetImeBridgeForTesting(base::WrapUnique(fake_arc_ime_bridge_));
fake_input_method_ = base::MakeUnique<FakeInputMethod>();
fake_input_method_ = std::make_unique<FakeInputMethod>();
instance_->SetInputMethodForTesting(fake_input_method_.get());
fake_window_delegate_ = new FakeArcWindowDelegate();
......
......@@ -11,7 +11,6 @@
#include "base/base64.h"
#include "base/bind.h"
#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
#include "base/task_scheduler/post_task.h"
#include "components/arc/arc_bridge_service.h"
......@@ -81,7 +80,7 @@ mojom::IntentHelperInstance* GetInstanceForRequestActivityIcons(
std::unique_ptr<ActivityIconLoader::ActivityToIconsMap> ResizeAndEncodeIcons(
std::vector<mojom::ActivityIconPtr> icons) {
auto result = base::MakeUnique<ActivityIconLoader::ActivityToIconsMap>();
auto result = std::make_unique<ActivityIconLoader::ActivityToIconsMap>();
for (size_t i = 0; i < icons.size(); ++i) {
static const size_t kBytesPerPixel = 4;
const mojom::ActivityIconPtr& icon = icons.at(i);
......@@ -214,7 +213,7 @@ ActivityIconLoader::GetResult ActivityIconLoader::GetActivityIcons(
void ActivityIconLoader::OnIconsResizedForTesting(
const OnIconsReadyCallback& cb,
std::unique_ptr<ActivityToIconsMap> result) {
OnIconsResized(base::MakeUnique<ActivityToIconsMap>(), cb, std::move(result));
OnIconsResized(std::make_unique<ActivityToIconsMap>(), cb, std::move(result));
}
void ActivityIconLoader::AddCacheEntryForTesting(const ActivityName& activity) {
......
......@@ -4,9 +4,9 @@
#include "components/arc/intent_helper/arc_intent_helper_bridge.h"
#include <memory>
#include <utility>
#include "base/memory/ptr_util.h"
#include "components/arc/arc_bridge_service.h"
#include "components/arc/common/intent_helper.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"
......@@ -32,8 +32,8 @@ class ArcIntentHelperTest : public testing::Test {
private:
void SetUp() override {
arc_bridge_service_ = base::MakeUnique<ArcBridgeService>();
instance_ = base::MakeUnique<ArcIntentHelperBridge>(
arc_bridge_service_ = std::make_unique<ArcBridgeService>();
instance_ = std::make_unique<ArcIntentHelperBridge>(
nullptr /* context */, arc_bridge_service_.get());
}
......@@ -151,7 +151,7 @@ TEST_F(ArcIntentHelperTest, TestObserver) {
};
// Observer should be called when intent filter is updated.
auto observer = base::MakeUnique<FakeObserver>();
auto observer = std::make_unique<FakeObserver>();
instance_->AddObserver(observer.get());
EXPECT_FALSE(observer->IsUpdated());
instance_->OnIntentFiltersUpdated(std::vector<IntentFilter>());
......
......@@ -12,7 +12,6 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/memory/ptr_util.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
......@@ -63,14 +62,14 @@ void FakeAppInstance::LaunchAppDeprecated(
void FakeAppInstance::LaunchApp(const std::string& package_name,
const std::string& activity,
int64_t display_id) {
launch_requests_.push_back(base::MakeUnique<Request>(package_name, activity));
launch_requests_.push_back(std::make_unique<Request>(package_name, activity));
}
void FakeAppInstance::RequestAppIcon(const std::string& package_name,
const std::string& activity,
mojom::ScaleFactor scale_factor) {
icon_requests_.push_back(
base::MakeUnique<IconRequest>(package_name, activity, scale_factor));
std::make_unique<IconRequest>(package_name, activity, scale_factor));
}
void FakeAppInstance::SendRefreshAppList(
......@@ -352,7 +351,7 @@ void FakeAppInstance::RequestIcon(const std::string& icon_resource_id,
arc::mojom::ScaleFactor scale_factor,
RequestIconCallback callback) {
shortcut_icon_requests_.push_back(
base::MakeUnique<ShortcutIconRequest>(icon_resource_id, scale_factor));
std::make_unique<ShortcutIconRequest>(icon_resource_id, scale_factor));
std::string png_data_as_string;
if (GetFakeIcon(scale_factor, &png_data_as_string)) {
......
......@@ -78,7 +78,7 @@ void FakeArcSession::SuspendBoot() {
// static
std::unique_ptr<ArcSession> FakeArcSession::Create() {
return base::MakeUnique<FakeArcSession>();
return std::make_unique<FakeArcSession>();
}
} // namespace arc
......@@ -4,7 +4,6 @@
#include <utility>
#include "base/memory/ptr_util.h"
#include "components/arc/test/fake_bluetooth_instance.h"
namespace arc {
......@@ -60,7 +59,7 @@ void FakeBluetoothInstance::OnLEDeviceFound(
mojom::BluetoothAddressPtr addr,
int32_t rssi,
std::vector<mojom::BluetoothAdvertisingDataPtr> adv_data) {
le_device_found_data_.push_back(base::MakeUnique<LEDeviceFoundData>(
le_device_found_data_.push_back(std::make_unique<LEDeviceFoundData>(
std::move(addr), rssi, std::move(adv_data)));
}
......@@ -80,7 +79,7 @@ void FakeBluetoothInstance::OnGetGattDB(
mojom::BluetoothAddressPtr remote_addr,
std::vector<mojom::BluetoothGattDBElementPtr> db) {
gatt_db_result_.push_back(
base::MakeUnique<GattDBResult>(std::move(remote_addr), std::move(db)));
std::make_unique<GattDBResult>(std::move(remote_addr), std::move(db)));
}
void FakeBluetoothInstance::OnServicesRemoved(
......
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