Chromium Code Reviews| Index: remoting/base/auto_message_loop.cc |
| diff --git a/remoting/base/auto_message_loop.cc b/remoting/base/auto_message_loop.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f27880a164287f89bb01c0fde01d3c09824d7704 |
| --- /dev/null |
| +++ b/remoting/base/auto_message_loop.cc |
| @@ -0,0 +1,44 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "remoting/base/auto_message_loop.h" |
| + |
| +#include "base/logging.h" |
| + |
| +namespace remoting { |
| + |
| +AutoMessageLoop::AutoMessageLoop(MessageLoop* message_loop) |
| + : message_loop_(message_loop) { |
| +} |
| + |
| +bool AutoMessageLoop::PostDelayedTask( |
| + const tracked_objects::Location& from_here, |
| + const base::Closure& task, |
| + base::TimeDelta delay) { |
| + message_loop_->PostDelayedTask(from_here, task, delay); |
| + return true; |
| +} |
| + |
| +bool AutoMessageLoop::PostNonNestableDelayedTask( |
| + const tracked_objects::Location& from_here, |
| + const base::Closure& task, |
| + base::TimeDelta delay) { |
| + message_loop_->PostNonNestableDelayedTask(from_here, task, delay); |
| + return true; |
| +} |
| + |
| +bool AutoMessageLoop::RunsTasksOnCurrentThread() const { |
| + return MessageLoop::current() == message_loop_; |
| +} |
| + |
| +void AutoMessageLoop::OnDestruct() const { |
| + // Deletes |this| on the message loop and exists the loop. |
|
Wez
2012/08/24 21:30:49
typo: exits
alexeypa (please no reviews)
2012/08/27 21:19:40
Done.
|
| + message_loop_->DeleteSoon(FROM_HERE, this); |
| + message_loop_->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
| +} |
| + |
| +AutoMessageLoop::~AutoMessageLoop() { |
| +} |
| + |
| +} // namespace remoting |