| 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_H_ | 5 #ifndef REMOTING_BASE_AUTO_THREAD_H_ |
| 6 #define REMOTING_BASE_AUTO_THREAD_H_ | 6 #define REMOTING_BASE_AUTO_THREAD_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 11 #include "base/threading/platform_thread.h" | 12 #include "base/threading/platform_thread.h" |
| 13 #include "build/build_config.h" |
| 12 #include "remoting/base/auto_thread_task_runner.h" | 14 #include "remoting/base/auto_thread_task_runner.h" |
| 13 | 15 |
| 14 namespace remoting { | 16 namespace remoting { |
| 15 | 17 |
| 16 // Thread implementation that runs a MessageLoop on a new thread, and manages | 18 // Thread implementation that runs a MessageLoop on a new thread, and manages |
| 17 // the lifetime of the MessageLoop and thread by tracking references to the | 19 // the lifetime of the MessageLoop and thread by tracking references to the |
| 18 // thread's TaskRunner. The caller passes the thread's TaskRunner to each | 20 // thread's TaskRunner. The caller passes the thread's TaskRunner to each |
| 19 // object that needs to run code on the thread, and when no references to the | 21 // object that needs to run code on the thread, and when no references to the |
| 20 // TaskRunner remain, the thread will exit. When the caller destroys this | 22 // TaskRunner remain, the thread will exit. When the caller destroys this |
| 21 // object they will be blocked until the thread exits. | 23 // object they will be blocked until the thread exits. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 108 |
| 107 // AutoThreadTaskRunner to post a task to to join & delete this thread. | 109 // AutoThreadTaskRunner to post a task to to join & delete this thread. |
| 108 scoped_refptr<AutoThreadTaskRunner> joiner_; | 110 scoped_refptr<AutoThreadTaskRunner> joiner_; |
| 109 | 111 |
| 110 DISALLOW_COPY_AND_ASSIGN(AutoThread); | 112 DISALLOW_COPY_AND_ASSIGN(AutoThread); |
| 111 }; | 113 }; |
| 112 | 114 |
| 113 } // namespace remoting | 115 } // namespace remoting |
| 114 | 116 |
| 115 #endif // REMOTING_AUTO_THREAD_H_ | 117 #endif // REMOTING_AUTO_THREAD_H_ |
| OLD | NEW |