Introduce task_runner() accessors for both base::Thread and base::MessageLoop
This is so that callers can code against a TaskRunner interface
directly, rather than converting message_loop_proxy() into a TaskRunner.
BUG=391045
Review URL: https://codereview.chromium.org/389653005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282767 0039d316-1c4b-4281-b951-d872f2087c98
CrOS-Libchrome-Original-Commit: 54e0612d52deedf7a0f0a0f9a65aa5ab0bc67947
diff --git a/base/message_loop/message_loop.h b/base/message_loop/message_loop.h
index a65fbf5..330bde6 100644
--- a/base/message_loop/message_loop.h
+++ b/base/message_loop/message_loop.h
@@ -295,10 +295,17 @@
const std::string& thread_name() const { return thread_name_; }
// Gets the message loop proxy associated with this message loop.
+ //
+ // NOTE: Deprecated; prefer task_runner() and the TaskRunner interfaces
scoped_refptr<MessageLoopProxy> message_loop_proxy() {
return message_loop_proxy_;
}
+ // Gets the TaskRunner associated with this message loop.
+ scoped_refptr<SingleThreadTaskRunner> task_runner() {
+ return message_loop_proxy_;
+ }
+
// Enables or disables the recursive task processing. This happens in the case
// of recursive message loops. Some unwanted message loop may occurs when
// using common controls or printer functions. By default, recursive task