Skip to content

Commit

Permalink
exo: Use std::make_unique instead of base::MakeUnique.
Browse files Browse the repository at this point in the history
sed -i 's/base::MakeUnique/std::make_unique/g;'

Bug: 
Change-Id: I149efac017f8dc03435b970fe87ab85868def21d
Reviewed-on: https://chromium-review.googlesource.com/671863
Commit-Queue: David Reveman <reveman@chromium.org>
Commit-Queue: Daniele Castagna <dcastagna@chromium.org>
Reviewed-by: Daniele Castagna <dcastagna@chromium.org>
Cr-Commit-Position: refs/heads/master@{#502696}
  • Loading branch information
reveman-chromium authored and Commit Bot committed Sep 18, 2017
1 parent dd5e8a2 commit d0ab1fb
Show file tree
Hide file tree
Showing 16 changed files with 118 additions and 118 deletions.
4 changes: 2 additions & 2 deletions components/exo/buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ bool Buffer::ProduceTransferableResource(
// if one doesn't already exist. The contents of this buffer are copied to
// |texture| using a call to CopyTexImage.
if (!contents_texture_) {
contents_texture_ = base::MakeUnique<Texture>(
contents_texture_ = std::make_unique<Texture>(
context_factory, context_provider.get(), gpu_memory_buffer_.get(),
texture_target_, query_type_);
}
Expand Down Expand Up @@ -483,7 +483,7 @@ bool Buffer::ProduceTransferableResource(
// Create a mailbox texture that we copy the buffer contents to.
if (!texture_) {
texture_ =
base::MakeUnique<Texture>(context_factory, context_provider.get());
std::make_unique<Texture>(context_factory, context_provider.get());
}
Texture* texture = texture_.get();

Expand Down
12 changes: 6 additions & 6 deletions components/exo/buffer_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ void Release(int* release_call_count) {

TEST_F(BufferTest, ReleaseCallback) {
gfx::Size buffer_size(256, 256);
auto buffer = base::MakeUnique<Buffer>(
auto buffer = std::make_unique<Buffer>(
exo_test_helper()->CreateGpuMemoryBuffer(buffer_size));
auto surface_tree_host =
base::MakeUnique<SurfaceTreeHost>("BufferTest", nullptr);
std::make_unique<SurfaceTreeHost>("BufferTest", nullptr);
LayerTreeFrameSinkHolder* frame_sink_holder =
surface_tree_host->layer_tree_frame_sink_holder();

Expand Down Expand Up @@ -68,10 +68,10 @@ TEST_F(BufferTest, ReleaseCallback) {

TEST_F(BufferTest, IsLost) {
gfx::Size buffer_size(256, 256);
auto buffer = base::MakeUnique<Buffer>(
auto buffer = std::make_unique<Buffer>(
exo_test_helper()->CreateGpuMemoryBuffer(buffer_size));
auto surface_tree_host =
base::MakeUnique<SurfaceTreeHost>("BufferTest", nullptr);
std::make_unique<SurfaceTreeHost>("BufferTest", nullptr);
LayerTreeFrameSinkHolder* frame_sink_holder =
surface_tree_host->layer_tree_frame_sink_holder();

Expand Down Expand Up @@ -124,10 +124,10 @@ TEST_F(BufferTest, IsLost) {
TEST_F(BufferTest, OnLostResources) {
// Create a Buffer and use it to produce a Texture.
constexpr gfx::Size buffer_size(256, 256);
auto buffer = base::MakeUnique<Buffer>(
auto buffer = std::make_unique<Buffer>(
exo_test_helper()->CreateGpuMemoryBuffer(buffer_size));
auto surface_tree_host =
base::MakeUnique<SurfaceTreeHost>("BufferTest", nullptr);
std::make_unique<SurfaceTreeHost>("BufferTest", nullptr);
LayerTreeFrameSinkHolder* frame_sink_holder =
surface_tree_host->layer_tree_frame_sink_holder();

Expand Down
4 changes: 2 additions & 2 deletions components/exo/data_device_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ class DataDeviceTest : public test::ExoTestBase {
public:
void SetUp() override {
test::ExoTestBase::SetUp();
device_ = base::MakeUnique<DataDevice>(&delegate_, &file_helper_);
device_ = std::make_unique<DataDevice>(&delegate_, &file_helper_);
data_.SetString(base::string16(base::ASCIIToUTF16("Test data")));
surface_ = base::MakeUnique<Surface>();
surface_ = std::make_unique<Surface>();
}

void TearDown() override {
Expand Down
16 changes: 8 additions & 8 deletions components/exo/display.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ std::unique_ptr<SharedMemory> Display::CreateSharedMemory(
if (!base::SharedMemory::IsHandleValid(handle))
return nullptr;

return base::MakeUnique<SharedMemory>(handle);
return std::make_unique<SharedMemory>(handle);
}

#if defined(USE_OZONE)
Expand Down Expand Up @@ -128,7 +128,7 @@ std::unique_ptr<Buffer> Display::CreateLinuxDMABufBuffer(
std::find(overlay_formats_.begin(), overlay_formats_.end(), format) !=
overlay_formats_.end();

return base::MakeUnique<Buffer>(
return std::make_unique<Buffer>(
std::move(gpu_memory_buffer), GL_TEXTURE_EXTERNAL_OES,
// COMMANDS_COMPLETED queries are required by native pixmaps.
GL_COMMANDS_COMPLETED_CHROMIUM, use_zero_copy, is_overlay_candidate);
Expand All @@ -144,7 +144,7 @@ std::unique_ptr<ShellSurface> Display::CreateShellSurface(Surface* surface) {
return nullptr;
}

return base::MakeUnique<ShellSurface>(
return std::make_unique<ShellSurface>(
surface, nullptr, ShellSurface::BoundsMode::SHELL, gfx::Point(),
true /* activatable */, false /* can_minimize */,
ash::kShellWindowId_DefaultContainer);
Expand Down Expand Up @@ -175,7 +175,7 @@ std::unique_ptr<ShellSurface> Display::CreatePopupShellSurface(
->window(),
&origin);

return base::MakeUnique<ShellSurface>(
return std::make_unique<ShellSurface>(
surface, parent, ShellSurface::BoundsMode::FIXED, origin,
false /* activatable */, false /* can_minimize */,
ash::kShellWindowId_DefaultContainer);
Expand All @@ -196,7 +196,7 @@ std::unique_ptr<ShellSurface> Display::CreateRemoteShellSurface(
// Remote shell surfaces in system modal container cannot be minimized.
bool can_minimize = container != ash::kShellWindowId_SystemModalContainer;

std::unique_ptr<ShellSurface> shell_surface(base::MakeUnique<ShellSurface>(
std::unique_ptr<ShellSurface> shell_surface(std::make_unique<ShellSurface>(
surface, nullptr, ShellSurface::BoundsMode::CLIENT, gfx::Point(),
true /* activatable */, can_minimize, container));
if (scale_by_defult_device_scale_factor) {
Expand All @@ -221,7 +221,7 @@ std::unique_ptr<SubSurface> Display::CreateSubSurface(Surface* surface,
return nullptr;
}

return base::MakeUnique<SubSurface>(surface, parent);
return std::make_unique<SubSurface>(surface, parent);
}

std::unique_ptr<NotificationSurface> Display::CreateNotificationSurface(
Expand All @@ -236,13 +236,13 @@ std::unique_ptr<NotificationSurface> Display::CreateNotificationSurface(
return nullptr;
}

return base::MakeUnique<NotificationSurface>(notification_surface_manager_,
return std::make_unique<NotificationSurface>(notification_surface_manager_,
surface, notification_key);
}

std::unique_ptr<DataDevice> Display::CreateDataDevice(
DataDeviceDelegate* delegate) {
return base::MakeUnique<DataDevice>(delegate, file_helper_.get());
return std::make_unique<DataDevice>(delegate, file_helper_.get());
}

} // namespace exo
2 changes: 1 addition & 1 deletion components/exo/display_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ class TestFileHelper : public FileHelper {

TEST_F(DisplayTest, CreateDataDevice) {
TestDataDeviceDelegate device_delegate;
Display display(nullptr, base::MakeUnique<TestFileHelper>());
Display display(nullptr, std::make_unique<TestFileHelper>());

std::unique_ptr<DataDevice> device =
display.CreateDataDevice(&device_delegate);
Expand Down
12 changes: 6 additions & 6 deletions components/exo/keyboard_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ TEST_F(KeyboardTest, KeyboardObserver) {
focus_client->FocusWindow(nullptr);

MockKeyboardDelegate delegate;
auto keyboard = base::MakeUnique<Keyboard>(&delegate);
auto keyboard = std::make_unique<Keyboard>(&delegate);
MockKeyboardObserver observer;
keyboard->AddObserver(&observer);

Expand All @@ -300,7 +300,7 @@ TEST_F(KeyboardTest, NeedKeyboardKeyAcks) {
focus_client->FocusWindow(nullptr);

MockKeyboardDelegate delegate;
auto keyboard = base::MakeUnique<Keyboard>(&delegate);
auto keyboard = std::make_unique<Keyboard>(&delegate);

EXPECT_FALSE(keyboard->AreKeyboardKeyAcksNeeded());
keyboard->SetNeedKeyboardKeyAcks(true);
Expand All @@ -313,7 +313,7 @@ TEST_F(KeyboardTest, NeedKeyboardKeyAcks) {

TEST_F(KeyboardTest, AckKeyboardKey) {
std::unique_ptr<Surface> surface(new Surface);
auto shell_surface = base::MakeUnique<TestShellSurface>(surface.get());
auto shell_surface = std::make_unique<TestShellSurface>(surface.get());
gfx::Size buffer_size(10, 10);
std::unique_ptr<Buffer> buffer(
new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
Expand Down Expand Up @@ -391,7 +391,7 @@ TEST_F(KeyboardTest, AckKeyboardKey) {

TEST_F(KeyboardTest, AckKeyboardKeyMoveFocus) {
std::unique_ptr<Surface> surface(new Surface);
auto shell_surface = base::MakeUnique<TestShellSurface>(surface.get());
auto shell_surface = std::make_unique<TestShellSurface>(surface.get());
gfx::Size buffer_size(10, 10);
std::unique_ptr<Buffer> buffer(
new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
Expand Down Expand Up @@ -433,7 +433,7 @@ TEST_F(KeyboardTest, AckKeyboardKeyMoveFocus) {

TEST_F(KeyboardTest, AckKeyboardKeyExpired) {
std::unique_ptr<Surface> surface(new Surface);
auto shell_surface = base::MakeUnique<TestShellSurface>(surface.get());
auto shell_surface = std::make_unique<TestShellSurface>(surface.get());
gfx::Size buffer_size(10, 10);
std::unique_ptr<Buffer> buffer(
new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
Expand Down Expand Up @@ -504,7 +504,7 @@ class TestShellSurfaceWithMovingFocusAccelerator : public ShellSurface {
TEST_F(KeyboardTest, AckKeyboardKeyExpiredWithMovingFocusAccelerator) {
std::unique_ptr<Surface> surface(new Surface);
auto shell_surface =
base::MakeUnique<TestShellSurfaceWithMovingFocusAccelerator>(
std::make_unique<TestShellSurfaceWithMovingFocusAccelerator>(
surface.get());
gfx::Size buffer_size(10, 10);
std::unique_ptr<Buffer> buffer(
Expand Down
2 changes: 1 addition & 1 deletion components/exo/shared_memory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ std::unique_ptr<Buffer> SharedMemory::CreateBuffer(const gfx::Size& size,
// buffers. Making the copy explicit allows the buffer to be reused earlier.
bool use_zero_copy = false;

return base::MakeUnique<Buffer>(
return std::make_unique<Buffer>(
std::move(gpu_memory_buffer), GL_TEXTURE_2D,
// COMMANDS_ISSUED queries are sufficient for shared memory
// buffers as binding to texture is implemented using a call to
Expand Down
2 changes: 1 addition & 1 deletion components/exo/shared_memory_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ std::unique_ptr<SharedMemory> CreateSharedMemory(size_t size) {
base::SharedMemoryHandle handle =
base::SharedMemory::DuplicateHandle(shared_memory->handle());
DCHECK(base::SharedMemory::IsHandleValid(handle));
return base::MakeUnique<SharedMemory>(handle);
return std::make_unique<SharedMemory>(handle);
}

TEST_F(SharedMemoryTest, CreateBuffer) {
Expand Down
6 changes: 3 additions & 3 deletions components/exo/shell_surface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1490,7 +1490,7 @@ void ShellSurface::Configure() {
// Apply origin offset and resize component at the first Commit() after this
// configure request has been acknowledged.
pending_configs_.push_back(
base::MakeUnique<Config>(serial, origin_offset, resize_component,
std::make_unique<Config>(serial, origin_offset, resize_component,
std::move(configure_compositor_lock_)));
LOG_IF(WARNING, pending_configs_.size() > 100)
<< "Number of pending configure acks for shell surface has reached: "
Expand Down Expand Up @@ -1818,7 +1818,7 @@ void ShellSurface::UpdateShadow() {
bool needs_shadow_underlay = shadow_background_opacity_ > 0.f;
if (needs_shadow_underlay) {
if (!shadow_underlay_) {
shadow_underlay_ = base::MakeUnique<aura::Window>(nullptr);
shadow_underlay_ = std::make_unique<aura::Window>(nullptr);
shadow_underlay_->set_owned_by_parent(false);
DCHECK(!shadow_underlay_->owned_by_parent());
// Ensure the background area inside the shadow is solid black.
Expand Down Expand Up @@ -1857,7 +1857,7 @@ void ShellSurface::UpdateShadow() {
return;

if (!shadow_overlay_) {
shadow_overlay_ = base::MakeUnique<aura::Window>(nullptr);
shadow_overlay_ = std::make_unique<aura::Window>(nullptr);
shadow_overlay_->set_owned_by_parent(false);
DCHECK(!shadow_overlay_->owned_by_parent());
shadow_overlay_->SetEventTargetingPolicy(
Expand Down
50 changes: 25 additions & 25 deletions components/exo/sub_surface_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ namespace {
using SubSurfaceTest = test::ExoTestBase;

TEST_F(SubSurfaceTest, SetPosition) {
auto parent = base::MakeUnique<Surface>();
auto shell_surface = base::MakeUnique<ShellSurface>(parent.get());
auto surface = base::MakeUnique<Surface>();
auto sub_surface = base::MakeUnique<SubSurface>(surface.get(), parent.get());
auto parent = std::make_unique<Surface>();
auto shell_surface = std::make_unique<ShellSurface>(parent.get());
auto surface = std::make_unique<Surface>();
auto sub_surface = std::make_unique<SubSurface>(surface.get(), parent.get());

// Initial position is at the origin.
EXPECT_EQ(gfx::Point().ToString(),
Expand All @@ -41,7 +41,7 @@ TEST_F(SubSurfaceTest, SetPosition) {

// Create and commit a new sub-surface using the same surface.
sub_surface.reset();
sub_surface = base::MakeUnique<SubSurface>(surface.get(), parent.get());
sub_surface = std::make_unique<SubSurface>(surface.get(), parent.get());
parent->Commit();

// Initial position should be reset to origin.
Expand All @@ -50,15 +50,15 @@ TEST_F(SubSurfaceTest, SetPosition) {
}

TEST_F(SubSurfaceTest, PlaceAbove) {
auto parent = base::MakeUnique<Surface>();
auto shell_surface = base::MakeUnique<ShellSurface>(parent.get());
auto surface1 = base::MakeUnique<Surface>();
auto surface2 = base::MakeUnique<Surface>();
auto non_sibling_surface = base::MakeUnique<Surface>();
auto parent = std::make_unique<Surface>();
auto shell_surface = std::make_unique<ShellSurface>(parent.get());
auto surface1 = std::make_unique<Surface>();
auto surface2 = std::make_unique<Surface>();
auto non_sibling_surface = std::make_unique<Surface>();
auto sub_surface1 =
base::MakeUnique<SubSurface>(surface1.get(), parent.get());
std::make_unique<SubSurface>(surface1.get(), parent.get());
auto sub_surface2 =
base::MakeUnique<SubSurface>(surface2.get(), parent.get());
std::make_unique<SubSurface>(surface2.get(), parent.get());

ASSERT_EQ(2u, parent->window()->children().size());
EXPECT_EQ(surface1->window(), parent->window()->children()[0]);
Expand All @@ -82,15 +82,15 @@ TEST_F(SubSurfaceTest, PlaceAbove) {
}

TEST_F(SubSurfaceTest, PlaceBelow) {
auto parent = base::MakeUnique<Surface>();
auto shell_surface = base::MakeUnique<ShellSurface>(parent.get());
auto surface1 = base::MakeUnique<Surface>();
auto surface2 = base::MakeUnique<Surface>();
auto non_sibling_surface = base::MakeUnique<Surface>();
auto parent = std::make_unique<Surface>();
auto shell_surface = std::make_unique<ShellSurface>(parent.get());
auto surface1 = std::make_unique<Surface>();
auto surface2 = std::make_unique<Surface>();
auto non_sibling_surface = std::make_unique<Surface>();
auto sub_surface1 =
base::MakeUnique<SubSurface>(surface1.get(), parent.get());
std::make_unique<SubSurface>(surface1.get(), parent.get());
auto sub_surface2 =
base::MakeUnique<SubSurface>(surface2.get(), parent.get());
std::make_unique<SubSurface>(surface2.get(), parent.get());

ASSERT_EQ(2u, parent->window()->children().size());
EXPECT_EQ(surface1->window(), parent->window()->children()[0]);
Expand All @@ -114,14 +114,14 @@ TEST_F(SubSurfaceTest, PlaceBelow) {
}

TEST_F(SubSurfaceTest, SetCommitBehavior) {
auto parent = base::MakeUnique<Surface>();
auto shell_surface = base::MakeUnique<ShellSurface>(parent.get());
auto child = base::MakeUnique<Surface>();
auto grandchild = base::MakeUnique<Surface>();
auto parent = std::make_unique<Surface>();
auto shell_surface = std::make_unique<ShellSurface>(parent.get());
auto child = std::make_unique<Surface>();
auto grandchild = std::make_unique<Surface>();
auto child_sub_surface =
base::MakeUnique<SubSurface>(child.get(), parent.get());
std::make_unique<SubSurface>(child.get(), parent.get());
auto grandchild_sub_surface =
base::MakeUnique<SubSurface>(grandchild.get(), child.get());
std::make_unique<SubSurface>(grandchild.get(), child.get());

// Initial position is at the origin.
EXPECT_EQ(gfx::Point().ToString(),
Expand Down
6 changes: 3 additions & 3 deletions components/exo/surface_tree_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class CustomWindowTargeter : public aura::WindowTargeter {

SurfaceTreeHost::SurfaceTreeHost(const std::string& window_name,
aura::WindowDelegate* window_delegate) {
host_window_ = base::MakeUnique<aura::Window>(window_delegate);
host_window_ = std::make_unique<aura::Window>(window_delegate);
host_window_->SetType(aura::client::WINDOW_TYPE_CONTROL);
host_window_->SetName(window_name);
host_window_->Init(ui::LAYER_SOLID_COLOR);
Expand All @@ -87,8 +87,8 @@ SurfaceTreeHost::SurfaceTreeHost(const std::string& window_name,
// events.
host_window_->SetEventTargetingPolicy(
ui::mojom::EventTargetingPolicy::DESCENDANTS_ONLY);
host_window_->SetEventTargeter(base::MakeUnique<CustomWindowTargeter>(this));
layer_tree_frame_sink_holder_ = base::MakeUnique<LayerTreeFrameSinkHolder>(
host_window_->SetEventTargeter(std::make_unique<CustomWindowTargeter>(this));
layer_tree_frame_sink_holder_ = std::make_unique<LayerTreeFrameSinkHolder>(
this, host_window_->CreateLayerTreeFrameSink());
aura::Env::GetInstance()->context_factory()->AddObserver(this);
}
Expand Down
Loading

0 comments on commit d0ab1fb

Please sign in to comment.