summaryrefslogtreecommitdiffstats
path: root/device/usb/usb_descriptors.h
diff options
context:
space:
mode:
authorweitaosu <weitaosu@chromium.org>2014-09-12 12:47:54 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-12 19:51:38 +0000
commitf49954838f51461f18be37c68ff85ddbbd042a47 (patch)
tree3509c317e54fa44bb23c93b7dc1084367378aea0 /device/usb/usb_descriptors.h
parent4c1e40ba4cf297649a2b919644618c664d4812ce (diff)
downloadchromium_src-f49954838f51461f18be37c68ff85ddbbd042a47.zip
chromium_src-f49954838f51461f18be37c68ff85ddbbd042a47.tar.gz
chromium_src-f49954838f51461f18be37c68ff85ddbbd042a47.tar.bz2
Revert of Convert device::UsbConfigDescriptor and friends to structs. (patchset #2 id:60001 of https://codereview.chromium.org/562763002/)
Reason for revert: This broken the Linux ASan LSan Tests: http://build.chromium.org/p/chromium.memory/builders/Linux%20ASan%20LSan%20Tests%20%283%29/builds/7506 http://build.chromium.org/p/chromium.memory/builders/Linux%20ASan%20LSan%20Tests%20%281%29/builds/5717 Sample callstacks: Direct leak of 400 byte(s) in 10 object(s) allocated from: #0 0x55c6eb in __interceptor_malloc (/b/build/slave/Linux_ASan_LSan_Tests__3_/build/src/out/Release/browser_tests+0x55c6eb) #1 0xab24bb8 in raw_desc_to_config third_party/libusb/src/libusb/descriptor.c:501:45 #2 0xab24ab9 in libusb_get_active_config_descriptor third_party/libusb/src/libusb/descriptor.c:601:7 #3 0xab14aae in device::UsbDeviceImpl::GetConfiguration() device/usb/usb_device_impl.cc:199:9 #4 0xb37d57b in EnumerateOnFileThread(crypto::RSAPrivateKey*, base::Callback\u003Cvoid (std::__1::vector\u003Cscoped_refptr\u003CAndroidUsbDevice>, std::__1::allocator\u003Cscoped_refptr\u003CAndroidUsbDevice> > > const&)> const&, scoped_refptr\u003Cbase::MessageLoopProxy>) chrome/browser/devtools/device/usb/android_usb_device.cc:262:42 #5 0xb38aebf in Run base/bind_internal.h:288:12 #6 0xb38aebf in base::internal::InvokeHelper\u003Cfalse, void, base::internal::RunnableAdapter\u003Cvoid (*)(crypto::RSAPrivateKey*, base::Callback\u003Cvoid (std::__1::vector\u003Cscoped_refptr\u003CAndroidUsbDevice>, std::__1::allocator\u003Cscoped_refptr\u003CAndroidUsbDevice> > > const&)> const&, scoped_refptr\u003Cbase::MessageLoopProxy>)>, void (crypto::RSAPrivateKey* const&, base::Callback\u003Cvoid (std::__1::vector\u003Cscoped_refptr\u003CAndroidUsbDevice>, std::__1::allocator\u003Cscoped_refptr\u003CAndroidUsbDevice> > > const&)> const&, base::MessageLoopProxy*)>::MakeItSo(base::internal::RunnableAdapter\u003Cvoid (*)(crypto::RSAPrivateKey*, base::Callback\u003Cvoid (std::__1::vector\u003Cscoped_refptr\u003CAndroidUsbDevice>, std::__1::allocator\u003Cscoped_refptr\u003CAndroidUsbDevice> > > const&)> const&, scoped_refptr\u003Cbase::MessageLoopProxy>)>, crypto::RSAPrivateKey* const&, base::Callback\u003Cvoid (std::__1::vector\u003Cscoped_refptr\u003CAndroidUsbDevice>, std::__1::allocator\u003Cscoped_refptr\u003CAndroidUsbDevice> > > const&)> const&, base::MessageLoopProxy*) base/bind_internal.h:927 #7 0x2d58bff in Run base/callback.h:401:12 #8 0x2d58bff in base::debug::TaskAnnotator::RunTask(char const*, char const*, base::PendingTask const&) base/debug/task_annotator.cc:62 #9 0x2ca519c in base::MessageLoop::RunTask(base::PendingTask const&) base/message_loop/message_loop.cc:446:3 #10 0x2ca629e in DeferOrRunPendingTask base/message_loop/message_loop.cc:456:5 #11 0x2ca629e in base::MessageLoop::DoWork() base/message_loop/message_loop.cc:565 #12 0x2c23ddf in base::MessagePumpLibevent::Run(base::MessagePump::Delegate*) base/message_loop/message_pump_libevent.cc:232:21 #13 0x2cd57b4 in base::RunLoop::Run() base/run_loop.cc:49:3 #14 0x2ca39c4 in base::MessageLoop::Run() base/message_loop/message_loop.cc:308:3 #15 0x50fd018 in content::BrowserThreadImpl::FileThreadRun(base::MessageLoop*) content/browser/browser_thread_impl.cc:190:3 #16 0x50fdca7 in content::BrowserThreadImpl::Run(base::MessageLoop*) content/browser/browser_thread_impl.cc:244:14 #17 0x2d1ebc8 in base::Thread::ThreadMain() base/threading/thread.cc:228:5 #18 0x2d12b20 in base::(anonymous namespace)::ThreadFunc(void*) base/threading/platform_thread_posix.cc:80:3 #19 0x7f4d560a3e99 in start_thread /build/buildd/eglibc-2.15/nptl/pthread_create.c:308 Direct leak of 400 byte(s) in 10 object(s) allocated from: #0 0x55c6eb in __interceptor_malloc (/b/build/slave/Linux_ASan_LSan_Tests__1_/build/src/out/Release/browser_tests+0x55c6eb) #1 0xab24bb8 in raw_desc_to_config third_party/libusb/src/libusb/descriptor.c:501:45 #2 0xab24ab9 in libusb_get_active_config_descriptor third_party/libusb/src/libusb/descriptor.c:601:7 #3 0xab14aae in device::UsbDeviceImpl::GetConfiguration() device/usb/usb_device_impl.cc:199:9 #4 0xb37d57b in EnumerateOnFileThread(crypto::RSAPrivateKey*, base::Callback\u003Cvoid (std::__1::vector\u003Cscoped_refptr\u003CAndroidUsbDevice>, std::__1::allocator\u003Cscoped_refptr\u003CAndroidUsbDevice> > > const&)> const&, scoped_refptr\u003Cbase::MessageLoopProxy>) chrome/browser/devtools/device/usb/android_usb_device.cc:262:42 #5 0xb38aebf in Run base/bind_internal.h:288:12 #6 0xb38aebf in base::internal::InvokeHelper\u003Cfalse, void, base::internal::RunnableAdapter\u003Cvoid (*)(crypto::RSAPrivateKey*, base::Callback\u003Cvoid (std::__1::vector\u003Cscoped_refptr\u003CAndroidUsbDevice>, std::__1::allocator\u003Cscoped_refptr\u003CAndroidUsbDevice> > > const&)> const&, scoped_refptr\u003Cbase::MessageLoopProxy>)>, void (crypto::RSAPrivateKey* const&, base::Callback\u003Cvoid (std::__1::vector\u003Cscoped_refptr\u003CAndroidUsbDevice>, std::__1::allocator\u003Cscoped_refptr\u003CAndroidUsbDevice> > > const&)> const&, base::MessageLoopProxy*)>::MakeItSo(base::internal::RunnableAdapter\u003Cvoid (*)(crypto::RSAPrivateKey*, base::Callback\u003Cvoid (std::__1::vector\u003Cscoped_refptr\u003CAndroidUsbDevice>, std::__1::allocator\u003Cscoped_refptr\u003CAndroidUsbDevice> > > const&)> const&, scoped_refptr\u003Cbase::MessageLoopProxy>)>, crypto::RSAPrivateKey* const&, base::Callback\u003Cvoid (std::__1::vector\u003Cscoped_refptr\u003CAndroidUsbDevice>, std::__1::allocator\u003Cscoped_refptr\u003CAndroidUsbDevice> > > const&)> const&, base::MessageLoopProxy*) base/bind_internal.h:927 #7 0x2d58bff in Run base/callback.h:401:12 #8 0x2d58bff in base::debug::TaskAnnotator::RunTask(char const*, char const*, base::PendingTask const&) base/debug/task_annotator.cc:62 #9 0x2ca519c in base::MessageLoop::RunTask(base::PendingTask const&) base/message_loop/message_loop.cc:446:3 #10 0x2ca629e in DeferOrRunPendingTask base/message_loop/message_loop.cc:456:5 #11 0x2ca629e in base::MessageLoop::DoWork() base/message_loop/message_loop.cc:565 #12 0x2c23ddf in base::MessagePumpLibevent::Run(base::MessagePump::Delegate*) base/message_loop/message_pump_libevent.cc:232:21 #13 0x2cd57b4 in base::RunLoop::Run() base/run_loop.cc:49:3 #14 0x2ca39c4 in base::MessageLoop::Run() base/message_loop/message_loop.cc:308:3 #15 0x50fd018 in content::BrowserThreadImpl::FileThreadRun(base::MessageLoop*) content/browser/browser_thread_impl.cc:190:3 #16 0x50fdca7 in content::BrowserThreadImpl::Run(base::MessageLoop*) content/browser/browser_thread_impl.cc:244:14 #17 0x2d1ebc8 in base::Thread::ThreadMain() base/threading/thread.cc:228:5 #18 0x2d12b20 in base::(anonymous namespace)::ThreadFunc(void*) base/threading/platform_thread_posix.cc:80:3 #19 0x7f4aef980e99 in start_thread /build/buildd/eglibc-2.15/nptl/pthread_create.c:308 Original issue's description: > Convert device::UsbConfigDescriptor and friends to structs. > > These classes do not need to be classes and expecially don't need to be > abstract classes as this leads to a complicated implementation and > complicated tests. All USB devices no matter the platform will have the > same descriptor data. > > This change follows the model of device::HidDeviceInfo. > > BUG= > > Committed: https://crrev.com/be9e363a3af57bd313fbb96ec3b5fa02cef769b5 > Cr-Commit-Position: refs/heads/master@{#294594} TBR=dgozman@chromium.org,rockot@chromium.org,rpaquay@chromium.org,pfeldman@chromium.org,reillyg@chromium.org NOTREECHECKS=true NOTRY=true BUG= Review URL: https://codereview.chromium.org/567003002 Cr-Commit-Position: refs/heads/master@{#294640}
Diffstat (limited to 'device/usb/usb_descriptors.h')
-rw-r--r--device/usb/usb_descriptors.h83
1 files changed, 0 insertions, 83 deletions
diff --git a/device/usb/usb_descriptors.h b/device/usb/usb_descriptors.h
deleted file mode 100644
index 2881aba..0000000
--- a/device/usb/usb_descriptors.h
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef DEVICE_USB_USB_DESCRIPTORS_H_
-#define DEVICE_USB_USB_DESCRIPTORS_H_
-
-#include <stdint.h>
-#include <vector>
-
-namespace device {
-
-enum UsbTransferType {
- USB_TRANSFER_CONTROL = 0,
- USB_TRANSFER_ISOCHRONOUS,
- USB_TRANSFER_BULK,
- USB_TRANSFER_INTERRUPT,
-};
-
-enum UsbEndpointDirection {
- USB_DIRECTION_INBOUND = 0,
- USB_DIRECTION_OUTBOUND,
-};
-
-enum UsbSynchronizationType {
- USB_SYNCHRONIZATION_NONE = 0,
- USB_SYNCHRONIZATION_ASYNCHRONOUS,
- USB_SYNCHRONIZATION_ADAPTIVE,
- USB_SYNCHRONIZATION_SYNCHRONOUS,
-};
-
-enum UsbUsageType {
- USB_USAGE_DATA = 0,
- USB_USAGE_FEEDBACK,
- USB_USAGE_EXPLICIT_FEEDBACK
-};
-
-struct UsbEndpointDescriptor {
- UsbEndpointDescriptor();
- ~UsbEndpointDescriptor();
-
- typedef std::vector<UsbEndpointDescriptor>::const_iterator Iterator;
-
- uint8_t address;
- UsbEndpointDirection direction;
- uint16_t maximum_packet_size;
- UsbSynchronizationType synchronization_type;
- UsbTransferType transfer_type;
- UsbUsageType usage_type;
- uint16_t polling_interval;
- std::vector<uint8_t> extra_data;
-};
-
-struct UsbInterfaceDescriptor {
- UsbInterfaceDescriptor();
- ~UsbInterfaceDescriptor();
-
- typedef std::vector<UsbInterfaceDescriptor>::const_iterator Iterator;
-
- uint8_t interface_number;
- uint8_t alternate_setting;
- uint8_t interface_class;
- uint8_t interface_subclass;
- uint8_t interface_protocol;
- std::vector<UsbEndpointDescriptor> endpoints;
- std::vector<uint8_t> extra_data;
-};
-
-struct UsbConfigDescriptor {
- UsbConfigDescriptor();
- ~UsbConfigDescriptor();
-
- uint8_t configuration_value;
- bool self_powered;
- bool remote_wakeup;
- uint16_t maximum_power;
- std::vector<UsbInterfaceDescriptor> interfaces;
- std::vector<uint8_t> extra_data;
-};
-
-} // namespace device
-
-#endif // DEVICE_USB_USB_DESCRIPTORS_H_