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

Unified Diff: device/hid/hid_connection_mac.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_mac.h ('k') | device/hid/hid_connection_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/hid/hid_connection_mac.cc
diff --git a/device/hid/hid_connection_mac.cc b/device/hid/hid_connection_mac.cc
index 5f8ef9776d4dad9d8b3ae7c3ee754348f2159a3e..fe485f7ec7f931e51187e75b7c81e4b1ab8eda25 100644
--- a/device/hid/hid_connection_mac.cc
+++ b/device/hid/hid_connection_mac.cc
@@ -16,7 +16,7 @@ namespace device {
HidConnectionMac::HidConnectionMac(
IOHIDDeviceRef device,
- HidDeviceInfo device_info,
+ scoped_refptr<HidDeviceInfo> device_info,
scoped_refptr<base::SingleThreadTaskRunner> file_task_runner)
: HidConnection(device_info),
device_(device, base::scoped_policy::RETAIN),
@@ -27,8 +27,8 @@ HidConnectionMac::HidConnectionMac(
IOHIDDeviceScheduleWithRunLoop(
device_.get(), CFRunLoopGetMain(), kCFRunLoopDefaultMode);
- size_t expected_report_size = device_info.max_input_report_size;
- if (device_info.has_report_id) {
+ size_t expected_report_size = device_info->max_input_report_size();
+ if (device_info->has_report_id()) {
expected_report_size++;
}
inbound_buffer_.resize(expected_report_size);
@@ -126,7 +126,7 @@ void HidConnectionMac::InputReportCallback(void* context,
}
scoped_refptr<net::IOBufferWithSize> buffer;
- if (connection->device_info().has_report_id) {
+ if (connection->device_info()->has_report_id()) {
// report_id is already contained in report_bytes
buffer = new net::IOBufferWithSize(report_length);
memcpy(buffer->data(), report_bytes, report_length);
@@ -165,7 +165,7 @@ void HidConnectionMac::ProcessReadQueue() {
void HidConnectionMac::GetFeatureReportAsync(uint8_t report_id,
const ReadCallback& callback) {
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));
CFIndex report_size = buffer->size();
// The IOHIDDevice object is shared with the UI thread and so this function
« no previous file with comments | « device/hid/hid_connection_mac.h ('k') | device/hid/hid_connection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698