summaryrefslogtreecommitdiffstats
path: root/remoting/base
diff options
context:
space:
mode:
authorxhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-30 03:18:44 +0000
committerxhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-30 03:18:44 +0000
commitfaea9d2d6b4647180a1339992a1ad9864817c373 (patch)
treefca9ab649b9cc47c753b83b1407185058281b66b /remoting/base
parente7eca045582b591d26fc32d740f5a1ea7ba0bc35 (diff)
downloadchromium_src-faea9d2d6b4647180a1339992a1ad9864817c373.zip
chromium_src-faea9d2d6b4647180a1339992a1ad9864817c373.tar.gz
chromium_src-faea9d2d6b4647180a1339992a1ad9864817c373.tar.bz2
remoting: Use base::MessageLoop.
BUG=236029 R=alexeypa@chromium.org Review URL: https://chromiumcodereview.appspot.com/14314026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@197247 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/base')
-rw-r--r--remoting/base/auto_thread.cc23
-rw-r--r--remoting/base/auto_thread.h7
-rw-r--r--remoting/base/auto_thread_task_runner_unittest.cc7
-rw-r--r--remoting/base/auto_thread_unittest.cc23
4 files changed, 31 insertions, 29 deletions
diff --git a/remoting/base/auto_thread.cc b/remoting/base/auto_thread.cc
index 9f51378..d79af49 100644
--- a/remoting/base/auto_thread.cc
+++ b/remoting/base/auto_thread.cc
@@ -40,7 +40,7 @@ scoped_ptr<base::win::ScopedCOMInitializer> CreateComInitializer(
// from within StartWithType.
struct AutoThread::StartupData {
// Fields describing the desired thread behaviour.
- MessageLoop::Type loop_type;
+ base::MessageLoop::Type loop_type;
// Used to receive the AutoThreadTaskRunner for the thread.
scoped_refptr<AutoThreadTaskRunner> task_runner;
@@ -48,16 +48,15 @@ struct AutoThread::StartupData {
// Used to synchronize thread startup.
base::WaitableEvent event;
- explicit StartupData(MessageLoop::Type type)
- : loop_type(type),
- event(false, false) {}
+ explicit StartupData(base::MessageLoop::Type type)
+ : loop_type(type), event(false, false) {}
};
// static
scoped_refptr<AutoThreadTaskRunner> AutoThread::CreateWithType(
const char* name,
scoped_refptr<AutoThreadTaskRunner> joiner,
- MessageLoop::Type type) {
+ base::MessageLoop::Type type) {
AutoThread* thread = new AutoThread(name, joiner);
scoped_refptr<AutoThreadTaskRunner> task_runner = thread->StartWithType(type);
if (!task_runner)
@@ -68,7 +67,7 @@ scoped_refptr<AutoThreadTaskRunner> AutoThread::CreateWithType(
// static
scoped_refptr<AutoThreadTaskRunner> AutoThread::Create(
const char* name, scoped_refptr<AutoThreadTaskRunner> joiner) {
- return CreateWithType(name, joiner, MessageLoop::TYPE_DEFAULT);
+ return CreateWithType(name, joiner, base::MessageLoop::TYPE_DEFAULT);
}
#if defined(OS_WIN)
@@ -76,7 +75,7 @@ scoped_refptr<AutoThreadTaskRunner> AutoThread::Create(
scoped_refptr<AutoThreadTaskRunner> AutoThread::CreateWithLoopAndComInitTypes(
const char* name,
scoped_refptr<AutoThreadTaskRunner> joiner,
- MessageLoop::Type loop_type,
+ base::MessageLoop::Type loop_type,
ComInitType com_init_type) {
AutoThread* thread = new AutoThread(name, joiner);
thread->SetComInitType(com_init_type);
@@ -118,11 +117,11 @@ AutoThread::~AutoThread() {
}
}
-scoped_refptr<AutoThreadTaskRunner>
-AutoThread::StartWithType(MessageLoop::Type type) {
+scoped_refptr<AutoThreadTaskRunner> AutoThread::StartWithType(
+ base::MessageLoop::Type type) {
DCHECK(!thread_);
#if defined(OS_WIN)
- DCHECK(com_init_type_ != COM_INIT_STA || type == MessageLoop::TYPE_UI);
+ DCHECK(com_init_type_ != COM_INIT_STA || type == base::MessageLoop::TYPE_UI);
#endif
StartupData startup_data(type);
@@ -165,7 +164,7 @@ void AutoThread::QuitThread(
return;
}
- MessageLoop::current()->Quit();
+ base::MessageLoop::current()->Quit();
was_quit_properly_ = true;
if (joiner_) {
@@ -180,7 +179,7 @@ void AutoThread::JoinAndDeleteThread() {
void AutoThread::ThreadMain() {
// The message loop for this thread.
- MessageLoop message_loop(startup_data_->loop_type);
+ base::MessageLoop message_loop(startup_data_->loop_type);
// Complete the initialization of our AutoThread object.
base::PlatformThread::SetName(name_.c_str());
diff --git a/remoting/base/auto_thread.h b/remoting/base/auto_thread.h
index 6242839..8ed1ee9 100644
--- a/remoting/base/auto_thread.h
+++ b/remoting/base/auto_thread.h
@@ -35,7 +35,7 @@ class AutoThread : base::PlatformThread::Delegate {
static scoped_refptr<AutoThreadTaskRunner> CreateWithType(
const char* name,
scoped_refptr<AutoThreadTaskRunner> joiner,
- MessageLoop::Type type);
+ base::MessageLoop::Type type);
static scoped_refptr<AutoThreadTaskRunner> Create(
const char* name,
scoped_refptr<AutoThreadTaskRunner> joiner);
@@ -47,7 +47,7 @@ class AutoThread : base::PlatformThread::Delegate {
static scoped_refptr<AutoThreadTaskRunner> CreateWithLoopAndComInitTypes(
const char* name,
scoped_refptr<AutoThreadTaskRunner> joiner,
- MessageLoop::Type loop_type,
+ base::MessageLoop::Type loop_type,
ComInitType com_init_type);
#endif
@@ -67,7 +67,8 @@ class AutoThread : base::PlatformThread::Delegate {
//
// NOTE: You must not call this MessageLoop's Quit method directly. The
// thread will exit when no references to the TaskRunner remain.
- scoped_refptr<AutoThreadTaskRunner> StartWithType(MessageLoop::Type type);
+ scoped_refptr<AutoThreadTaskRunner> StartWithType(
+ base::MessageLoop::Type type);
#if defined(OS_WIN)
// Configures the thread to initialize the specified COM apartment type.
diff --git a/remoting/base/auto_thread_task_runner_unittest.cc b/remoting/base/auto_thread_task_runner_unittest.cc
index 95c5416..71c71ce 100644
--- a/remoting/base/auto_thread_task_runner_unittest.cc
+++ b/remoting/base/auto_thread_task_runner_unittest.cc
@@ -20,10 +20,9 @@ namespace remoting {
TEST(AutoThreadTaskRunnerTest, StartAndStop) {
// Create a task runner.
- MessageLoop message_loop;
- scoped_refptr<AutoThreadTaskRunner> task_runner =
- new AutoThreadTaskRunner(
- message_loop.message_loop_proxy(), MessageLoop::QuitClosure());
+ base::MessageLoop message_loop;
+ scoped_refptr<AutoThreadTaskRunner> task_runner = new AutoThreadTaskRunner(
+ message_loop.message_loop_proxy(), base::MessageLoop::QuitClosure());
// Post a task to make sure it is executed.
bool success = false;
diff --git a/remoting/base/auto_thread_unittest.cc b/remoting/base/auto_thread_unittest.cc
index cfbb86b..f78bbf9 100644
--- a/remoting/base/auto_thread_unittest.cc
+++ b/remoting/base/auto_thread_unittest.cc
@@ -67,8 +67,9 @@ class AutoThreadTest : public testing::Test {
// references created in tests are gone. We also post a delayed quit
// task to |message_loop_| so the test will not hang on failure.
main_task_runner_ = NULL;
- message_loop_.PostDelayedTask(
- FROM_HERE, MessageLoop::QuitClosure(), base::TimeDelta::FromSeconds(5));
+ message_loop_.PostDelayedTask(FROM_HERE,
+ base::MessageLoop::QuitClosure(),
+ base::TimeDelta::FromSeconds(5));
message_loop_.Run();
}
@@ -87,10 +88,10 @@ class AutoThreadTest : public testing::Test {
protected:
void QuitMainMessageLoop() {
message_loop_quit_correctly_ = true;
- message_loop_.PostTask(FROM_HERE, MessageLoop::QuitClosure());
+ message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitClosure());
}
- MessageLoop message_loop_;
+ base::MessageLoop message_loop_;
bool message_loop_quit_correctly_;
scoped_refptr<AutoThreadTaskRunner> main_task_runner_;
};
@@ -145,9 +146,10 @@ TEST_F(AutoThreadTest, ThreadDependency) {
#if defined(OS_WIN)
TEST_F(AutoThreadTest, ThreadWithComMta) {
scoped_refptr<base::TaskRunner> task_runner =
- AutoThread::CreateWithLoopAndComInitTypes(
- kThreadName, main_task_runner_, MessageLoop::TYPE_DEFAULT,
- AutoThread::COM_INIT_MTA);
+ AutoThread::CreateWithLoopAndComInitTypes(kThreadName,
+ main_task_runner_,
+ base::MessageLoop::TYPE_DEFAULT,
+ AutoThread::COM_INIT_MTA);
EXPECT_TRUE(task_runner.get());
// Post a task to query the COM apartment type.
@@ -170,9 +172,10 @@ TEST_F(AutoThreadTest, ThreadWithComMta) {
TEST_F(AutoThreadTest, ThreadWithComSta) {
scoped_refptr<base::TaskRunner> task_runner =
- AutoThread::CreateWithLoopAndComInitTypes(
- kThreadName, main_task_runner_, MessageLoop::TYPE_UI,
- AutoThread::COM_INIT_STA);
+ AutoThread::CreateWithLoopAndComInitTypes(kThreadName,
+ main_task_runner_,
+ base::MessageLoop::TYPE_UI,
+ AutoThread::COM_INIT_STA);
EXPECT_TRUE(task_runner.get());
// Post a task to query the COM apartment type.