diff options
author | skyostil <skyostil@chromium.org> | 2015-06-11 11:40:24 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-11 18:42:15 +0000 |
commit | 1472c84a875c09fd4f476d9fd1b5544906b72e03 (patch) | |
tree | 59b7979068ab539ae03351455eec84253fed7ffc /chromeos/process_proxy | |
parent | 0b35325d7b5e25f4942f79e3f4d6269c36f1c2e0 (diff) | |
download | chromium_src-1472c84a875c09fd4f476d9fd1b5544906b72e03.zip chromium_src-1472c84a875c09fd4f476d9fd1b5544906b72e03.tar.gz chromium_src-1472c84a875c09fd4f476d9fd1b5544906b72e03.tar.bz2 |
chromeos: Remove use of MessageLoopProxy and deprecated MessageLoop APIs
This patch was mostly autogenerated with https://codereview.chromium.org/1010073002/.
BUG=465354
Review URL: https://codereview.chromium.org/1173593002
Cr-Commit-Position: refs/heads/master@{#333996}
Diffstat (limited to 'chromeos/process_proxy')
-rw-r--r-- | chromeos/process_proxy/process_output_watcher_unittest.cc | 12 | ||||
-rw-r--r-- | chromeos/process_proxy/process_proxy.cc | 11 | ||||
-rw-r--r-- | chromeos/process_proxy/process_proxy_unittest.cc | 32 |
3 files changed, 29 insertions, 26 deletions
diff --git a/chromeos/process_proxy/process_output_watcher_unittest.cc b/chromeos/process_proxy/process_output_watcher_unittest.cc index 5732467..7a86d6a 100644 --- a/chromeos/process_proxy/process_output_watcher_unittest.cc +++ b/chromeos/process_proxy/process_output_watcher_unittest.cc @@ -11,9 +11,10 @@ #include "base/bind.h" #include "base/callback.h" #include "base/files/file_util.h" -#include "base/message_loop/message_loop.h" +#include "base/location.h" #include "base/posix/eintr_wrapper.h" #include "base/run_loop.h" +#include "base/single_thread_task_runner.h" #include "base/strings/string_util.h" #include "base/threading/thread.h" #include "chromeos/process_proxy/process_output_watcher.h" @@ -107,7 +108,8 @@ class ProcessOutputWatcherTest : public testing::Test { failed_ = !expectations_.CheckExpectations(output, type); if (failed_ || expectations_.IsDone()) { ASSERT_FALSE(test_case_done_callback_.is_null()); - message_loop_.PostTask(FROM_HERE, test_case_done_callback_); + message_loop_.task_runner()->PostTask(FROM_HERE, + test_case_done_callback_); test_case_done_callback_.Reset(); } } @@ -130,12 +132,10 @@ class ProcessOutputWatcherTest : public testing::Test { ASSERT_FALSE(HANDLE_EINTR(pipe(pt_pipe))); ASSERT_FALSE(HANDLE_EINTR(pipe(stop_pipe))); - output_watch_thread_->message_loop()->PostTask( + output_watch_thread_->task_runner()->PostTask( FROM_HERE, base::Bind(&ProcessOutputWatcherTest::StartWatch, - base::Unretained(this), - pt_pipe[0], - stop_pipe[0])); + base::Unretained(this), pt_pipe[0], stop_pipe[0])); for (size_t i = 0; i < test_cases.size(); i++) { expectations_.SetTestCase(test_cases[i]); diff --git a/chromeos/process_proxy/process_proxy.cc b/chromeos/process_proxy/process_proxy.cc index 76ce5f2..4907d8b 100644 --- a/chromeos/process_proxy/process_proxy.cc +++ b/chromeos/process_proxy/process_proxy.cc @@ -10,10 +10,13 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/files/file_util.h" +#include "base/location.h" #include "base/logging.h" #include "base/posix/eintr_wrapper.h" #include "base/process/launch.h" #include "base/process/process.h" +#include "base/single_thread_task_runner.h" +#include "base/thread_task_runner_handle.h" #include "base/threading/thread.h" #include "third_party/cros_system_api/switches/chrome_switches.h" @@ -85,7 +88,7 @@ bool ProcessProxy::StartWatchingOnThread( callback_set_ = true; callback_ = callback; - callback_runner_ = base::MessageLoopProxy::current(); + callback_runner_ = base::ThreadTaskRunnerHandle::Get(); // This object will delete itself once watching is stopped. // It also takes ownership of the passed fds. @@ -99,9 +102,9 @@ bool ProcessProxy::StartWatchingOnThread( shutdown_pipe_[PIPE_END_READ] = -1; // |watch| thread is blocked by |output_watcher| from now on. - watch_thread->message_loop()->PostTask(FROM_HERE, - base::Bind(&ProcessOutputWatcher::Start, - base::Unretained(output_watcher))); + watch_thread->task_runner()->PostTask( + FROM_HERE, base::Bind(&ProcessOutputWatcher::Start, + base::Unretained(output_watcher))); watcher_started_ = true; return true; } diff --git a/chromeos/process_proxy/process_proxy_unittest.cc b/chromeos/process_proxy/process_proxy_unittest.cc index 97c7495..20221c2 100644 --- a/chromeos/process_proxy/process_proxy_unittest.cc +++ b/chromeos/process_proxy/process_proxy_unittest.cc @@ -7,10 +7,12 @@ #include <string> #include "base/bind.h" +#include "base/location.h" #include "base/memory/scoped_ptr.h" -#include "base/message_loop/message_loop.h" #include "base/process/kill.h" #include "base/process/process.h" +#include "base/single_thread_task_runner.h" +#include "base/thread_task_runner_handle.h" #include "base/threading/thread.h" #include "chromeos/process_proxy/process_proxy_registry.h" @@ -76,8 +78,8 @@ class RegistryTestRunner : public TestRunner { } if (!valid || TestSucceeded()) { - base::MessageLoop::current()->PostTask(FROM_HERE, - base::MessageLoop::QuitClosure()); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::MessageLoop::QuitClosure()); } } @@ -139,8 +141,8 @@ class RegistryNotifiedOnProcessExitTestRunner : public TestRunner { return; } EXPECT_EQ("exit", type); - base::MessageLoop::current()->PostTask(FROM_HERE, - base::MessageLoop::QuitClosure()); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::MessageLoop::QuitClosure()); } void StartRegistryTest(ProcessProxyRegistry* registry) override { @@ -164,8 +166,8 @@ class SigIntTestRunner : public TestRunner { // We may receive ^C on stdout, but we don't care about that, as long as we // eventually received exit event. if (type == "exit") { - base::MessageLoop::current()->PostTask(FROM_HERE, - base::MessageLoop::QuitClosure()); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::MessageLoop::QuitClosure()); } } @@ -206,24 +208,22 @@ class ProcessProxyTest : public testing::Test { process.Terminate(0, true); } - base::MessageLoop::current()->PostTask(FROM_HERE, - base::MessageLoop::QuitClosure()); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::MessageLoop::QuitClosure()); } void RunTest() { - base::MessageLoop::current()->PostTask( - FROM_HERE, - base::Bind(&ProcessProxyTest::InitRegistryTest, - base::Unretained(this))); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::Bind(&ProcessProxyTest::InitRegistryTest, + base::Unretained(this))); // Wait until all data from output watcher is received (QuitTask will be // fired on watcher thread). base::MessageLoop::current()->Run(); - base::MessageLoop::current()->PostTask( + base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, - base::Bind(&ProcessProxyTest::EndRegistryTest, - base::Unretained(this))); + base::Bind(&ProcessProxyTest::EndRegistryTest, base::Unretained(this))); // Wait until we clean up the process proxy. base::MessageLoop::current()->Run(); |