OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "remoting/base/auto_message_loop.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 |
| 9 namespace remoting { |
| 10 |
| 11 AutoMessageLoop::AutoMessageLoop(MessageLoop::Type type) { |
| 12 message_loop_.reset(new MessageLoop(type)); |
| 13 } |
| 14 |
| 15 AutoMessageLoop::~AutoMessageLoop() { |
| 16 } |
| 17 |
| 18 void AutoMessageLoop::Run() { |
| 19 message_loop_->Run(); |
| 20 } |
| 21 |
| 22 bool AutoMessageLoop::PostDelayedTask( |
| 23 const tracked_objects::Location& from_here, |
| 24 const base::Closure& task, |
| 25 base::TimeDelta delay) { |
| 26 message_loop_->PostDelayedTask(from_here, task, delay); |
| 27 return true; |
| 28 } |
| 29 |
| 30 bool AutoMessageLoop::PostNonNestableDelayedTask( |
| 31 const tracked_objects::Location& from_here, |
| 32 const base::Closure& task, |
| 33 base::TimeDelta delay) { |
| 34 message_loop_->PostNonNestableDelayedTask(from_here, task, delay); |
| 35 return true; |
| 36 } |
| 37 |
| 38 bool AutoMessageLoop::RunsTasksOnCurrentThread() const { |
| 39 return MessageLoop::current() == message_loop_.get(); |
| 40 } |
| 41 |
| 42 void AutoMessageLoop::OnDestruct() const { |
| 43 message_loop_->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
| 44 } |
| 45 |
| 46 } // namespace remoting |
OLD | NEW |