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..491d7721817dd0e8f75852af63f97c76193e6d74 |
| --- /dev/null |
| +++ b/remoting/base/auto_message_loop.cc |
| @@ -0,0 +1,48 @@ |
| +// 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(base::SingleThreadTaskRunner* parent, |
| + base::SingleThreadTaskRunner* task_runner, |
| + const base::Closure& stop_callback) |
| + : parent_(parent), |
| + stop_callback_(stop_callback), |
| + task_runner_(task_runner) { |
| +} |
| + |
| +bool AutoMessageLoop::PostDelayedTask( |
| + const tracked_objects::Location& from_here, |
| + const base::Closure& task, |
| + base::TimeDelta delay) { |
| + CHECK(task_runner_->PostDelayedTask(from_here, task, delay)); |
|
Wez
2012/08/28 17:34:53
Why CHECK rather than returning the result?
alexeypa (please no reviews)
2012/08/28 19:18:51
The whole purpose of this class is to make sure th
|
| + return true; |
| +} |
| + |
| +bool AutoMessageLoop::PostNonNestableDelayedTask( |
| + const tracked_objects::Location& from_here, |
| + const base::Closure& task, |
| + base::TimeDelta delay) { |
| + CHECK(task_runner_->PostNonNestableDelayedTask(from_here, task, delay)); |
|
Wez
2012/08/28 17:34:53
Ditto.
alexeypa (please no reviews)
2012/08/28 19:18:51
See above.
|
| + return true; |
| +} |
| + |
| +bool AutoMessageLoop::RunsTasksOnCurrentThread() const { |
| + return task_runner_->RunsTasksOnCurrentThread(); |
| +} |
| + |
| +void AutoMessageLoop::OnDestruct() const { |
| + if (!stop_callback_.is_null()) |
| + stop_callback_.Run(); |
| + delete this; |
| +} |
| + |
| +AutoMessageLoop::~AutoMessageLoop() { |
| +} |
| + |
| +} // namespace remoting |