| 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/threading/simple_thread.h" | 9 #include "base/threading/simple_thread.h" |
| 10 #include "device/usb/usb_error.h" | 10 #include "device/usb/usb_error.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 libusb_interrupt_handle_event(context_); | 60 libusb_interrupt_handle_event(context_); |
| 61 } | 61 } |
| 62 | 62 |
| 63 UsbContext::UsbContext(PlatformUsbContext context) : context_(context) { | 63 UsbContext::UsbContext(PlatformUsbContext context) : context_(context) { |
| 64 // Ownership of the PlatformUsbContext is passed to the event handler thread. | 64 // Ownership of the PlatformUsbContext is passed to the event handler thread. |
| 65 event_handler_.reset(new UsbEventHandler(context_)); | 65 event_handler_.reset(new UsbEventHandler(context_)); |
| 66 event_handler_->Start(); | 66 event_handler_->Start(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 UsbContext::~UsbContext() { | 69 UsbContext::~UsbContext() { |
| 70 DCHECK(thread_checker_.CalledOnValidThread()); | |
| 71 event_handler_->Stop(); | 70 event_handler_->Stop(); |
| 72 event_handler_->Join(); | 71 event_handler_->Join(); |
| 73 } | 72 } |
| 74 | 73 |
| 75 } // namespace device | 74 } // namespace device |
| OLD | NEW |