| 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 TOOLS_ANDROID_FORWARDER2_HOST_CONTROLLER_H_ | 5 #ifndef TOOLS_ANDROID_FORWARDER2_HOST_CONTROLLER_H_ |
| 6 #define TOOLS_ANDROID_FORWARDER2_HOST_CONTROLLER_H_ | 6 #define TOOLS_ANDROID_FORWARDER2_HOST_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 const int adb_port_; | 78 const int adb_port_; |
| 79 // Used to notify the controller when the process is killed. | 79 // Used to notify the controller when the process is killed. |
| 80 const int global_exit_notifier_fd_; | 80 const int global_exit_notifier_fd_; |
| 81 scoped_ptr<Socket> adb_control_socket_; | 81 scoped_ptr<Socket> adb_control_socket_; |
| 82 // Used to cancel the pending blocking IO operations when the host controller | 82 // Used to cancel the pending blocking IO operations when the host controller |
| 83 // instance is deleted. | 83 // instance is deleted. |
| 84 scoped_ptr<PipeNotifier> delete_controller_notifier_; | 84 scoped_ptr<PipeNotifier> delete_controller_notifier_; |
| 85 // Task runner used for deletion set at deletion time (i.e. the object is | 85 // Task runner used for deletion set at deletion time (i.e. the object is |
| 86 // deleted on the same thread it is created on). | 86 // deleted on the same thread it is created on). |
| 87 const scoped_refptr<base::SingleThreadTaskRunner> deletion_task_runner_; | 87 const scoped_refptr<base::SingleThreadTaskRunner> deletion_task_runner_; |
| 88 // Note that this thread must outlive |forwarders_manager_| below. The | |
| 89 // ForwardersManager's internal delegate (outliving ForwardersManager) may | |
| 90 // post a task to this thread when it gets deleted. Also note that | |
| 91 // base::Thread joins on destruction which means that ~Thread() will only | |
| 92 // return after it executed all the tasks enqueued in its message loop. This | |
| 93 // also means that it is guaranteed that all the Forwarder instances owned by | |
| 94 // the ForwardersManager's internal delegate are destructed before | |
| 95 // ~HostController() returns. | |
| 96 base::Thread thread_; | 88 base::Thread thread_; |
| 97 ForwardersManager forwarders_manager_; | 89 ForwardersManager forwarders_manager_; |
| 98 | 90 |
| 99 DISALLOW_COPY_AND_ASSIGN(HostController); | 91 DISALLOW_COPY_AND_ASSIGN(HostController); |
| 100 }; | 92 }; |
| 101 | 93 |
| 102 } // namespace forwarder2 | 94 } // namespace forwarder2 |
| 103 | 95 |
| 104 #endif // TOOLS_ANDROID_FORWARDER2_HOST_CONTROLLER_H_ | 96 #endif // TOOLS_ANDROID_FORWARDER2_HOST_CONTROLLER_H_ |
| OLD | NEW |