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

Unified Diff: chrome/browser/usb/usb_service.h

Issue 23571007: Fail gracefully when libusb_init fails (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@usb-safe-exit
Patch Set: Created 7 years, 3 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
Index: chrome/browser/usb/usb_service.h
diff --git a/chrome/browser/usb/usb_service.h b/chrome/browser/usb/usb_service.h
index bdec5cce09caf2efa4fcd708f047f2239ab64035..ac8024cc07585cceabba17951556c8965ce27e3a 100644
--- a/chrome/browser/usb/usb_service.h
+++ b/chrome/browser/usb/usb_service.h
@@ -20,9 +20,11 @@ template <class T> class DeleteHelper;
} // namespace base
+struct InitUsbContextTraits;
template <typename T> struct DefaultSingletonTraits;
typedef struct libusb_device* PlatformUsbDevice;
+typedef struct libusb_context* PlatformUsbContext;
class UsbContext;
class UsbDevice;
@@ -37,6 +39,7 @@ class UsbService {
ScopedDeviceVector;
// Must be called on FILE thread.
+ // Returns NULL when failed to initialized.
static UsbService* GetInstance();
scoped_refptr<UsbDevice> GetDeviceById(uint32 unique_id);
@@ -47,10 +50,11 @@ class UsbService {
void GetDevices(std::vector<scoped_refptr<UsbDevice> >* devices);
private:
+ friend struct InitUsbContextTraits;
friend struct DefaultSingletonTraits<UsbService>;
friend class base::DeleteHelper<UsbService>;
- UsbService();
+ explicit UsbService(PlatformUsbContext context);
virtual ~UsbService();
// Return true if |device|'s vendor and product identifiers match |vendor_id|

Powered by Google App Engine
This is Rietveld 408576698