Introduce SingleThreadTaskExecutor the replacement for base::MessageLoop
A large but mostly trivial patch in preparation for removing
base::MessageLoop. We introduce SingleThreadTaskExecutor a simple FIFO
scheduler, which is intended for non-test code that needs a simple
single threaded task environment. Tests should use ScopedTaskEnvironment
or TestBrowserThreadBundle instead.
This patch also moves MessageLoop::Type to MessagePump::Type and
moves the factory method to MessagePump::Create.
[email protected]
Change-Id: I9850c4657bb90b62490f4313c420cae025101371
BUG: 891670
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1632216
Reviewed-by: Alex Clarke <[email protected]>
Reviewed-by: Gabriel Charette <[email protected]>
Commit-Queue: Alex Clarke <[email protected]>
Cr-Commit-Position: refs/heads/master@{#664709}
diff --git a/ppapi/proxy/ppb_message_loop_proxy.cc b/ppapi/proxy/ppb_message_loop_proxy.cc
index 71bcfa0..a2a2bb8 100644
--- a/ppapi/proxy/ppb_message_loop_proxy.cc
+++ b/ppapi/proxy/ppb_message_loop_proxy.cc
@@ -91,7 +91,7 @@
AddRef();
slot->Set(this);
- loop_.reset(new base::MessageLoop);
+ single_thread_task_executor_.reset(new base::SingleThreadTaskExecutor);
task_runner_ = base::ThreadTaskRunnerHandle::Get();
// Post all pending work to the message loop.
@@ -123,7 +123,7 @@
if (should_destroy_ && nested_invocations_ == 0) {
task_runner_ = NULL;
- loop_.reset();
+ single_thread_task_executor_.reset();
destroyed_ = true;
}
return PP_OK;
@@ -172,7 +172,7 @@
// Note that the message loop must be destroyed on the thread it was created
// on.
task_runner_ = NULL;
- loop_.reset();
+ single_thread_task_executor_.reset();
// Cancel out the AddRef in AttachToCurrentThread().
Release();