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

Side by Side Diff: device/usb/usb_device_handle_impl.cc

Issue 791743006: Fix WeakPtrFactory member ordering in device (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « device/usb/usb_device_handle_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_device_handle_impl.h" 5 #include "device/usb/usb_device_handle_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 } 472 }
473 473
474 UsbDeviceHandleImpl::UsbDeviceHandleImpl(scoped_refptr<UsbContext> context, 474 UsbDeviceHandleImpl::UsbDeviceHandleImpl(scoped_refptr<UsbContext> context,
475 UsbDeviceImpl* device, 475 UsbDeviceImpl* device,
476 PlatformUsbDeviceHandle handle, 476 PlatformUsbDeviceHandle handle,
477 const UsbConfigDescriptor& config) 477 const UsbConfigDescriptor& config)
478 : device_(device), 478 : device_(device),
479 handle_(handle), 479 handle_(handle),
480 config_(config), 480 config_(config),
481 context_(context), 481 context_(context),
482 weak_factory_(this), 482 task_runner_(base::ThreadTaskRunnerHandle::Get()),
483 task_runner_(base::ThreadTaskRunnerHandle::Get()) { 483 weak_factory_(this) {
484 DCHECK(handle) << "Cannot create device with NULL handle."; 484 DCHECK(handle) << "Cannot create device with NULL handle.";
485 } 485 }
486 486
487 UsbDeviceHandleImpl::~UsbDeviceHandleImpl() { 487 UsbDeviceHandleImpl::~UsbDeviceHandleImpl() {
488 DCHECK(thread_checker_.CalledOnValidThread()); 488 DCHECK(thread_checker_.CalledOnValidThread());
489 489
490 libusb_close(handle_); 490 libusb_close(handle_);
491 handle_ = NULL; 491 handle_ = NULL;
492 } 492 }
493 493
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 // Attempt-release all the interfaces. 833 // Attempt-release all the interfaces.
834 // It will be retained until the transfer cancellation is finished. 834 // It will be retained until the transfer cancellation is finished.
835 claimed_interfaces_.clear(); 835 claimed_interfaces_.clear();
836 836
837 // Cannot close device handle here. Need to wait for libusb_cancel_transfer to 837 // Cannot close device handle here. Need to wait for libusb_cancel_transfer to
838 // finish. 838 // finish.
839 device_ = NULL; 839 device_ = NULL;
840 } 840 }
841 841
842 } // namespace device 842 } // namespace device
OLDNEW
« no previous file with comments | « device/usb/usb_device_handle_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698