summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorskyostil <skyostil@chromium.org>2015-06-12 05:54:26 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-12 12:55:14 +0000
commit23490d44633f4eaeb76e03384e08e9fd3ef2909a (patch)
tree93b5e9df30ae93c9224ffc4adff60e7936f8565a /ppapi
parent0259835b7866b32d6ff36123914685c2d94410d4 (diff)
downloadchromium_src-23490d44633f4eaeb76e03384e08e9fd3ef2909a.zip
chromium_src-23490d44633f4eaeb76e03384e08e9fd3ef2909a.tar.gz
chromium_src-23490d44633f4eaeb76e03384e08e9fd3ef2909a.tar.bz2
ppapi: Remove use of MessageLoopProxy and deprecated MessageLoop APIs
This patch was mostly autogenerated with https://codereview.chromium.org/1010073002/. BUG=465354 TBR=sievers@chromium.org Review URL: https://codereview.chromium.org/1174543002 Cr-Commit-Position: refs/heads/master@{#334148}
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/host/resource_message_filter.cc27
-rw-r--r--ppapi/host/resource_message_filter.h8
-rw-r--r--ppapi/host/resource_message_filter_unittest.cc22
-rw-r--r--ppapi/nacl_irt/manifest_service.cc9
-rw-r--r--ppapi/nacl_irt/manifest_service.h4
-rw-r--r--ppapi/nacl_irt/plugin_main.cc7
-rw-r--r--ppapi/nacl_irt/plugin_startup.cc14
-rw-r--r--ppapi/nacl_irt/ppapi_dispatcher.cc18
-rw-r--r--ppapi/nacl_irt/ppapi_dispatcher.h6
-rw-r--r--ppapi/proxy/message_handler.cc34
-rw-r--r--ppapi/proxy/network_monitor_resource.h4
-rw-r--r--ppapi/proxy/plugin_globals.cc4
-rw-r--r--ppapi/proxy/plugin_message_filter.cc4
-rw-r--r--ppapi/proxy/ppapi_proxy_test.cc77
-rw-r--r--ppapi/proxy/ppapi_proxy_test.h51
-rw-r--r--ppapi/proxy/ppb_message_loop_proxy.cc22
-rw-r--r--ppapi/proxy/ppb_message_loop_proxy.h11
-rw-r--r--ppapi/proxy/resource_reply_thread_registrar.cc12
-rw-r--r--ppapi/proxy/resource_reply_thread_registrar.h10
-rw-r--r--ppapi/proxy/tracked_callback_unittest.cc9
-rw-r--r--ppapi/shared_impl/ppapi_globals.cc13
-rw-r--r--ppapi/shared_impl/ppapi_globals.h10
-rw-r--r--ppapi/shared_impl/ppb_message_loop_shared.h4
-rw-r--r--ppapi/shared_impl/thread_aware_callback_unittest.cc9
-rw-r--r--ppapi/shared_impl/tracked_callback.cc7
25 files changed, 192 insertions, 204 deletions
diff --git a/ppapi/host/resource_message_filter.cc b/ppapi/host/resource_message_filter.cc
index 1757ad5..d08f525 100644
--- a/ppapi/host/resource_message_filter.cc
+++ b/ppapi/host/resource_message_filter.cc
@@ -5,9 +5,10 @@
#include "ppapi/host/resource_message_filter.h"
#include "base/bind.h"
-#include "base/message_loop/message_loop.h"
-#include "base/message_loop/message_loop_proxy.h"
+#include "base/location.h"
+#include "base/single_thread_task_runner.h"
#include "base/task_runner.h"
+#include "base/thread_task_runner_handle.h"
#include "ipc/ipc_message.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/host/ppapi_host.h"
@@ -21,10 +22,10 @@ namespace internal {
// static
void ResourceMessageFilterDeleteTraits::Destruct(
const ResourceMessageFilter* filter) {
- if (!filter->deletion_message_loop_proxy_->BelongsToCurrentThread()) {
+ if (!filter->deletion_task_runner_->BelongsToCurrentThread()) {
// During shutdown the object may not be deleted, but it should be okay to
// leak in that case.
- filter->deletion_message_loop_proxy_->DeleteSoon(FROM_HERE, filter);
+ filter->deletion_task_runner_->DeleteSoon(FROM_HERE, filter);
} else {
delete filter;
}
@@ -33,18 +34,15 @@ void ResourceMessageFilterDeleteTraits::Destruct(
} // namespace internal
ResourceMessageFilter::ResourceMessageFilter()
- : deletion_message_loop_proxy_(
- base::MessageLoop::current()->message_loop_proxy()),
- reply_thread_message_loop_proxy_(
- base::MessageLoop::current()->message_loop_proxy()),
+ : deletion_task_runner_(base::ThreadTaskRunnerHandle::Get()),
+ reply_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
resource_host_(NULL) {
}
ResourceMessageFilter::ResourceMessageFilter(
- scoped_refptr<base::MessageLoopProxy> reply_thread_message_loop_proxy)
- : deletion_message_loop_proxy_(
- base::MessageLoop::current()->message_loop_proxy()),
- reply_thread_message_loop_proxy_(reply_thread_message_loop_proxy),
+ scoped_refptr<base::SingleThreadTaskRunner> reply_thread_task_runner)
+ : deletion_task_runner_(base::ThreadTaskRunnerHandle::Get()),
+ reply_thread_task_runner_(reply_thread_task_runner),
resource_host_(NULL) {
}
@@ -81,8 +79,9 @@ bool ResourceMessageFilter::HandleMessage(const IPC::Message& msg,
void ResourceMessageFilter::SendReply(const ReplyMessageContext& context,
const IPC::Message& msg) {
- if (!reply_thread_message_loop_proxy_->BelongsToCurrentThread()) {
- reply_thread_message_loop_proxy_->PostTask(FROM_HERE,
+ if (!reply_thread_task_runner_->BelongsToCurrentThread()) {
+ reply_thread_task_runner_->PostTask(
+ FROM_HERE,
base::Bind(&ResourceMessageFilter::SendReply, this, context, msg));
return;
}
diff --git a/ppapi/host/resource_message_filter.h b/ppapi/host/resource_message_filter.h
index 5488f98..9108847 100644
--- a/ppapi/host/resource_message_filter.h
+++ b/ppapi/host/resource_message_filter.h
@@ -12,7 +12,7 @@
#include "ppapi/host/resource_message_handler.h"
namespace base {
-class MessageLoopProxy;
+class SingleThreadTaskRunner;
class TaskRunner;
}
@@ -86,7 +86,7 @@ class PPAPI_HOST_EXPORT ResourceMessageFilter
// Test constructor. Allows you to specify the message loop which will be used
// to dispatch replies on.
ResourceMessageFilter(
- scoped_refptr<base::MessageLoopProxy> reply_thread_message_loop_proxy);
+ scoped_refptr<base::SingleThreadTaskRunner> reply_thread_task_runner);
// Called when a filter is added to a ResourceHost.
void OnFilterAdded(ResourceHost* resource_host);
@@ -124,12 +124,12 @@ class PPAPI_HOST_EXPORT ResourceMessageFilter
void DispatchMessage(const IPC::Message& msg,
HostMessageContext context);
- scoped_refptr<base::MessageLoopProxy> deletion_message_loop_proxy_;
+ scoped_refptr<base::SingleThreadTaskRunner> deletion_task_runner_;
// Message loop to send resource message replies on. This will be the message
// loop proxy of the IO thread for the browser process or the main thread for
// the renderer process.
- scoped_refptr<base::MessageLoopProxy> reply_thread_message_loop_proxy_;
+ scoped_refptr<base::SingleThreadTaskRunner> reply_thread_task_runner_;
// Non-owning pointer to the resource host owning this filter. Should only be
// accessed from the thread which sends messages to the plugin resource (i.e.
diff --git a/ppapi/host/resource_message_filter_unittest.cc b/ppapi/host/resource_message_filter_unittest.cc
index 59bbc59..2cd015c 100644
--- a/ppapi/host/resource_message_filter_unittest.cc
+++ b/ppapi/host/resource_message_filter_unittest.cc
@@ -4,9 +4,9 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
-#include "base/message_loop/message_loop.h"
-#include "base/message_loop/message_loop_proxy.h"
+#include "base/location.h"
#include "base/run_loop.h"
+#include "base/single_thread_task_runner.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/thread.h"
#include "ipc/ipc_message.h"
@@ -99,12 +99,11 @@ class MyResourceFilter : public ResourceMessageFilter {
const base::Thread& bg_thread,
uint32 msg_type,
uint32 reply_msg_type)
- : ResourceMessageFilter(io_thread.message_loop_proxy()),
- message_loop_proxy_(bg_thread.message_loop_proxy()),
+ : ResourceMessageFilter(io_thread.task_runner()),
+ task_runner_(bg_thread.task_runner()),
msg_type_(msg_type),
reply_msg_type_(reply_msg_type),
- last_message_loop_(NULL) {
- }
+ last_message_loop_(NULL) {}
const IPC::Message& last_handled_msg() const { return last_handled_msg_; }
base::MessageLoop* last_message_loop() const { return last_message_loop_; }
@@ -112,7 +111,7 @@ class MyResourceFilter : public ResourceMessageFilter {
scoped_refptr<base::TaskRunner> OverrideTaskRunnerForMessage(
const IPC::Message& msg) override {
if (msg.type() == msg_type_)
- return message_loop_proxy_;
+ return task_runner_;
return NULL;
}
@@ -130,7 +129,7 @@ class MyResourceFilter : public ResourceMessageFilter {
}
private:
- scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
uint32 msg_type_;
uint32 reply_msg_type_;
@@ -211,10 +210,9 @@ TEST_F(ResourceMessageFilterTest, TestHandleMessage) {
// It should be safe to use base::Unretained() because the object won't be
// destroyed before the task is run.
- main_message_loop.PostTask(
- FROM_HERE,
- base::Bind(&ResourceMessageFilterTest::TestHandleMessageImpl,
- base::Unretained(this)));
+ main_message_loop.task_runner()->PostTask(
+ FROM_HERE, base::Bind(&ResourceMessageFilterTest::TestHandleMessageImpl,
+ base::Unretained(this)));
base::RunLoop().RunUntilIdle();
}
diff --git a/ppapi/nacl_irt/manifest_service.cc b/ppapi/nacl_irt/manifest_service.cc
index a97c5d4..8a6ec1f 100644
--- a/ppapi/nacl_irt/manifest_service.cc
+++ b/ppapi/nacl_irt/manifest_service.cc
@@ -4,7 +4,7 @@
#include "ppapi/nacl_irt/manifest_service.h"
-#include "base/message_loop/message_loop_proxy.h"
+#include "base/single_thread_task_runner.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_channel_proxy.h"
#include "ipc/ipc_sync_message_filter.h"
@@ -66,13 +66,12 @@ class ManifestMessageFilter : public IPC::SyncMessageFilter {
ManifestService::ManifestService(
const IPC::ChannelHandle& handle,
- scoped_refptr<base::MessageLoopProxy> io_message_loop,
+ scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
base::WaitableEvent* shutdown_event) {
filter_ = new ManifestMessageFilter(shutdown_event);
- channel_ = IPC::ChannelProxy::Create(handle,
- IPC::Channel::MODE_SERVER,
+ channel_ = IPC::ChannelProxy::Create(handle, IPC::Channel::MODE_SERVER,
NULL, // Listener
- io_message_loop.get());
+ io_task_runner.get());
channel_->AddFilter(filter_.get());
}
diff --git a/ppapi/nacl_irt/manifest_service.h b/ppapi/nacl_irt/manifest_service.h
index e3d7d15..7a869e7 100644
--- a/ppapi/nacl_irt/manifest_service.h
+++ b/ppapi/nacl_irt/manifest_service.h
@@ -11,7 +11,7 @@
#include "base/synchronization/lock.h"
namespace base {
-class MessageLoopProxy;
+class SingleThreadTaskRunner;
class WaitableEvent;
} // namespace base
@@ -26,7 +26,7 @@ namespace ppapi {
class ManifestService {
public:
ManifestService(const IPC::ChannelHandle& handle,
- scoped_refptr<base::MessageLoopProxy> io_message_loop,
+ scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
base::WaitableEvent* shutdown_event);
~ManifestService();
diff --git a/ppapi/nacl_irt/plugin_main.cc b/ppapi/nacl_irt/plugin_main.cc
index eb4f300..8cd491e 100644
--- a/ppapi/nacl_irt/plugin_main.cc
+++ b/ppapi/nacl_irt/plugin_main.cc
@@ -10,7 +10,6 @@
// IPC_MESSAGE_MACROS_LOG_ENABLED so ppapi_messages.h will generate the
// ViewMsgLog et al. functions.
-#include "base/message_loop/message_loop.h"
#include "base/threading/thread.h"
#include "ipc/ipc_logging.h"
#include "ppapi/nacl_irt/plugin_startup.h"
@@ -28,12 +27,10 @@ void PpapiPluginRegisterThreadCreator(
int PpapiPluginMain() {
base::MessageLoop loop;
ppapi::proxy::PluginGlobals plugin_globals(
- scoped_refptr<base::TaskRunner>(
- ppapi::GetIOThread()->message_loop_proxy()));
+ scoped_refptr<base::TaskRunner>(ppapi::GetIOThread()->task_runner()));
ppapi::PpapiDispatcher ppapi_dispatcher(
- ppapi::GetIOThread()->message_loop_proxy(),
- ppapi::GetShutdownEvent(),
+ ppapi::GetIOThread()->task_runner(), ppapi::GetShutdownEvent(),
ppapi::GetBrowserIPCFileDescriptor(),
ppapi::GetRendererIPCFileDescriptor());
plugin_globals.SetPluginProxyDelegate(&ppapi_dispatcher);
diff --git a/ppapi/nacl_irt/plugin_startup.cc b/ppapi/nacl_irt/plugin_startup.cc
index 2061fc8..338f524 100644
--- a/ppapi/nacl_irt/plugin_startup.cc
+++ b/ppapi/nacl_irt/plugin_startup.cc
@@ -6,7 +6,9 @@
#include "base/bind.h"
#include "base/file_descriptor_posix.h"
+#include "base/location.h"
#include "base/logging.h"
+#include "base/single_thread_task_runner.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/thread.h"
#include "ipc/ipc_channel_handle.h"
@@ -37,10 +39,9 @@ void StartUpManifestServiceOnIOThread(base::WaitableEvent* event) {
DCHECK(g_shutdown_event);
g_manifest_service = new ManifestService(
- IPC::ChannelHandle(
- "NaCl IPC", base::FileDescriptor(g_manifest_service_fd, false)),
- g_io_thread->message_loop_proxy(),
- g_shutdown_event);
+ IPC::ChannelHandle("NaCl IPC",
+ base::FileDescriptor(g_manifest_service_fd, false)),
+ g_io_thread->task_runner(), g_shutdown_event);
event->Signal();
}
@@ -75,9 +76,8 @@ void StartUpPlugin() {
// usage. Once a better approach is made, replace this by that way.
// (crbug.com/364241).
base::WaitableEvent event(true, false);
- g_io_thread->message_loop_proxy()->PostTask(
- FROM_HERE,
- base::Bind(StartUpManifestServiceOnIOThread, &event));
+ g_io_thread->task_runner()->PostTask(
+ FROM_HERE, base::Bind(StartUpManifestServiceOnIOThread, &event));
event.Wait();
}
diff --git a/ppapi/nacl_irt/ppapi_dispatcher.cc b/ppapi/nacl_irt/ppapi_dispatcher.cc
index 1e7ad10..c8374bb 100644
--- a/ppapi/nacl_irt/ppapi_dispatcher.cc
+++ b/ppapi/nacl_irt/ppapi_dispatcher.cc
@@ -9,7 +9,7 @@
#include "base/command_line.h"
#include "base/memory/ref_counted.h"
-#include "base/message_loop/message_loop.h"
+#include "base/single_thread_task_runner.h"
#include "base/synchronization/waitable_event.h"
#include "build/build_config.h"
#include "components/tracing/child_trace_message_filter.h"
@@ -29,12 +29,13 @@
namespace ppapi {
-PpapiDispatcher::PpapiDispatcher(scoped_refptr<base::MessageLoopProxy> io_loop,
- base::WaitableEvent* shutdown_event,
- int browser_ipc_fd,
- int renderer_ipc_fd)
+PpapiDispatcher::PpapiDispatcher(
+ scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
+ base::WaitableEvent* shutdown_event,
+ int browser_ipc_fd,
+ int renderer_ipc_fd)
: next_plugin_dispatcher_id_(0),
- message_loop_(io_loop),
+ task_runner_(io_task_runner),
shutdown_event_(shutdown_event),
renderer_ipc_fd_(renderer_ipc_fd) {
IPC::ChannelHandle channel_handle(
@@ -52,13 +53,12 @@ PpapiDispatcher::PpapiDispatcher(scoped_refptr<base::MessageLoopProxy> io_loop,
channel_->AddFilter(plugin_filter.get());
globals->RegisterResourceMessageFilters(plugin_filter.get());
- channel_->AddFilter(
- new tracing::ChildTraceMessageFilter(message_loop_.get()));
+ channel_->AddFilter(new tracing::ChildTraceMessageFilter(task_runner_.get()));
channel_->Init(channel_handle, IPC::Channel::MODE_SERVER, true);
}
base::SingleThreadTaskRunner* PpapiDispatcher::GetIPCTaskRunner() {
- return message_loop_.get();
+ return task_runner_.get();
}
base::WaitableEvent* PpapiDispatcher::GetShutdownEvent() {
diff --git a/ppapi/nacl_irt/ppapi_dispatcher.h b/ppapi/nacl_irt/ppapi_dispatcher.h
index 56f3191..88e91be 100644
--- a/ppapi/nacl_irt/ppapi_dispatcher.h
+++ b/ppapi/nacl_irt/ppapi_dispatcher.h
@@ -24,7 +24,7 @@
struct PP_BrowserFont_Trusted_Description;
namespace base {
-class MessageLoopProxy;
+class SingleThreadTaskRunner;
class WaitableEvent;
} // namespace base
@@ -46,7 +46,7 @@ class PpapiDispatcher : public proxy::PluginDispatcher::PluginDelegate,
public IPC::Listener,
public IPC::Sender {
public:
- PpapiDispatcher(scoped_refptr<base::MessageLoopProxy> io_loop,
+ PpapiDispatcher(scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
base::WaitableEvent* shutdown_event,
int browser_ipc_fd,
int renderer_ipc_fd);
@@ -90,7 +90,7 @@ class PpapiDispatcher : public proxy::PluginDispatcher::PluginDelegate,
std::map<uint32, proxy::PluginDispatcher*> plugin_dispatchers_;
uint32 next_plugin_dispatcher_id_;
- scoped_refptr<base::MessageLoopProxy> message_loop_;
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
base::WaitableEvent* shutdown_event_;
int renderer_ipc_fd_;
scoped_ptr<IPC::SyncChannel> channel_;
diff --git a/ppapi/proxy/message_handler.cc b/ppapi/proxy/message_handler.cc
index af9a45f..9fe95b2 100644
--- a/ppapi/proxy/message_handler.cc
+++ b/ppapi/proxy/message_handler.cc
@@ -4,6 +4,8 @@
#include "ppapi/proxy/message_handler.h"
+#include "base/location.h"
+#include "base/single_thread_task_runner.h"
#include "ipc/ipc_message.h"
#include "ppapi/proxy/plugin_dispatcher.h"
#include "ppapi/proxy/ppapi_messages.h"
@@ -90,38 +92,32 @@ scoped_ptr<MessageHandler> MessageHandler::Create(
MessageHandler::~MessageHandler() {
// It's possible the message_loop_proxy is NULL if that loop has been quit.
// In that case, we unfortunately just can't call Destroy.
- if (message_loop_->message_loop_proxy().get()) {
+ if (message_loop_->task_runner().get()) {
// The posted task won't have the proxy lock, but that's OK, it doesn't
// touch any internal state; it's a direct call on the plugin's function.
- message_loop_->message_loop_proxy()->PostTask(FROM_HERE,
- base::Bind(handler_if_->Destroy,
- instance_,
- user_data_));
+ message_loop_->task_runner()->PostTask(
+ FROM_HERE, base::Bind(handler_if_->Destroy, instance_, user_data_));
}
}
bool MessageHandler::LoopIsValid() const {
- return !!message_loop_->message_loop_proxy().get();
+ return !!message_loop_->task_runner().get();
}
void MessageHandler::HandleMessage(ScopedPPVar var) {
- message_loop_->message_loop_proxy()->PostTask(FROM_HERE,
- RunWhileLocked(base::Bind(&HandleMessageWrapper,
- handler_if_->HandleMessage,
- instance_,
- user_data_,
- var)));
+ message_loop_->task_runner()->PostTask(
+ FROM_HERE, RunWhileLocked(base::Bind(&HandleMessageWrapper,
+ handler_if_->HandleMessage,
+ instance_, user_data_, var)));
}
void MessageHandler::HandleBlockingMessage(ScopedPPVar var,
scoped_ptr<IPC::Message> reply_msg) {
- message_loop_->message_loop_proxy()->PostTask(FROM_HERE,
- RunWhileLocked(base::Bind(&HandleBlockingMessageWrapper,
- handler_if_->HandleBlockingMessage,
- instance_,
- user_data_,
- var,
- base::Passed(reply_msg.Pass()))));
+ message_loop_->task_runner()->PostTask(
+ FROM_HERE,
+ RunWhileLocked(base::Bind(
+ &HandleBlockingMessageWrapper, handler_if_->HandleBlockingMessage,
+ instance_, user_data_, var, base::Passed(reply_msg.Pass()))));
}
MessageHandler::MessageHandler(
diff --git a/ppapi/proxy/network_monitor_resource.h b/ppapi/proxy/network_monitor_resource.h
index e63ae39..2fb91e7 100644
--- a/ppapi/proxy/network_monitor_resource.h
+++ b/ppapi/proxy/network_monitor_resource.h
@@ -12,10 +12,6 @@
#include "ppapi/shared_impl/scoped_pp_resource.h"
#include "ppapi/thunk/ppb_network_monitor_api.h"
-namespace base {
-class MessageLoopProxy;
-} // namespace base
-
namespace ppapi {
namespace proxy {
diff --git a/ppapi/proxy/plugin_globals.cc b/ppapi/proxy/plugin_globals.cc
index 060aa71..8d6e9dd 100644
--- a/ppapi/proxy/plugin_globals.cc
+++ b/ppapi/proxy/plugin_globals.cc
@@ -4,6 +4,8 @@
#include "ppapi/proxy/plugin_globals.h"
+#include "base/location.h"
+#include "base/single_thread_task_runner.h"
#include "base/task_runner.h"
#include "base/threading/thread.h"
#include "ipc/ipc_message.h"
@@ -180,7 +182,7 @@ base::TaskRunner* PluginGlobals::GetFileTaskRunner() {
options.message_loop_type = base::MessageLoop::TYPE_IO;
file_thread_->StartWithOptions(options);
}
- return file_thread_->message_loop_proxy().get();
+ return file_thread_->task_runner().get();
}
void PluginGlobals::MarkPluginIsActive() {
diff --git a/ppapi/proxy/plugin_message_filter.cc b/ppapi/proxy/plugin_message_filter.cc
index d9dadc3..a2994c5 100644
--- a/ppapi/proxy/plugin_message_filter.cc
+++ b/ppapi/proxy/plugin_message_filter.cc
@@ -5,7 +5,9 @@
#include "ppapi/proxy/plugin_message_filter.h"
#include "base/bind.h"
+#include "base/location.h"
#include "base/logging.h"
+#include "base/single_thread_task_runner.h"
#include "ipc/ipc_channel.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/resource_message_params.h"
@@ -91,7 +93,7 @@ void PluginMessageFilter::OnMsgResourceReply(
if (filter_ptr->OnResourceReplyReceived(reply_params, nested_msg))
return;
}
- scoped_refptr<base::MessageLoopProxy> target =
+ scoped_refptr<base::SingleThreadTaskRunner> target =
resource_reply_thread_registrar_->GetTargetThread(reply_params,
nested_msg);
target->PostTask(
diff --git a/ppapi/proxy/ppapi_proxy_test.cc b/ppapi/proxy/ppapi_proxy_test.cc
index c7c3a92..39a1a34 100644
--- a/ppapi/proxy/ppapi_proxy_test.cc
+++ b/ppapi/proxy/ppapi_proxy_test.cc
@@ -8,10 +8,12 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
-#include "base/message_loop/message_loop_proxy.h"
+#include "base/location.h"
#include "base/observer_list.h"
#include "base/process/process_handle.h"
#include "base/run_loop.h"
+#include "base/single_thread_task_runner.h"
+#include "base/thread_task_runner_handle.h"
#include "ipc/ipc_sync_channel.h"
#include "ipc/message_filter.h"
#include "ppapi/c/pp_errors.h"
@@ -79,11 +81,11 @@ const void* MockGetInterface(const char* name) {
void SetUpRemoteHarness(ProxyTestHarnessBase* harness,
const IPC::ChannelHandle& handle,
- base::MessageLoopProxy* ipc_message_loop_proxy,
+ base::SingleThreadTaskRunner* ipc_task_runner,
base::WaitableEvent* shutdown_event,
base::WaitableEvent* harness_set_up) {
- harness->SetUpHarnessWithChannel(handle, ipc_message_loop_proxy,
- shutdown_event, false);
+ harness->SetUpHarnessWithChannel(handle, ipc_task_runner, shutdown_event,
+ false);
harness_set_up->Signal();
}
@@ -188,17 +190,16 @@ void PluginProxyTestHarness::SetUpHarness() {
void PluginProxyTestHarness::SetUpHarnessWithChannel(
const IPC::ChannelHandle& channel_handle,
- base::MessageLoopProxy* ipc_message_loop,
+ base::SingleThreadTaskRunner* ipc_task_runner,
base::WaitableEvent* shutdown_event,
bool is_client) {
// These must be first since the dispatcher set-up uses them.
- scoped_refptr<base::TaskRunner> ipc_task_runner(ipc_message_loop);
- CreatePluginGlobals(ipc_message_loop);
+ CreatePluginGlobals(ipc_task_runner);
// Some of the methods called during set-up check that the lock is held.
ProxyAutoLock lock;
resource_tracker().DidCreateInstance(pp_instance());
- plugin_delegate_mock_.Init(ipc_message_loop, shutdown_event);
+ plugin_delegate_mock_.Init(ipc_task_runner, shutdown_event);
plugin_dispatcher_.reset(new PluginDispatcher(
&MockGetInterface,
@@ -239,7 +240,7 @@ void PluginProxyTestHarness::CreatePluginGlobals(
base::SingleThreadTaskRunner*
PluginProxyTestHarness::PluginDelegateMock::GetIPCTaskRunner() {
- return ipc_message_loop_;
+ return ipc_task_runner_;
}
base::WaitableEvent*
@@ -327,10 +328,9 @@ PluginProxyMultiThreadTest::~PluginProxyMultiThreadTest() {
}
void PluginProxyMultiThreadTest::RunTest() {
- main_thread_message_loop_proxy_ =
- PpapiGlobals::Get()->GetMainThreadMessageLoop();
- ASSERT_EQ(main_thread_message_loop_proxy_.get(),
- base::MessageLoopProxy::current().get());
+ main_thread_task_runner_ = PpapiGlobals::Get()->GetMainThreadMessageLoop();
+ ASSERT_EQ(main_thread_task_runner_.get(),
+ base::ThreadTaskRunnerHandle::Get().get());
nested_main_thread_message_loop_.reset(new base::RunLoop());
secondary_thread_.reset(new base::DelegateSimpleThread(
@@ -366,7 +366,7 @@ void PluginProxyMultiThreadTest::RunTest() {
secondary_thread_.reset(NULL);
nested_main_thread_message_loop_.reset(NULL);
- main_thread_message_loop_proxy_ = NULL;
+ main_thread_task_runner_ = NULL;
}
void PluginProxyMultiThreadTest::CheckOnThread(ThreadType thread_type) {
@@ -380,10 +380,9 @@ void PluginProxyMultiThreadTest::CheckOnThread(ThreadType thread_type) {
}
void PluginProxyMultiThreadTest::PostQuitForMainThread() {
- main_thread_message_loop_proxy_->PostTask(
- FROM_HERE,
- base::Bind(&PluginProxyMultiThreadTest::QuitNestedLoop,
- base::Unretained(this)));
+ main_thread_task_runner_->PostTask(
+ FROM_HERE, base::Bind(&PluginProxyMultiThreadTest::QuitNestedLoop,
+ base::Unretained(this)));
}
void PluginProxyMultiThreadTest::PostQuitForSecondaryThread() {
@@ -444,13 +443,13 @@ void HostProxyTestHarness::SetUpHarness() {
void HostProxyTestHarness::SetUpHarnessWithChannel(
const IPC::ChannelHandle& channel_handle,
- base::MessageLoopProxy* ipc_message_loop,
+ base::SingleThreadTaskRunner* ipc_task_runner,
base::WaitableEvent* shutdown_event,
bool is_client) {
// These must be first since the dispatcher set-up uses them.
CreateHostGlobals();
- delegate_mock_.Init(ipc_message_loop, shutdown_event);
+ delegate_mock_.Init(ipc_task_runner, shutdown_event);
host_dispatcher_.reset(new HostDispatcher(
pp_module(),
@@ -479,8 +478,9 @@ void HostProxyTestHarness::CreateHostGlobals() {
}
}
-base::MessageLoopProxy* HostProxyTestHarness::DelegateMock::GetIPCTaskRunner() {
- return ipc_message_loop_;
+base::SingleThreadTaskRunner*
+HostProxyTestHarness::DelegateMock::GetIPCTaskRunner() {
+ return ipc_task_runner_;
}
base::WaitableEvent* HostProxyTestHarness::DelegateMock::GetShutdownEvent() {
@@ -557,28 +557,21 @@ void TwoWayTest::SetUp() {
handle_name << "TwoWayTestChannel" << base::GetCurrentProcId();
IPC::ChannelHandle handle(handle_name.str());
base::WaitableEvent remote_harness_set_up(true, false);
- plugin_thread_.message_loop_proxy()->PostTask(
- FROM_HERE,
- base::Bind(&SetUpRemoteHarness,
- remote_harness_,
- handle,
- io_thread_.message_loop_proxy(),
- &shutdown_event_,
- &remote_harness_set_up));
+ plugin_thread_.task_runner()->PostTask(
+ FROM_HERE, base::Bind(&SetUpRemoteHarness, remote_harness_, handle,
+ io_thread_.task_runner(), &shutdown_event_,
+ &remote_harness_set_up));
remote_harness_set_up.Wait();
- local_harness_->SetUpHarnessWithChannel(handle,
- io_thread_.message_loop_proxy().get(),
- &shutdown_event_,
- true); // is_client
+ local_harness_->SetUpHarnessWithChannel(
+ handle, io_thread_.task_runner().get(), &shutdown_event_,
+ true); // is_client
}
void TwoWayTest::TearDown() {
base::WaitableEvent remote_harness_torn_down(true, false);
- plugin_thread_.message_loop_proxy()->PostTask(
- FROM_HERE,
- base::Bind(&TearDownRemoteHarness,
- remote_harness_,
- &remote_harness_torn_down));
+ plugin_thread_.task_runner()->PostTask(
+ FROM_HERE, base::Bind(&TearDownRemoteHarness, remote_harness_,
+ &remote_harness_torn_down));
remote_harness_torn_down.Wait();
local_harness_->TearDownHarness();
@@ -588,10 +581,8 @@ void TwoWayTest::TearDown() {
void TwoWayTest::PostTaskOnRemoteHarness(const base::Closure& task) {
base::WaitableEvent task_complete(true, false);
- plugin_thread_.message_loop_proxy()->PostTask(FROM_HERE,
- base::Bind(&RunTaskOnRemoteHarness,
- task,
- &task_complete));
+ plugin_thread_.task_runner()->PostTask(
+ FROM_HERE, base::Bind(&RunTaskOnRemoteHarness, task, &task_complete));
task_complete.Wait();
}
diff --git a/ppapi/proxy/ppapi_proxy_test.h b/ppapi/proxy/ppapi_proxy_test.h
index e961874..8932b22 100644
--- a/ppapi/proxy/ppapi_proxy_test.h
+++ b/ppapi/proxy/ppapi_proxy_test.h
@@ -8,7 +8,6 @@
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
-#include "base/message_loop/message_loop.h"
#include "base/synchronization/waitable_event.h"
#include "base/task_runner.h"
#include "base/threading/simple_thread.h"
@@ -26,8 +25,8 @@
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
-class MessageLoopProxy;
class RunLoop;
+class SingleThreadTaskRunner;
}
namespace ppapi {
@@ -59,10 +58,11 @@ class ProxyTestHarnessBase {
virtual void SetUpHarness() = 0;
// Set up the harness using a real IPC channel.
- virtual void SetUpHarnessWithChannel(const IPC::ChannelHandle& channel_handle,
- base::MessageLoopProxy* ipc_message_loop,
- base::WaitableEvent* shutdown_event,
- bool is_client) = 0;
+ virtual void SetUpHarnessWithChannel(
+ const IPC::ChannelHandle& channel_handle,
+ base::SingleThreadTaskRunner* ipc_task_runner,
+ base::WaitableEvent* shutdown_event,
+ bool is_client) = 0;
virtual void TearDownHarness() = 0;
@@ -110,21 +110,22 @@ class PluginProxyTestHarness : public ProxyTestHarnessBase {
virtual PpapiGlobals* GetGlobals();
virtual Dispatcher* GetDispatcher();
virtual void SetUpHarness();
- virtual void SetUpHarnessWithChannel(const IPC::ChannelHandle& channel_handle,
- base::MessageLoopProxy* ipc_message_loop,
- base::WaitableEvent* shutdown_event,
- bool is_client);
+ virtual void SetUpHarnessWithChannel(
+ const IPC::ChannelHandle& channel_handle,
+ base::SingleThreadTaskRunner* ipc_task_runner,
+ base::WaitableEvent* shutdown_event,
+ bool is_client);
virtual void TearDownHarness();
class PluginDelegateMock : public PluginDispatcher::PluginDelegate,
public PluginProxyDelegate {
public:
- PluginDelegateMock() : ipc_message_loop_(NULL), shutdown_event_() {}
+ PluginDelegateMock() : ipc_task_runner_(NULL), shutdown_event_() {}
~PluginDelegateMock() override {}
- void Init(base::MessageLoopProxy* ipc_message_loop,
+ void Init(base::SingleThreadTaskRunner* ipc_task_runner,
base::WaitableEvent* shutdown_event) {
- ipc_message_loop_ = ipc_message_loop;
+ ipc_task_runner_ = ipc_task_runner;
shutdown_event_ = shutdown_event;
}
@@ -160,7 +161,7 @@ class PluginProxyTestHarness : public ProxyTestHarnessBase {
const Preferences& prefs) override;
private:
- base::MessageLoopProxy* ipc_message_loop_; // Weak
+ base::SingleThreadTaskRunner* ipc_task_runner_; // Weak
base::WaitableEvent* shutdown_event_; // Weak
std::set<PP_Instance> instance_id_set_;
IPC::Sender* browser_sender_;
@@ -225,7 +226,7 @@ class PluginProxyMultiThreadTest
protected:
scoped_refptr<MessageLoopResource> secondary_thread_message_loop_;
- scoped_refptr<base::MessageLoopProxy> main_thread_message_loop_proxy_;
+ scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
private:
// base::DelegateSimpleThread::Delegate implementation.
@@ -257,26 +258,26 @@ class HostProxyTestHarness : public ProxyTestHarnessBase {
virtual PpapiGlobals* GetGlobals();
virtual Dispatcher* GetDispatcher();
virtual void SetUpHarness();
- virtual void SetUpHarnessWithChannel(const IPC::ChannelHandle& channel_handle,
- base::MessageLoopProxy* ipc_message_loop,
- base::WaitableEvent* shutdown_event,
- bool is_client);
+ virtual void SetUpHarnessWithChannel(
+ const IPC::ChannelHandle& channel_handle,
+ base::SingleThreadTaskRunner* ipc_task_runner,
+ base::WaitableEvent* shutdown_event,
+ bool is_client);
virtual void TearDownHarness();
class DelegateMock : public ProxyChannel::Delegate {
public:
- DelegateMock() : ipc_message_loop_(NULL), shutdown_event_(NULL) {
- }
+ DelegateMock() : ipc_task_runner_(NULL), shutdown_event_(NULL) {}
~DelegateMock() override {}
- void Init(base::MessageLoopProxy* ipc_message_loop,
+ void Init(base::SingleThreadTaskRunner* ipc_task_runner,
base::WaitableEvent* shutdown_event) {
- ipc_message_loop_ = ipc_message_loop;
+ ipc_task_runner_ = ipc_task_runner;
shutdown_event_ = shutdown_event;
}
// ProxyChannel::Delegate implementation.
- base::MessageLoopProxy* GetIPCTaskRunner() override;
+ base::SingleThreadTaskRunner* GetIPCTaskRunner() override;
base::WaitableEvent* GetShutdownEvent() override;
IPC::PlatformFileForTransit ShareHandleWithRemote(
base::PlatformFile handle,
@@ -287,7 +288,7 @@ class HostProxyTestHarness : public ProxyTestHarnessBase {
base::ProcessId remote_pid) override;
private:
- base::MessageLoopProxy* ipc_message_loop_; // Weak
+ base::SingleThreadTaskRunner* ipc_task_runner_; // Weak
base::WaitableEvent* shutdown_event_; // Weak
DISALLOW_COPY_AND_ASSIGN(DelegateMock);
diff --git a/ppapi/proxy/ppb_message_loop_proxy.cc b/ppapi/proxy/ppb_message_loop_proxy.cc
index 555c008..3d29a7b 100644
--- a/ppapi/proxy/ppb_message_loop_proxy.cc
+++ b/ppapi/proxy/ppb_message_loop_proxy.cc
@@ -8,8 +8,8 @@
#include "base/bind.h"
#include "base/compiler_specific.h"
-#include "base/message_loop/message_loop.h"
-#include "base/message_loop/message_loop_proxy.h"
+#include "base/location.h"
+#include "base/thread_task_runner_handle.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_message_loop.h"
#include "ppapi/proxy/plugin_dispatcher.h"
@@ -55,7 +55,7 @@ MessageLoopResource::MessageLoopResource(ForMainThread for_main_thread)
slot->Set(this);
- loop_proxy_ = base::MessageLoopProxy::current();
+ task_runner_ = base::ThreadTaskRunnerHandle::Get();
}
@@ -89,7 +89,7 @@ int32_t MessageLoopResource::AttachToCurrentThread() {
slot->Set(this);
loop_.reset(new base::MessageLoop);
- loop_proxy_ = base::MessageLoopProxy::current();
+ task_runner_ = base::ThreadTaskRunnerHandle::Get();
// Post all pending work to the message loop.
for (size_t i = 0; i < pending_tasks_.size(); i++) {
@@ -113,7 +113,7 @@ int32_t MessageLoopResource::Run() {
nested_invocations_--;
if (should_destroy_ && nested_invocations_ == 0) {
- loop_proxy_ = NULL;
+ task_runner_ = NULL;
loop_.reset();
destroyed_ = true;
}
@@ -159,7 +159,7 @@ MessageLoopResource* MessageLoopResource::GetCurrent() {
void MessageLoopResource::DetachFromThread() {
// Note that the message loop must be destroyed on the thread it was created
// on.
- loop_proxy_ = NULL;
+ task_runner_ = NULL;
loop_.reset();
// Cancel out the AddRef in AttachToCurrentThread().
@@ -179,9 +179,9 @@ void MessageLoopResource::PostClosure(
const tracked_objects::Location& from_here,
const base::Closure& closure,
int64 delay_ms) {
- if (loop_proxy_.get()) {
- loop_proxy_->PostDelayedTask(
- from_here, closure, base::TimeDelta::FromMilliseconds(delay_ms));
+ if (task_runner_.get()) {
+ task_runner_->PostDelayedTask(from_here, closure,
+ base::TimeDelta::FromMilliseconds(delay_ms));
} else {
TaskInfo info;
info.from_here = FROM_HERE;
@@ -191,8 +191,8 @@ void MessageLoopResource::PostClosure(
}
}
-base::MessageLoopProxy* MessageLoopResource::GetMessageLoopProxy() {
- return loop_proxy_.get();
+base::SingleThreadTaskRunner* MessageLoopResource::GetTaskRunner() {
+ return task_runner_.get();
}
bool MessageLoopResource::CurrentlyHandlingBlockingMessage() {
diff --git a/ppapi/proxy/ppb_message_loop_proxy.h b/ppapi/proxy/ppb_message_loop_proxy.h
index 0aa07fe..25e69b3 100644
--- a/ppapi/proxy/ppb_message_loop_proxy.h
+++ b/ppapi/proxy/ppb_message_loop_proxy.h
@@ -10,6 +10,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
+#include "base/single_thread_task_runner.h"
#include "ppapi/proxy/interface_proxy.h"
#include "ppapi/proxy/ppapi_proxy_export.h"
#include "ppapi/shared_impl/ppb_message_loop_shared.h"
@@ -43,8 +44,8 @@ class PPAPI_PROXY_EXPORT MessageLoopResource : public MessageLoopShared {
return is_main_thread_loop_;
}
- const scoped_refptr<base::MessageLoopProxy>& message_loop_proxy() {
- return loop_proxy_;
+ const scoped_refptr<base::SingleThreadTaskRunner>& task_runner() {
+ return task_runner_;
}
void set_currently_handling_blocking_message(bool handling_blocking_message) {
@@ -71,7 +72,7 @@ class PPAPI_PROXY_EXPORT MessageLoopResource : public MessageLoopShared {
void PostClosure(const tracked_objects::Location& from_here,
const base::Closure& closure,
int64 delay_ms) override;
- base::MessageLoopProxy* GetMessageLoopProxy() override;
+ base::SingleThreadTaskRunner* GetTaskRunner() override;
bool CurrentlyHandlingBlockingMessage() override;
// TLS destructor function.
@@ -80,9 +81,9 @@ class PPAPI_PROXY_EXPORT MessageLoopResource : public MessageLoopShared {
// Created when we attach to the current thread, since MessageLoop assumes
// that it's created on the thread it will run on. NULL for the main thread
// loop, since that's owned by somebody else. This is needed for Run and Quit.
- // Any time we post tasks, we should post them using loop_proxy_.
+ // Any time we post tasks, we should post them using task_runner_.
scoped_ptr<base::MessageLoop> loop_;
- scoped_refptr<base::MessageLoopProxy> loop_proxy_;
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
// Number of invocations of Run currently on the stack.
int nested_invocations_;
diff --git a/ppapi/proxy/resource_reply_thread_registrar.cc b/ppapi/proxy/resource_reply_thread_registrar.cc
index 274d902..4921b7b 100644
--- a/ppapi/proxy/resource_reply_thread_registrar.cc
+++ b/ppapi/proxy/resource_reply_thread_registrar.cc
@@ -5,7 +5,7 @@
#include "ppapi/proxy/resource_reply_thread_registrar.h"
#include "base/logging.h"
-#include "base/message_loop/message_loop_proxy.h"
+#include "base/single_thread_task_runner.h"
#include "ipc/ipc_message.h"
#include "ppapi/proxy/resource_message_params.h"
#include "ppapi/shared_impl/proxy_lock.h"
@@ -15,7 +15,7 @@ namespace ppapi {
namespace proxy {
ResourceReplyThreadRegistrar::ResourceReplyThreadRegistrar(
- scoped_refptr<base::MessageLoopProxy> main_thread)
+ scoped_refptr<base::SingleThreadTaskRunner> main_thread)
: main_thread_(main_thread) {
}
@@ -33,8 +33,8 @@ void ResourceReplyThreadRegistrar::Register(
return;
DCHECK(reply_thread_hint->target_loop());
- scoped_refptr<base::MessageLoopProxy> reply_thread(
- reply_thread_hint->target_loop()->GetMessageLoopProxy());
+ scoped_refptr<base::SingleThreadTaskRunner> reply_thread(
+ reply_thread_hint->target_loop()->GetTaskRunner());
{
base::AutoLock auto_lock(lock_);
@@ -50,7 +50,7 @@ void ResourceReplyThreadRegistrar::Unregister(PP_Resource resource) {
map_.erase(resource);
}
-scoped_refptr<base::MessageLoopProxy>
+scoped_refptr<base::SingleThreadTaskRunner>
ResourceReplyThreadRegistrar::GetTargetThread(
const ResourceMessageReplyParams& reply_params,
const IPC::Message& nested_msg) {
@@ -60,7 +60,7 @@ ResourceReplyThreadRegistrar::GetTargetThread(
SequenceThreadMap::iterator sequence_thread_iter =
resource_iter->second.find(reply_params.sequence());
if (sequence_thread_iter != resource_iter->second.end()) {
- scoped_refptr<base::MessageLoopProxy> target =
+ scoped_refptr<base::SingleThreadTaskRunner> target =
sequence_thread_iter->second;
resource_iter->second.erase(sequence_thread_iter);
return target;
diff --git a/ppapi/proxy/resource_reply_thread_registrar.h b/ppapi/proxy/resource_reply_thread_registrar.h
index 38d596b..193c205 100644
--- a/ppapi/proxy/resource_reply_thread_registrar.h
+++ b/ppapi/proxy/resource_reply_thread_registrar.h
@@ -16,7 +16,7 @@
namespace base {
-class MessageLoopProxy;
+class SingleThreadTaskRunner;
}
namespace IPC {
@@ -38,7 +38,7 @@ class PPAPI_PROXY_EXPORT ResourceReplyThreadRegistrar
: public base::RefCountedThreadSafe<ResourceReplyThreadRegistrar> {
public:
explicit ResourceReplyThreadRegistrar(
- scoped_refptr<base::MessageLoopProxy> main_thread);
+ scoped_refptr<base::SingleThreadTaskRunner> main_thread);
// This method can only be called while holding the Pepper proxy lock; the
// other methods can be called with/without the Pepper proxy lock.
@@ -47,14 +47,14 @@ class PPAPI_PROXY_EXPORT ResourceReplyThreadRegistrar
scoped_refptr<TrackedCallback> reply_thread_hint);
void Unregister(PP_Resource resource);
- scoped_refptr<base::MessageLoopProxy> GetTargetThread(
+ scoped_refptr<base::SingleThreadTaskRunner> GetTargetThread(
const ResourceMessageReplyParams& reply_params,
const IPC::Message& nested_msg);
private:
friend class base::RefCountedThreadSafe<ResourceReplyThreadRegistrar>;
- typedef std::map<int32_t, scoped_refptr<base::MessageLoopProxy> >
+ typedef std::map<int32_t, scoped_refptr<base::SingleThreadTaskRunner>>
SequenceThreadMap;
typedef std::map<PP_Resource, SequenceThreadMap> ResourceMap;
@@ -65,7 +65,7 @@ class PPAPI_PROXY_EXPORT ResourceReplyThreadRegistrar
// holding |lock_|, otherwise we will cause deadlock.
base::Lock lock_;
ResourceMap map_;
- scoped_refptr<base::MessageLoopProxy> main_thread_;
+ scoped_refptr<base::SingleThreadTaskRunner> main_thread_;
DISALLOW_COPY_AND_ASSIGN(ResourceReplyThreadRegistrar);
};
diff --git a/ppapi/proxy/tracked_callback_unittest.cc b/ppapi/proxy/tracked_callback_unittest.cc
index 748dcfb..ac8f21e 100644
--- a/ppapi/proxy/tracked_callback_unittest.cc
+++ b/ppapi/proxy/tracked_callback_unittest.cc
@@ -3,9 +3,10 @@
// found in the LICENSE file.
#include "base/bind.h"
+#include "base/location.h"
#include "base/memory/ref_counted.h"
-#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
+#include "base/single_thread_task_runner.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/simple_thread.h"
#include "ppapi/c/pp_completion_callback.h"
@@ -245,9 +246,9 @@ class CallbackMockResource : public Resource {
ProxyAutoLock acquire;
// |thread_checker_| will bind to the background thread.
thread_checker_.DetachFromThread();
- loop_resource->message_loop_proxy()->PostTask(FROM_HERE,
- RunWhileLocked(
- base::Bind(&CallbackMockResource::CreateCallbacks, this)));
+ loop_resource->task_runner()->PostTask(
+ FROM_HERE, RunWhileLocked(base::Bind(
+ &CallbackMockResource::CreateCallbacks, this)));
}
int32_t CompletionTask(CallbackRunInfo* info, int32_t result) {
diff --git a/ppapi/shared_impl/ppapi_globals.cc b/ppapi/shared_impl/ppapi_globals.cc
index eef3f5c..c282ffac 100644
--- a/ppapi/shared_impl/ppapi_globals.cc
+++ b/ppapi/shared_impl/ppapi_globals.cc
@@ -6,7 +6,8 @@
#include "base/lazy_instance.h" // For testing purposes only.
#include "base/logging.h"
-#include "base/message_loop/message_loop_proxy.h"
+#include "base/single_thread_task_runner.h"
+#include "base/thread_task_runner_handle.h"
#include "base/threading/thread_local.h" // For testing purposes only.
namespace ppapi {
@@ -23,12 +24,12 @@ PpapiGlobals* ppapi_globals = NULL;
PpapiGlobals::PpapiGlobals() {
DCHECK(!ppapi_globals);
ppapi_globals = this;
- main_loop_proxy_ = base::MessageLoopProxy::current();
+ main_task_runner_ = base::ThreadTaskRunnerHandle::Get();
}
PpapiGlobals::PpapiGlobals(PerThreadForTest) {
DCHECK(!ppapi_globals);
- main_loop_proxy_ = base::MessageLoopProxy::current();
+ main_task_runner_ = base::ThreadTaskRunnerHandle::Get();
}
PpapiGlobals::~PpapiGlobals() {
@@ -53,12 +54,12 @@ void PpapiGlobals::SetPpapiGlobalsOnThreadForTest(PpapiGlobals* ptr) {
tls_ppapi_globals_for_test.Pointer()->Set(ptr);
}
-base::MessageLoopProxy* PpapiGlobals::GetMainThreadMessageLoop() {
- return main_loop_proxy_.get();
+base::SingleThreadTaskRunner* PpapiGlobals::GetMainThreadMessageLoop() {
+ return main_task_runner_.get();
}
void PpapiGlobals::ResetMainThreadMessageLoopForTesting() {
- main_loop_proxy_ = base::MessageLoopProxy::current();
+ main_task_runner_ = base::ThreadTaskRunnerHandle::Get();
}
bool PpapiGlobals::IsHostGlobals() const { return false; }
diff --git a/ppapi/shared_impl/ppapi_globals.h b/ppapi/shared_impl/ppapi_globals.h
index a98d897..bf89503 100644
--- a/ppapi/shared_impl/ppapi_globals.h
+++ b/ppapi/shared_impl/ppapi_globals.h
@@ -20,7 +20,7 @@
#include "ui/events/latency_info.h"
namespace base {
-class MessageLoopProxy;
+class SingleThreadTaskRunner;
class TaskRunner;
}
@@ -101,9 +101,9 @@ class PPAPI_SHARED_EXPORT PpapiGlobals {
// failure.
virtual PP_Module GetModuleForInstance(PP_Instance instance) = 0;
- // Returns the base::MessageLoopProxy for the main thread. This is set in the
- // constructor, so PpapiGlobals must be created on the main thread.
- base::MessageLoopProxy* GetMainThreadMessageLoop();
+ // Returns the base::SingleThreadTaskRunner for the main thread. This is set
+ // in the constructor, so PpapiGlobals must be created on the main thread.
+ base::SingleThreadTaskRunner* GetMainThreadMessageLoop();
// In tests, the PpapiGlobals object persists across tests but the MLP pointer
// it hangs on will go stale and the next PPAPI test will crash because of
@@ -150,7 +150,7 @@ class PPAPI_SHARED_EXPORT PpapiGlobals {
// threads to have distinct "globals".
static PpapiGlobals* GetThreadLocalPointer();
- scoped_refptr<base::MessageLoopProxy> main_loop_proxy_;
+ scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
// If an input event is believed to have caused rendering damage, its latency
// info is cached in |latency_info_for_frame_| indexed by instance. These
diff --git a/ppapi/shared_impl/ppb_message_loop_shared.h b/ppapi/shared_impl/ppb_message_loop_shared.h
index 5dd2522..d28d8be4 100644
--- a/ppapi/shared_impl/ppb_message_loop_shared.h
+++ b/ppapi/shared_impl/ppb_message_loop_shared.h
@@ -14,7 +14,7 @@
#include "ppapi/thunk/ppb_message_loop_api.h"
namespace base {
-class MessageLoopProxy;
+class SingleThreadTaskRunner;
}
namespace tracked_objects {
@@ -48,7 +48,7 @@ class PPAPI_SHARED_EXPORT MessageLoopShared
const base::Closure& closure,
int64 delay_ms) = 0;
- virtual base::MessageLoopProxy* GetMessageLoopProxy() = 0;
+ virtual base::SingleThreadTaskRunner* GetTaskRunner() = 0;
// Returns whether this MessageLoop is currently handling a blocking message
// from JavaScript. This is used to make it illegal to use blocking callbacks
diff --git a/ppapi/shared_impl/thread_aware_callback_unittest.cc b/ppapi/shared_impl/thread_aware_callback_unittest.cc
index 7081daa..92d9124 100644
--- a/ppapi/shared_impl/thread_aware_callback_unittest.cc
+++ b/ppapi/shared_impl/thread_aware_callback_unittest.cc
@@ -6,8 +6,10 @@
#include "base/bind_helpers.h"
#include "base/compiler_specific.h"
+#include "base/location.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
+#include "base/single_thread_task_runner.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/proxy/ppapi_proxy_test.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -113,10 +115,9 @@ class ThreadAwareCallbackAbortTest : public proxy::PluginProxyMultiThreadTest {
void SetUpTestOnSecondaryThread() override {
{
ProxyAutoLock auto_lock;
- main_thread_message_loop_proxy_->PostTask(
- FROM_HERE,
- base::Bind(&ThreadAwareCallbackAbortTest::DeleteCallback,
- base::Unretained(this)));
+ main_thread_task_runner_->PostTask(
+ FROM_HERE, base::Bind(&ThreadAwareCallbackAbortTest::DeleteCallback,
+ base::Unretained(this)));
// |main_thread_callback_| is still valid, even if DeleteCallback() can be
// called before this following statement. That is because |auto_lock| is
// still held by this method, which prevents DeleteCallback() from
diff --git a/ppapi/shared_impl/tracked_callback.cc b/ppapi/shared_impl/tracked_callback.cc
index da0da42..c032a50 100644
--- a/ppapi/shared_impl/tracked_callback.cc
+++ b/ppapi/shared_impl/tracked_callback.cc
@@ -6,9 +6,11 @@
#include "base/bind.h"
#include "base/compiler_specific.h"
+#include "base/location.h"
#include "base/logging.h"
-#include "base/message_loop/message_loop.h"
+#include "base/single_thread_task_runner.h"
#include "base/synchronization/lock.h"
+#include "base/thread_task_runner_handle.h"
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_message_loop.h"
@@ -255,7 +257,8 @@ void TrackedCallback::PostRunWithLock(int32_t result) {
// classes protect against having a null target_loop_ otherwise).
DCHECK(IsMainThread());
DCHECK(PpapiGlobals::Get()->IsHostGlobals());
- base::MessageLoop::current()->PostTask(FROM_HERE, callback_closure);
+ base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
+ callback_closure);
}
}
is_scheduled_ = true;