ports/www/chromium/files/patch-device__usb__usb_service_impl.cc
Rene Ladan 21a6834bf3 www/chromium: update to 44.0.2403.107
Note that chromium is currently broken on 9.X due to some obscure compiler
error caused possibly caused by Ports GCC.

Submitted by:	LeFroid
Obtained from:	https://github.com/gliaskos/freebsd-chromium/pull/25
MFH:		2015Q3
Security:	http://vuxml.freebsd.org/freebsd/9d732078-32c7-11e5-b263-00262d5ed8ee.html
2015-07-28 18:35:43 +00:00

56 lines
1.6 KiB
C++

--- device/usb/usb_service_impl.cc.orig 2015-07-15 16:30:04.000000000 -0400
+++ device/usb/usb_service_impl.cc 2015-07-22 20:14:21.946835000 -0400
@@ -17,7 +17,11 @@
#include "base/thread_task_runner_handle.h"
#include "components/device_event_log/device_event_log.h"
#include "device/usb/usb_error.h"
+#if defined(OS_FREEBSD)
+#include "libusb.h"
+#else
#include "third_party/libusb/src/libusb/libusb.h"
+#endif
#if defined(OS_WIN)
#include <setupapi.h>
@@ -294,6 +298,7 @@
weak_factory_(this) {
base::MessageLoop::current()->AddDestructionObserver(this);
+#if !defined(OS_FREEBSD)
int rv = libusb_hotplug_register_callback(
context_->context(),
static_cast<libusb_hotplug_event>(LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED |
@@ -321,14 +326,16 @@
}
#endif // OS_WIN
}
+#endif // !OS_FREEBSD
}
UsbServiceImpl::~UsbServiceImpl() {
base::MessageLoop::current()->RemoveDestructionObserver(this);
-
+#if !defined(OS_FREEBSD)
if (hotplug_enabled_) {
libusb_hotplug_deregister_callback(context_->context(), hotplug_handle_);
}
+#endif // !OS_FREEBSD
for (const auto& map_entry : devices_) {
map_entry.second->OnDisconnect();
}
@@ -566,6 +573,7 @@
device->OnDisconnect();
}
+#if !defined(OS_FREEBSD)
// static
int LIBUSB_CALL UsbServiceImpl::HotplugCallback(libusb_context* context,
PlatformUsbDevice device,
@@ -603,6 +611,7 @@
return 0;
}
+#endif // !OS_FREEBSD
void UsbServiceImpl::OnPlatformDeviceAdded(PlatformUsbDevice platform_device) {
DCHECK(CalledOnValidThread());