Commit 64f36e3c authored by Gabriel Charette's avatar Gabriel Charette Committed by Commit Bot

[base] Make PostTask destination explicit in /chromeos/dbus

Task APIs v3 will all have an explicit destination. In the past
"default traits" meant ThreadPool. These CLs are thus a no-op
except for the few callers that clearly wanted to post a QuitClosure()
on the current thread (posting a QuitClosure() to a parallel task will
merely bounce it back to the current thread anyways). Those few callers
were migrated to ThreadTaskRunnerHandle::Get().

These changes are thus required to phase out task APIs v2 (post_task.h)
Design doc: https://docs.google.com/document/d/1tssusPykvx3g0gvbvU4HxGyn3MjJlIylnsH13-Tv6s4/edit

This specific change is a subset of
https://chromium-review.googlesource.com/c/chromium/src/+/2216733

This CL was uploaded by git cl split.

R=stevenjb@chromium.org

Bug: 1026641
Change-Id: I086268457874e00af01eb548db5322ee9cf2402a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2215916
Commit-Queue: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Auto-Submit: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772762}
parent 42fef12c
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/optional.h" #include "base/optional.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/task/post_task.h" #include "base/task/thread_pool.h"
#include "base/task_runner.h" #include "base/task_runner.h"
#include "base/test/task_environment.h" #include "base/test/task_environment.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -74,8 +74,8 @@ TEST_F(PipeReaderTest, SmallData) { ...@@ -74,8 +74,8 @@ TEST_F(PipeReaderTest, SmallData) {
base::Optional<std::string> output; base::Optional<std::string> output;
base::ScopedFD write_fd = base::ScopedFD write_fd =
reader->StartIO(base::BindOnce(&CopyResult, &run_loop, &output)); reader->StartIO(base::BindOnce(&CopyResult, &run_loop, &output));
base::PostTask(FROM_HERE, base::ThreadPool::PostTask(
base::BindOnce(&WriteData, std::move(write_fd), kSmallData)); FROM_HERE, base::BindOnce(&WriteData, std::move(write_fd), kSmallData));
run_loop.Run(); run_loop.Run();
EXPECT_EQ(std::string(kSmallData), output); EXPECT_EQ(std::string(kSmallData), output);
} }
...@@ -89,8 +89,8 @@ TEST_F(PipeReaderTest, LargeData) { ...@@ -89,8 +89,8 @@ TEST_F(PipeReaderTest, LargeData) {
base::Optional<std::string> output; base::Optional<std::string> output;
base::ScopedFD write_fd = base::ScopedFD write_fd =
reader->StartIO(base::BindOnce(&CopyResult, &run_loop, &output)); reader->StartIO(base::BindOnce(&CopyResult, &run_loop, &output));
base::PostTask(FROM_HERE, base::ThreadPool::PostTask(
base::BindOnce(&WriteData, std::move(write_fd), large_data)); FROM_HERE, base::BindOnce(&WriteData, std::move(write_fd), large_data));
run_loop.Run(); run_loop.Run();
EXPECT_EQ(large_data, output); EXPECT_EQ(large_data, output);
} }
......
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