When Retrier succeeds, record errors it encountered.
[chromium-blink-merge.git] / tools / android / forwarder2 / device_controller.h
blob4c36698c85604e8bcb2db3dfa188f8b87e65d5fc
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
3 // found in the LICENSE file.
5 #ifndef TOOLS_ANDROID_FORWARDER2_DEVICE_CONTROLLER_H_
6 #define TOOLS_ANDROID_FORWARDER2_DEVICE_CONTROLLER_H_
8 #include <hash_map>
9 #include <string>
11 #include "base/basictypes.h"
12 #include "base/id_map.h"
13 #include "base/memory/linked_ptr.h"
14 #include "tools/android/forwarder2/socket.h"
16 namespace forwarder2 {
18 class DeviceListener;
20 class DeviceController {
21 public:
22 explicit DeviceController(int exit_notifier_fd);
23 ~DeviceController();
25 bool Init(const std::string& adb_unix_socket);
27 void Start();
29 private:
30 void KillAllListeners();
31 void CleanUpDeadListeners();
33 // Map from Port to DeviceListener objects (owns the pointer).
34 typedef IDMap<DeviceListener, IDMapOwnPointer> ListenersMap;
36 ListenersMap listeners_;
37 Socket kickstart_adb_socket_;
39 // Used to notify the controller to exit.
40 const int exit_notifier_fd_;
42 DISALLOW_COPY_AND_ASSIGN(DeviceController);
45 } // namespace forwarder
47 #endif // TOOLS_ANDROID_FORWARDER2_DEVICE_CONTROLLER_H_