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 <memory> |
| 9 |
8 #include "base/callback.h" | 10 #include "base/callback.h" |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
12 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
13 | 14 |
14 namespace remoting { | 15 namespace remoting { |
15 | 16 |
16 // A wrapper around |SingleThreadTaskRunner| that provides automatic lifetime | 17 // A wrapper around |SingleThreadTaskRunner| that provides automatic lifetime |
17 // management, by posting a caller-supplied task to the underlying task runner | 18 // management, by posting a caller-supplied task to the underlying task runner |
18 // when no more references remain. | 19 // when no more references remain. |
19 class AutoThreadTaskRunner : public base::SingleThreadTaskRunner { | 20 class AutoThreadTaskRunner : public base::SingleThreadTaskRunner { |
20 public: | 21 public: |
(...skipping 20 matching lines...) Expand all Loading... |
41 | 42 |
42 // The wrapped task runner. | 43 // The wrapped task runner. |
43 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 44 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
44 | 45 |
45 DISALLOW_COPY_AND_ASSIGN(AutoThreadTaskRunner); | 46 DISALLOW_COPY_AND_ASSIGN(AutoThreadTaskRunner); |
46 }; | 47 }; |
47 | 48 |
48 } // namespace remoting | 49 } // namespace remoting |
49 | 50 |
50 #endif // REMOTING_BASE_AUTO_THREAD_TASK_RUNNER_H_ | 51 #endif // REMOTING_BASE_AUTO_THREAD_TASK_RUNNER_H_ |
OLD | NEW |