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 @@
#include "base/bind_helpers.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_pump_type.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/stringprintf.h"
#include "base/synchronization/lock.h"
#include "base/task/single_thread_task_executor.h"
#include "base/threading/thread.h"
#include "base/threading/thread_task_runner_handle.h"
#include "net/base/test_completion_callback.h"
......@@ -525,9 +525,11 @@ class EmbeddedTestServerThreadingTestDelegate
// base::PlatformThread::Delegate:
void ThreadMain() override {
std::unique_ptr<base::MessageLoop> loop;
if (message_loop_present_on_initialize_)
loop = std::make_unique<base::MessageLoopForIO>();
std::unique_ptr<base::SingleThreadTaskExecutor> executor;
if (message_loop_present_on_initialize_) {
executor = std::make_unique<base::SingleThreadTaskExecutor>(
base::MessagePumpType::IO);
}
// Create the test server instance.
EmbeddedTestServer server(type_);
......@@ -536,14 +538,17 @@ class EmbeddedTestServerThreadingTestDelegate
ASSERT_TRUE(server.Start());
// Make a request and wait for the reply.
if (!loop)
loop = std::make_unique<base::MessageLoopForIO>();
if (!executor) {
executor = std::make_unique<base::SingleThreadTaskExecutor>(
base::MessagePumpType::IO);
}
std::unique_ptr<URLFetcher> fetcher =
URLFetcher::Create(server.GetURL("/test?q=foo"), URLFetcher::GET, this,
TRAFFIC_ANNOTATION_FOR_TESTS);
auto test_context_getter =
base::MakeRefCounted<TestURLRequestContextGetter>(loop->task_runner());
base::MakeRefCounted<TestURLRequestContextGetter>(
executor->task_runner());
fetcher->SetRequestContext(test_context_getter.get());
base::RunLoop run_loop;
quit_run_loop_ = run_loop.QuitClosure();
......@@ -553,7 +558,7 @@ class EmbeddedTestServerThreadingTestDelegate
// Shut down.
if (message_loop_present_on_shutdown_)
loop.reset();
executor.reset();
ASSERT_TRUE(server.ShutdownAndWaitUntilComplete());
}
......
......@@ -15,13 +15,14 @@
#include "base/command_line.h"
#include "base/files/file_path.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/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_executor.h"
#include "base/task/thread_pool/thread_pool.h"
#include "base/threading/thread_task_runner_handle.h"
#include "net/base/cache_type.h"
......@@ -258,7 +259,7 @@ bool ParseAndStoreSpec(const std::string& spec_str,
bool Main(int argc, char** argv) {
base::AtExitManager at_exit_manager;
base::MessageLoopForIO message_loop;
base::SingleThreadTaskExecutor executor(base::MessagePumpType::IO);
base::ThreadPoolInstance::CreateAndStartWithDefaultParams(
"disk_cache_memory_test");
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