| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_controllers_manager.h" | 5 #include "tools/android/forwarder2/host_controllers_manager.h" |
| 6 | 6 |
| 7 #include "base/process/launch.h" | 7 #include "base/process/launch.h" |
| 8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 const base::WeakPtr<HostControllersManager>& manager_ptr, | 61 const base::WeakPtr<HostControllersManager>& manager_ptr, |
| 62 std::unique_ptr<HostController> host_controller) { | 62 std::unique_ptr<HostController> host_controller) { |
| 63 HostController* const controller = host_controller.release(); | 63 HostController* const controller = host_controller.release(); |
| 64 HostControllersManager* const manager = manager_ptr.get(); | 64 HostControllersManager* const manager = manager_ptr.get(); |
| 65 if (!manager) { | 65 if (!manager) { |
| 66 // Note that |controller| is not leaked in this case since the host | 66 // Note that |controller| is not leaked in this case since the host |
| 67 // controllers manager owns the controllers. If the manager was deleted | 67 // controllers manager owns the controllers. If the manager was deleted |
| 68 // then all the controllers (including |controller|) were also deleted. | 68 // then all the controllers (including |controller|) were also deleted. |
| 69 return; | 69 return; |
| 70 } | 70 } |
| 71 DCHECK(manager->thread_->task_runner()->RunsTasksOnCurrentThread()); | 71 DCHECK(manager->thread_->task_runner()->RunsTasksInCurrentSequence()); |
| 72 // Note that this will delete |controller| which is owned by the map. | 72 // Note that this will delete |controller| which is owned by the map. |
| 73 DeleteRefCountedValueInMap( | 73 DeleteRefCountedValueInMap( |
| 74 MakeHostControllerMapKey(controller->adb_port(), | 74 MakeHostControllerMapKey(controller->adb_port(), |
| 75 controller->device_port()), | 75 controller->device_port()), |
| 76 manager->controllers_.get()); | 76 manager->controllers_.get()); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void HostControllersManager::Map(const std::string& adb_path, | 79 void HostControllersManager::Map(const std::string& adb_path, |
| 80 const std::string& device_serial, | 80 const std::string& device_serial, |
| 81 int adb_port, | 81 int adb_port, |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 return result; | 309 return result; |
| 310 } | 310 } |
| 311 | 311 |
| 312 bool HostControllersManager::GetAppOutputAndError( | 312 bool HostControllersManager::GetAppOutputAndError( |
| 313 const std::vector<std::string>& argv, | 313 const std::vector<std::string>& argv, |
| 314 std::string* output) { | 314 std::string* output) { |
| 315 return base::GetAppOutputAndError(argv, output); | 315 return base::GetAppOutputAndError(argv, output); |
| 316 } | 316 } |
| 317 | 317 |
| 318 } // namespace forwarder2 | 318 } // namespace forwarder2 |
| OLD | NEW |