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

Side by Side Diff: chrome/browser/usb/usb_service.cc

Issue 10332075: Adding use_system_libusb option for third_party/libusb (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing license check. Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/usb/usb_service.h" 5 #include "chrome/browser/usb/usb_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "chrome/browser/usb/usb_device.h" 10 #include "chrome/browser/usb/usb_device.h"
11 #include "third_party/libusb/libusb/libusb.h" 11 #include "third_party/libusb/libusb.h"
12 12
13 UsbService::UsbService() : running_(true), thread_("UsbThread") { 13 UsbService::UsbService() : running_(true), thread_("UsbThread") {
14 libusb_init(&context_); 14 libusb_init(&context_);
15 thread_.Start(); 15 thread_.Start();
16 PostHandleEventTask(); 16 PostHandleEventTask();
17 } 17 }
18 18
19 UsbService::~UsbService() {} 19 UsbService::~UsbService() {}
20 20
21 // TODO(gdk): There is currently no clean way to indicate to the event handler 21 // TODO(gdk): There is currently no clean way to indicate to the event handler
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 68 }
69 } 69 }
70 } 70 }
71 71
72 void UsbService::PostHandleEventTask() { 72 void UsbService::PostHandleEventTask() {
73 thread_.message_loop()->PostTask(FROM_HERE, base::Bind( 73 thread_.message_loop()->PostTask(FROM_HERE, base::Bind(
74 &UsbService::HandleEvent, base::Unretained(this))); 74 &UsbService::HandleEvent, base::Unretained(this)));
75 } 75 }
76 76
77 void UsbService::HandleEvent() { 77 void UsbService::HandleEvent() {
78 libusb_handle_events_completed(context_, NULL); 78 // TODO(gdk): Once there is a reasonable expectation that platforms will use
Paweł Hajdan Jr. 2012/05/10 06:36:15 Note: there is. Gentoo Linux doesn't even have any
Garret Kelly 2012/05/10 17:44:01 I'll leave the older call for compatibility's sake
79 // libusb >= 1.0.9 this should be changed to handle_events_completed, as the
80 // use of handle_events is deprecated.
81 libusb_handle_events(context_);
79 if (running_) { 82 if (running_) {
80 PostHandleEventTask(); 83 PostHandleEventTask();
81 } 84 }
82 } 85 }
83 86
84 void UsbService::PlatformShutdown() { 87 void UsbService::PlatformShutdown() {
85 libusb_exit(context_); 88 libusb_exit(context_);
86 } 89 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698