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_
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
{
20 class DeviceController
{
22 explicit DeviceController(int exit_notifier_fd
);
25 bool Init(const std::string
& adb_unix_socket
);
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_