Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / device / hid / hid_connection_linux.h
blob1d1c140eeff257cf7df0772720bdb99b74ab4faa
1 // Copyright (c) 2014 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 DEVICE_HID_HID_CONNECTION_LINUX_H_
6 #define DEVICE_HID_HID_CONNECTION_LINUX_H_
8 #include <queue>
10 #include "base/files/file.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/message_loop/message_pump_libevent.h"
13 #include "device/hid/hid_connection.h"
14 #include "device/hid/hid_device_info.h"
15 #include "device/hid/udev_common.h"
17 namespace device {
19 class HidConnectionLinux : public HidConnection,
20 public base::MessagePumpLibevent::Watcher {
21 public:
22 HidConnectionLinux(HidDeviceInfo device_info, std::string dev_node);
24 virtual void Read(scoped_refptr<net::IOBufferWithSize> buffer,
25 const IOCallback& callback) OVERRIDE;
26 virtual void Write(uint8_t report_id,
27 scoped_refptr<net::IOBufferWithSize> buffer,
28 const IOCallback& callback) OVERRIDE;
29 virtual void GetFeatureReport(uint8_t report_id,
30 scoped_refptr<net::IOBufferWithSize> buffer,
31 const IOCallback& callback) OVERRIDE;
32 virtual void SendFeatureReport(uint8_t report_id,
33 scoped_refptr<net::IOBufferWithSize> buffer,
34 const IOCallback& callback) OVERRIDE;
36 // Implements base::MessagePumpLibevent::Watcher
37 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE;
38 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE;
40 private:
41 friend class base::RefCountedThreadSafe<HidConnectionLinux>;
42 virtual ~HidConnectionLinux();
44 void ProcessReadQueue();
45 void Disconnect();
47 base::File device_file_;
48 base::MessagePumpLibevent::FileDescriptorWatcher device_file_watcher_;
50 std::queue<PendingHidReport> pending_reports_;
51 std::queue<PendingHidRead> pending_reads_;
53 base::ThreadChecker thread_checker_;
55 DISALLOW_COPY_AND_ASSIGN(HidConnectionLinux);
58 } // namespace device
60 #endif // DEVICE_HID_HID_CONNECTION_LINUX__