OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "device/usb/usb_context.h" | 5 #include "device/usb/usb_context.h" |
6 | 6 |
7 #include "base/atomicops.h" | 7 #include "base/atomicops.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/macros.h" |
9 #include "base/threading/simple_thread.h" | 10 #include "base/threading/simple_thread.h" |
10 #include "device/usb/usb_error.h" | 11 #include "device/usb/usb_error.h" |
11 #include "third_party/libusb/src/libusb/interrupt.h" | 12 #include "third_party/libusb/src/libusb/interrupt.h" |
12 #include "third_party/libusb/src/libusb/libusb.h" | 13 #include "third_party/libusb/src/libusb/libusb.h" |
13 | 14 |
14 namespace device { | 15 namespace device { |
15 | 16 |
16 // The UsbEventHandler works around a design flaw in the libusb interface. There | 17 // The UsbEventHandler works around a design flaw in the libusb interface. There |
17 // is currently no way to signal to libusb that any caller into one of the event | 18 // is currently no way to signal to libusb that any caller into one of the event |
18 // handler calls should return without handling any events. | 19 // handler calls should return without handling any events. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 event_handler_.reset(new UsbEventHandler(context_)); | 66 event_handler_.reset(new UsbEventHandler(context_)); |
66 event_handler_->Start(); | 67 event_handler_->Start(); |
67 } | 68 } |
68 | 69 |
69 UsbContext::~UsbContext() { | 70 UsbContext::~UsbContext() { |
70 event_handler_->Stop(); | 71 event_handler_->Stop(); |
71 event_handler_->Join(); | 72 event_handler_->Join(); |
72 } | 73 } |
73 | 74 |
74 } // namespace device | 75 } // namespace device |
OLD | NEW |