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 "tools/android/forwarder2/host_controller.h" | 5 #include "tools/android/forwarder2/host_controller.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 host_port_(host_port), | 78 host_port_(host_port), |
79 adb_port_(adb_port), | 79 adb_port_(adb_port), |
80 global_exit_notifier_fd_(exit_notifier_fd), | 80 global_exit_notifier_fd_(exit_notifier_fd), |
81 adb_control_socket_(adb_control_socket.Pass()), | 81 adb_control_socket_(adb_control_socket.Pass()), |
82 delete_controller_notifier_(delete_controller_notifier.Pass()), | 82 delete_controller_notifier_(delete_controller_notifier.Pass()), |
83 deletion_task_runner_(base::ThreadTaskRunnerHandle::Get()), | 83 deletion_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
84 thread_("HostControllerThread") { | 84 thread_("HostControllerThread") { |
85 } | 85 } |
86 | 86 |
87 void HostController::ReadNextCommandSoon() { | 87 void HostController::ReadNextCommandSoon() { |
88 thread_.message_loop_proxy()->PostTask( | 88 thread_.task_runner()->PostTask( |
89 FROM_HERE, | 89 FROM_HERE, |
90 base::Bind(&HostController::ReadCommandOnInternalThread, | 90 base::Bind(&HostController::ReadCommandOnInternalThread, |
91 base::Unretained(this))); | 91 base::Unretained(this))); |
92 } | 92 } |
93 | 93 |
94 void HostController::ReadCommandOnInternalThread() { | 94 void HostController::ReadCommandOnInternalThread() { |
95 if (!ReceivedCommand(command::ACCEPT_SUCCESS, adb_control_socket_.get())) { | 95 if (!ReceivedCommand(command::ACCEPT_SUCCESS, adb_control_socket_.get())) { |
96 LOG(ERROR) << "Did not receive ACCEPT_SUCCESS for port: " | 96 LOG(ERROR) << "Did not receive ACCEPT_SUCCESS for port: " |
97 << host_port_; | 97 << host_port_; |
98 OnInternalThreadError(); | 98 OnInternalThreadError(); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 LOG(ERROR) << "Could not send unmap command for port " << device_port_; | 162 LOG(ERROR) << "Could not send unmap command for port " << device_port_; |
163 return; | 163 return; |
164 } | 164 } |
165 if (!ReceivedCommand(command::UNLISTEN_SUCCESS, &socket)) { | 165 if (!ReceivedCommand(command::UNLISTEN_SUCCESS, &socket)) { |
166 LOG(ERROR) << "Unamp command failed for port " << device_port_; | 166 LOG(ERROR) << "Unamp command failed for port " << device_port_; |
167 return; | 167 return; |
168 } | 168 } |
169 } | 169 } |
170 | 170 |
171 } // namespace forwarder2 | 171 } // namespace forwarder2 |
OLD | NEW |