Commit 829a4156 authored by kylechar's avatar kylechar Committed by Commit Bot

services/viz: Cleanup deprecated callback types.

Remove some usage of deprecated callback types in services/viz/*. Where
possible convert to the corresponding once type, otherwise replace with
the repeating type.

Bug: 714018
Change-Id: I241bbfff47b705f448790e13b2089fe10425e280
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1841235Reviewed-by: default avatarJonathan Ross <jonross@chromium.org>
Reviewed-by: default avatarMatthew Denton <mpdenton@chromium.org>
Auto-Submit: kylechar <kylechar@chromium.org>
Commit-Queue: Matthew Denton <mpdenton@chromium.org>
Cr-Commit-Position: refs/heads/master@{#703102}
parent 09a85e37
......@@ -206,7 +206,7 @@ bool StructTraits<viz::mojom::CopyOutputResultDataView,
*out_p = std::make_unique<viz::CopyOutputTextureResult>(
rect, *mailbox, *sync_token, *color_space,
viz::SingleReleaseCallback::Create(
base::Bind(&Release, base::Passed(&releaser))));
base::BindOnce(&Release, std::move(releaser))));
return true;
}
......
......@@ -236,12 +236,12 @@ TEST_F(StructTraitsTest, CopyOutputRequest_BitmapRequest) {
std::unique_ptr<CopyOutputRequest> input(new CopyOutputRequest(
result_format,
base::BindOnce(
[](const base::Closure& quit_closure, const gfx::Rect& expected_rect,
[](base::OnceClosure quit_closure, const gfx::Rect& expected_rect,
std::unique_ptr<CopyOutputResult> result) {
EXPECT_EQ(expected_rect, result->rect());
// Note: CopyOutputResult plumbing for bitmap requests is tested in
// StructTraitsTest.CopyOutputResult_Bitmap.
quit_closure.Run();
std::move(quit_closure).Run();
},
run_loop.QuitClosure(), result_rect)));
input->SetScaleRatio(scale_from, scale_to);
......@@ -283,10 +283,10 @@ TEST_F(StructTraitsTest, CopyOutputRequest_MessagePipeBroken) {
auto request = std::make_unique<CopyOutputRequest>(
CopyOutputRequest::ResultFormat::RGBA_BITMAP,
base::BindOnce(
[](const base::Closure& quit_closure,
[](base::OnceClosure quit_closure,
std::unique_ptr<CopyOutputResult> result) {
EXPECT_TRUE(result->IsEmpty());
quit_closure.Run();
std::move(quit_closure).Run();
},
run_loop.QuitClosure()));
auto result_sender = mojo::StructTraits<
......@@ -313,12 +313,12 @@ TEST_F(StructTraitsTest, CopyOutputRequest_TextureRequest) {
std::unique_ptr<CopyOutputRequest> input(new CopyOutputRequest(
result_format,
base::BindOnce(
[](const base::Closure& quit_closure, const gfx::Rect& expected_rect,
[](base::OnceClosure quit_closure, const gfx::Rect& expected_rect,
std::unique_ptr<CopyOutputResult> result) {
EXPECT_EQ(expected_rect, result->rect());
// Note: CopyOutputResult plumbing for texture requests is tested in
// StructTraitsTest.CopyOutputResult_Texture.
quit_closure.Run();
std::move(quit_closure).Run();
},
run_loop_for_result.QuitClosure(), result_rect)));
EXPECT_FALSE(input->is_scaled());
......@@ -334,13 +334,13 @@ TEST_F(StructTraitsTest, CopyOutputRequest_TextureRequest) {
base::RunLoop run_loop_for_release;
output->SendResult(std::make_unique<CopyOutputTextureResult>(
result_rect, mailbox, sync_token, gfx::ColorSpace::CreateSRGB(),
SingleReleaseCallback::Create(base::Bind(
[](const base::Closure& quit_closure,
SingleReleaseCallback::Create(base::BindOnce(
[](base::OnceClosure quit_closure,
const gpu::SyncToken& expected_sync_token,
const gpu::SyncToken& sync_token, bool is_lost) {
EXPECT_EQ(expected_sync_token, sync_token);
EXPECT_FALSE(is_lost);
quit_closure.Run();
std::move(quit_closure).Run();
},
run_loop_for_release.QuitClosure(), sync_token))));
......@@ -1245,12 +1245,13 @@ TEST_F(StructTraitsTest, CopyOutputResult_Texture) {
71234838);
sync_token.SetVerifyFlush();
base::RunLoop run_loop;
auto callback = SingleReleaseCallback::Create(base::Bind(
[](base::Closure quit_closure, const gpu::SyncToken& expected_sync_token,
auto callback = SingleReleaseCallback::Create(base::BindOnce(
[](base::OnceClosure quit_closure,
const gpu::SyncToken& expected_sync_token,
const gpu::SyncToken& sync_token, bool is_lost) {
EXPECT_EQ(expected_sync_token, sync_token);
EXPECT_TRUE(is_lost);
quit_closure.Run();
std::move(quit_closure).Run();
},
run_loop.QuitClosure(), sync_token));
gpu::Mailbox mailbox;
......
......@@ -100,8 +100,9 @@ class GpuTest : public testing::Test {
base::RunLoop run_loop;
io_thread_.task_runner()->PostTask(
FROM_HERE,
base::BindOnce([](base::Closure callback) { callback.Run(); },
run_loop.QuitClosure()));
base::BindOnce(
[](base::OnceClosure callback) { std::move(callback).Run(); },
run_loop.QuitClosure()));
run_loop.Run();
}
......@@ -173,13 +174,13 @@ TEST_F(GpuTest, EstablishRequestsQueued) {
base::RunLoop run_loop;
// A callback that decrements the counter, and runs the callback when the
// counter reaches 0.
auto callback = base::Bind(
[](int* counter, const base::Closure& callback,
auto callback = base::BindRepeating(
[](int* counter, base::OnceClosure callback,
scoped_refptr<gpu::GpuChannelHost> channel) {
EXPECT_TRUE(channel);
--(*counter);
if (*counter == 0)
callback.Run();
std::move(callback).Run();
},
&counter, run_loop.QuitClosure());
gpu()->EstablishGpuChannel(callback);
......@@ -199,9 +200,8 @@ TEST_F(GpuTest, EstablishRequestOnFailureOnPreviousRequest) {
scoped_refptr<gpu::GpuChannelHost> host;
auto callback = base::BindOnce(
[](scoped_refptr<gpu::GpuChannelHost>* out_host,
const base::Closure& callback,
scoped_refptr<gpu::GpuChannelHost> host) {
callback.Run();
base::OnceClosure callback, scoped_refptr<gpu::GpuChannelHost> host) {
std::move(callback).Run();
*out_host = std::move(host);
},
&host, run_loop.QuitClosure());
......@@ -226,10 +226,9 @@ TEST_F(GpuTest, EstablishRequestOnFailureOnPreviousRequest) {
TEST_F(GpuTest, EstablishRequestResponseSynchronouslyOnSuccess) {
base::RunLoop run_loop;
gpu()->EstablishGpuChannel(base::BindOnce(
[](const base::Closure& callback,
scoped_refptr<gpu::GpuChannelHost> host) {
[](base::OnceClosure callback, scoped_refptr<gpu::GpuChannelHost> host) {
EXPECT_TRUE(host);
callback.Run();
std::move(callback).Run();
},
run_loop.QuitClosure()));
run_loop.Run();
......
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