Commit ba1140ff authored by Carlos Caballero's avatar Carlos Caballero Committed by Commit Bot

Remove references to MessageLoopForIO in /net

MessageLoopForIO is going away soon. Use SingleThreadTaskExecutor
instead.

This CL was uploaded by git cl split.

R=nharper@chromium.org

Bug: 891670
Change-Id: Ife2524ad96a7a7c3c7df99d996f6d101a3afa88b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1733587
Auto-Submit: Carlos Caballero <carlscab@google.com>
Commit-Queue: Nick Harper <nharper@chromium.org>
Reviewed-by: default avatarNick Harper <nharper@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683690}
parent d1a9590b
...@@ -11,13 +11,13 @@ ...@@ -11,13 +11,13 @@
#include "base/bind_helpers.h" #include "base/bind_helpers.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_pump_type.h" #include "base/message_loop/message_pump_type.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/synchronization/lock.h" #include "base/synchronization/lock.h"
#include "base/task/single_thread_task_executor.h"
#include "base/threading/thread.h" #include "base/threading/thread.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "net/base/test_completion_callback.h" #include "net/base/test_completion_callback.h"
...@@ -525,9 +525,11 @@ class EmbeddedTestServerThreadingTestDelegate ...@@ -525,9 +525,11 @@ class EmbeddedTestServerThreadingTestDelegate
// base::PlatformThread::Delegate: // base::PlatformThread::Delegate:
void ThreadMain() override { void ThreadMain() override {
std::unique_ptr<base::MessageLoop> loop; std::unique_ptr<base::SingleThreadTaskExecutor> executor;
if (message_loop_present_on_initialize_) if (message_loop_present_on_initialize_) {
loop = std::make_unique<base::MessageLoopForIO>(); executor = std::make_unique<base::SingleThreadTaskExecutor>(
base::MessagePumpType::IO);
}
// Create the test server instance. // Create the test server instance.
EmbeddedTestServer server(type_); EmbeddedTestServer server(type_);
...@@ -536,14 +538,17 @@ class EmbeddedTestServerThreadingTestDelegate ...@@ -536,14 +538,17 @@ class EmbeddedTestServerThreadingTestDelegate
ASSERT_TRUE(server.Start()); ASSERT_TRUE(server.Start());
// Make a request and wait for the reply. // Make a request and wait for the reply.
if (!loop) if (!executor) {
loop = std::make_unique<base::MessageLoopForIO>(); executor = std::make_unique<base::SingleThreadTaskExecutor>(
base::MessagePumpType::IO);
}
std::unique_ptr<URLFetcher> fetcher = std::unique_ptr<URLFetcher> fetcher =
URLFetcher::Create(server.GetURL("/test?q=foo"), URLFetcher::GET, this, URLFetcher::Create(server.GetURL("/test?q=foo"), URLFetcher::GET, this,
TRAFFIC_ANNOTATION_FOR_TESTS); TRAFFIC_ANNOTATION_FOR_TESTS);
auto test_context_getter = auto test_context_getter =
base::MakeRefCounted<TestURLRequestContextGetter>(loop->task_runner()); base::MakeRefCounted<TestURLRequestContextGetter>(
executor->task_runner());
fetcher->SetRequestContext(test_context_getter.get()); fetcher->SetRequestContext(test_context_getter.get());
base::RunLoop run_loop; base::RunLoop run_loop;
quit_run_loop_ = run_loop.QuitClosure(); quit_run_loop_ = run_loop.QuitClosure();
...@@ -553,7 +558,7 @@ class EmbeddedTestServerThreadingTestDelegate ...@@ -553,7 +558,7 @@ class EmbeddedTestServerThreadingTestDelegate
// Shut down. // Shut down.
if (message_loop_present_on_shutdown_) if (message_loop_present_on_shutdown_)
loop.reset(); executor.reset();
ASSERT_TRUE(server.ShutdownAndWaitUntilComplete()); ASSERT_TRUE(server.ShutdownAndWaitUntilComplete());
} }
......
...@@ -15,13 +15,14 @@ ...@@ -15,13 +15,14 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_pump_type.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h" #include "base/strings/string_piece.h"
#include "base/strings/string_split.h" #include "base/strings/string_split.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_executor.h"
#include "base/task/thread_pool/thread_pool.h" #include "base/task/thread_pool/thread_pool.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "net/base/cache_type.h" #include "net/base/cache_type.h"
...@@ -258,7 +259,7 @@ bool ParseAndStoreSpec(const std::string& spec_str, ...@@ -258,7 +259,7 @@ bool ParseAndStoreSpec(const std::string& spec_str,
bool Main(int argc, char** argv) { bool Main(int argc, char** argv) {
base::AtExitManager at_exit_manager; base::AtExitManager at_exit_manager;
base::MessageLoopForIO message_loop; base::SingleThreadTaskExecutor executor(base::MessagePumpType::IO);
base::ThreadPoolInstance::CreateAndStartWithDefaultParams( base::ThreadPoolInstance::CreateAndStartWithDefaultParams(
"disk_cache_memory_test"); "disk_cache_memory_test");
base::CommandLine::Init(argc, argv); base::CommandLine::Init(argc, argv);
......
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