Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Unified Diff: device/hid/hid_connection_linux.cc

Issue 825523003: Convert HidDeviceInfo from a struct to a refcounted class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added TODO to remove friend class definitions. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/hid/hid_connection_linux.h ('k') | device/hid/hid_connection_mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/hid/hid_connection_linux.cc
diff --git a/device/hid/hid_connection_linux.cc b/device/hid/hid_connection_linux.cc
index 27975e2eb4a610b4d4e11b8f9c35cab0b6eb1a51..e9ca4b282a64f70d97af44852723fd0ba6f127b1 100644
--- a/device/hid/hid_connection_linux.cc
+++ b/device/hid/hid_connection_linux.cc
@@ -32,15 +32,15 @@ namespace device {
class HidConnectionLinux::Helper : public base::MessagePumpLibevent::Watcher {
public:
Helper(base::PlatformFile platform_file,
- const HidDeviceInfo& device_info,
+ scoped_refptr<HidDeviceInfo> device_info,
base::WeakPtr<HidConnectionLinux> connection,
scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: platform_file_(platform_file),
connection_(connection),
task_runner_(task_runner) {
// Report buffers must always have room for the report ID.
- report_buffer_size_ = device_info.max_input_report_size + 1;
- has_report_id_ = device_info.has_report_id;
+ report_buffer_size_ = device_info->max_input_report_size() + 1;
+ has_report_id_ = device_info->has_report_id();
}
~Helper() override { DCHECK(thread_checker_.CalledOnValidThread()); }
@@ -111,7 +111,7 @@ class HidConnectionLinux::Helper : public base::MessagePumpLibevent::Watcher {
};
HidConnectionLinux::HidConnectionLinux(
- const HidDeviceInfo& device_info,
+ scoped_refptr<HidDeviceInfo> device_info,
base::File device_file,
scoped_refptr<base::SingleThreadTaskRunner> file_task_runner)
: HidConnection(device_info),
@@ -175,9 +175,9 @@ void HidConnectionLinux::PlatformGetFeatureReport(
const ReadCallback& callback) {
// The first byte of the destination buffer is the report ID being requested
// and is overwritten by the feature report.
- DCHECK_GT(device_info().max_feature_report_size, 0u);
+ DCHECK_GT(device_info()->max_feature_report_size(), 0u);
scoped_refptr<net::IOBufferWithSize> buffer(
- new net::IOBufferWithSize(device_info().max_feature_report_size + 1));
+ new net::IOBufferWithSize(device_info()->max_feature_report_size() + 1));
buffer->data()[0] = report_id;
file_task_runner_->PostTask(
« no previous file with comments | « device/hid/hid_connection_linux.h ('k') | device/hid/hid_connection_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698