| 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 #ifndef REMOTING_BASE_AUTO_THREAD_TASK_RUNNER_H_ | 5 #ifndef REMOTING_BASE_AUTO_THREAD_TASK_RUNNER_H_ |
| 6 #define REMOTING_BASE_AUTO_THREAD_TASK_RUNNER_H_ | 6 #define REMOTING_BASE_AUTO_THREAD_TASK_RUNNER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // Constructs an instance of |AutoThreadTaskRunner| wrapping |task_runner|. | 21 // Constructs an instance of |AutoThreadTaskRunner| wrapping |task_runner|. |
| 22 // |stop_task| is posted to |task_runner| when the last reference to | 22 // |stop_task| is posted to |task_runner| when the last reference to |
| 23 // the AutoThreadTaskRunner is dropped. | 23 // the AutoThreadTaskRunner is dropped. |
| 24 AutoThreadTaskRunner(scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 24 AutoThreadTaskRunner(scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 25 const base::Closure& stop_task); | 25 const base::Closure& stop_task); |
| 26 | 26 |
| 27 // SingleThreadTaskRunner implementation | 27 // SingleThreadTaskRunner implementation |
| 28 virtual bool PostDelayedTask( | 28 virtual bool PostDelayedTask( |
| 29 const tracked_objects::Location& from_here, | 29 const tracked_objects::Location& from_here, |
| 30 const base::Closure& task, | 30 const base::Closure& task, |
| 31 base::TimeDelta delay) OVERRIDE; | 31 base::TimeDelta delay) override; |
| 32 virtual bool PostNonNestableDelayedTask( | 32 virtual bool PostNonNestableDelayedTask( |
| 33 const tracked_objects::Location& from_here, | 33 const tracked_objects::Location& from_here, |
| 34 const base::Closure& task, | 34 const base::Closure& task, |
| 35 base::TimeDelta delay) OVERRIDE; | 35 base::TimeDelta delay) override; |
| 36 virtual bool RunsTasksOnCurrentThread() const OVERRIDE; | 36 virtual bool RunsTasksOnCurrentThread() const override; |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 virtual ~AutoThreadTaskRunner(); | 39 virtual ~AutoThreadTaskRunner(); |
| 40 | 40 |
| 41 // Task posted to |task_runner_| to notify the caller that it may be stopped. | 41 // Task posted to |task_runner_| to notify the caller that it may be stopped. |
| 42 base::Closure stop_task_; | 42 base::Closure stop_task_; |
| 43 | 43 |
| 44 // The wrapped task runner. | 44 // The wrapped task runner. |
| 45 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 45 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 46 | 46 |
| 47 DISALLOW_COPY_AND_ASSIGN(AutoThreadTaskRunner); | 47 DISALLOW_COPY_AND_ASSIGN(AutoThreadTaskRunner); |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 } // namespace remoting | 50 } // namespace remoting |
| 51 | 51 |
| 52 #endif // REMOTING_BASE_AUTO_THREAD_TASK_RUNNER_H_ | 52 #endif // REMOTING_BASE_AUTO_THREAD_TASK_RUNNER_H_ |
| OLD | NEW |