summaryrefslogtreecommitdiffstats
path: root/device/hid/hid_connection_linux.h
diff options
context:
space:
mode:
authorrockot@chromium.org <rockot@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-27 17:29:10 +0000
committerrockot@chromium.org <rockot@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-27 17:29:10 +0000
commit26958d1d63547e6ff5f9f254e718905709fb6daf (patch)
tree2cc5f9553d8bd8d56f8d438fec805e11c2e2e01c /device/hid/hid_connection_linux.h
parent76d03f895522ae0ea5106c31618115b1a1d2c575 (diff)
downloadchromium_src-26958d1d63547e6ff5f9f254e718905709fb6daf.zip
chromium_src-26958d1d63547e6ff5f9f254e718905709fb6daf.tar.gz
chromium_src-26958d1d63547e6ff5f9f254e718905709fb6daf.tar.bz2
Clean up HID backend and API.
The Mac backend no longer creates its own thread and instead simply enforces single-threaded usage on any thread which supports I/O. Ref management has also been sanitized. The Linux backend now implements feature report support. The backend interface no longer expects implicit report IDs in buffers passed to Write or SetFeatureReport. Instead these interfaces (as well as GetFeatureReport) take explicit report ID arguments. The API interface has been updated to reflect the improved report ID treatment. Finally, the API also now exposes opaque device identifiers on enumeration, rather than exposing raw system paths or other information that could be potentially sensitive. BUG=347294 Review URL: https://codereview.chromium.org/161823002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@253853 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'device/hid/hid_connection_linux.h')
-rw-r--r--device/hid/hid_connection_linux.h29
1 files changed, 10 insertions, 19 deletions
diff --git a/device/hid/hid_connection_linux.h b/device/hid/hid_connection_linux.h
index 78c8952..67d6299 100644
--- a/device/hid/hid_connection_linux.h
+++ b/device/hid/hid_connection_linux.h
@@ -7,11 +7,9 @@
#include "base/files/file.h"
#include "base/memory/ref_counted.h"
-#include "base/tuple.h"
#include "device/hid/hid_connection.h"
#include "device/hid/hid_device_info.h"
#include "device/hid/hid_service_linux.h"
-#include "net/base/io_buffer.h"
namespace device {
@@ -21,21 +19,18 @@ class HidConnectionLinux : public HidConnection,
HidConnectionLinux(HidDeviceInfo device_info,
ScopedUdevDevicePtr udev_raw_device);
- virtual void Read(scoped_refptr<net::IOBuffer> buffer,
- size_t size,
+ virtual void Read(scoped_refptr<net::IOBufferWithSize> buffer,
const IOCallback& callback) OVERRIDE;
- virtual void Write(scoped_refptr<net::IOBuffer> buffer,
- size_t size,
+ virtual void Write(uint8_t report_id,
+ scoped_refptr<net::IOBufferWithSize> buffer,
const IOCallback& callback) OVERRIDE;
- virtual void GetFeatureReport(scoped_refptr<net::IOBuffer> buffer,
- size_t size,
+ virtual void GetFeatureReport(uint8_t report_id,
+ scoped_refptr<net::IOBufferWithSize> buffer,
const IOCallback& callback) OVERRIDE;
- virtual void SendFeatureReport(scoped_refptr<net::IOBuffer> buffer,
- size_t size,
+ virtual void SendFeatureReport(uint8_t report_id,
+ scoped_refptr<net::IOBufferWithSize> buffer,
const IOCallback& callback) OVERRIDE;
- bool initialized() const { return initialized_; }
-
// Implements base::MessagePumpLibevent::Watcher
virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE;
virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE;
@@ -52,14 +47,10 @@ class HidConnectionLinux : public HidConnection,
base::File device_file_;
base::MessagePumpLibevent::FileDescriptorWatcher device_file_watcher_;
- typedef std::pair<scoped_refptr<net::IOBuffer>, size_t> PendingReport;
- typedef Tuple3<scoped_refptr<net::IOBuffer>, size_t, IOCallback>
- PendingRequest;
-
- std::queue<PendingReport> input_reports_;
- std::queue<PendingRequest> read_queue_;
+ std::queue<PendingHidReport> pending_reports_;
+ std::queue<PendingHidRead> pending_reads_;
- bool initialized_;
+ base::ThreadChecker thread_checker_;
DISALLOW_COPY_AND_ASSIGN(HidConnectionLinux);
};