| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/base/auto_thread_task_runner.h" | 5 #include "remoting/base/auto_thread_task_runner.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace remoting { | 9 namespace remoting { |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 const base::Closure& stop_callback) | 33 const base::Closure& stop_callback) |
| 34 : parent_(parent), | 34 : parent_(parent), |
| 35 stop_callback_(stop_callback), | 35 stop_callback_(stop_callback), |
| 36 task_runner_(task_runner) { | 36 task_runner_(task_runner) { |
| 37 } | 37 } |
| 38 | 38 |
| 39 bool AutoThreadTaskRunner::PostDelayedTask( | 39 bool AutoThreadTaskRunner::PostDelayedTask( |
| 40 const tracked_objects::Location& from_here, | 40 const tracked_objects::Location& from_here, |
| 41 const base::Closure& task, | 41 const base::Closure& task, |
| 42 base::TimeDelta delay) { | 42 base::TimeDelta delay) { |
| 43 // CHECK() makes sure that |task_runner_| is still running, - the assumption | 43 return task_runner_->PostDelayedTask(from_here, task, delay); |
| 44 // made by |AutoThreadTaskRunner| owners. | |
| 45 CHECK(task_runner_->PostDelayedTask(from_here, task, delay)); | |
| 46 return true; | |
| 47 } | 44 } |
| 48 | 45 |
| 49 bool AutoThreadTaskRunner::PostNonNestableDelayedTask( | 46 bool AutoThreadTaskRunner::PostNonNestableDelayedTask( |
| 50 const tracked_objects::Location& from_here, | 47 const tracked_objects::Location& from_here, |
| 51 const base::Closure& task, | 48 const base::Closure& task, |
| 52 base::TimeDelta delay) { | 49 base::TimeDelta delay) { |
| 53 // CHECK() makes sure that |task_runner_| is still running, - the assumption | 50 return task_runner_->PostNonNestableDelayedTask(from_here, task, delay); |
| 54 // made by |AutoThreadTaskRunner| owners. | |
| 55 CHECK(task_runner_->PostNonNestableDelayedTask(from_here, task, delay)); | |
| 56 return true; | |
| 57 } | 51 } |
| 58 | 52 |
| 59 bool AutoThreadTaskRunner::RunsTasksOnCurrentThread() const { | 53 bool AutoThreadTaskRunner::RunsTasksOnCurrentThread() const { |
| 60 return task_runner_->RunsTasksOnCurrentThread(); | 54 return task_runner_->RunsTasksOnCurrentThread(); |
| 61 } | 55 } |
| 62 | 56 |
| 63 AutoThreadTaskRunner::~AutoThreadTaskRunner() { | 57 AutoThreadTaskRunner::~AutoThreadTaskRunner() { |
| 64 if (!stop_callback_.is_null()) | 58 if (!stop_callback_.is_null()) |
| 65 stop_callback_.Run(); | 59 stop_callback_.Run(); |
| 66 } | 60 } |
| 67 | 61 |
| 68 } // namespace remoting | 62 } // namespace remoting |
| OLD | NEW |