diff options
author | dcheng <dcheng@chromium.org> | 2014-10-22 16:07:52 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-22 23:08:15 +0000 |
commit | b5aaf402eb4783b9f62de3ae8485edec343866cc (patch) | |
tree | e9f30bd26479007ce31da6833f81743109eba9b4 /device/usb | |
parent | 9cee6105930e94ad2abf2c004efb1d65c0759a0f (diff) | |
download | chromium_src-b5aaf402eb4783b9f62de3ae8485edec343866cc.zip chromium_src-b5aaf402eb4783b9f62de3ae8485edec343866cc.tar.gz chromium_src-b5aaf402eb4783b9f62de3ae8485edec343866cc.tar.bz2 |
Standardize usage of virtual/override/final in device/
The Google C++ style guide states:
Explicitly annotate overrides of virtual functions or virtual
destructors with an override or (less frequently) final specifier.
Older (pre-C++11) code will use the virtual keyword as an inferior
alternative annotation. For clarity, use exactly one of override,
final, or virtual when declaring an override.
To better conform to these guidelines, the following constructs have
been rewritten:
- if a base class has a virtual destructor, then:
virtual ~Foo(); -> ~Foo() override;
- virtual void Foo() override; -> void Foo() override;
- virtual void Foo() override final; -> void Foo() final;
This patch was automatically generated. The clang plugin can generate
fixit hints, which are suggested edits when it is 100% sure it knows how
to fix a problem. The hints from the clang plugin were applied to the
source tree using the tool in https://codereview.chromium.org/598073004.
BUG=417463
TBR=keybuk@chromium.org
Review URL: https://codereview.chromium.org/663203007
Cr-Commit-Position: refs/heads/master@{#300790}
Diffstat (limited to 'device/usb')
-rw-r--r-- | device/usb/usb_context.cc | 4 | ||||
-rw-r--r-- | device/usb/usb_context_unittest.cc | 2 | ||||
-rw-r--r-- | device/usb/usb_device_handle_impl.h | 88 | ||||
-rw-r--r-- | device/usb/usb_device_impl.h | 14 | ||||
-rw-r--r-- | device/usb/usb_service_impl.cc | 9 |
5 files changed, 57 insertions, 60 deletions
diff --git a/device/usb/usb_context.cc b/device/usb/usb_context.cc index dac86fe..cb8214f 100644 --- a/device/usb/usb_context.cc +++ b/device/usb/usb_context.cc @@ -20,10 +20,10 @@ namespace device { class UsbContext::UsbEventHandler : public base::PlatformThread::Delegate { public: explicit UsbEventHandler(libusb_context* context); - virtual ~UsbEventHandler(); + ~UsbEventHandler() override; // base::PlatformThread::Delegate - virtual void ThreadMain() override; + void ThreadMain() override; private: base::subtle::Atomic32 running_; diff --git a/device/usb/usb_context_unittest.cc b/device/usb/usb_context_unittest.cc index e00062c..e3fb017 100644 --- a/device/usb/usb_context_unittest.cc +++ b/device/usb/usb_context_unittest.cc @@ -20,7 +20,7 @@ class UsbContextTest : public testing::Test { : UsbContext(context) {} private: - virtual ~UsbContextForTest() {} + ~UsbContextForTest() override {} DISALLOW_COPY_AND_ASSIGN(UsbContextForTest); }; }; diff --git a/device/usb/usb_device_handle_impl.h b/device/usb/usb_device_handle_impl.h index b92f779..4488ec9 100644 --- a/device/usb/usb_device_handle_impl.h +++ b/device/usb/usb_device_handle_impl.h @@ -33,50 +33,48 @@ typedef libusb_transfer* PlatformUsbTransferHandle; // UsbDeviceHandle class provides basic I/O related functionalities. class UsbDeviceHandleImpl : public UsbDeviceHandle { public: - virtual scoped_refptr<UsbDevice> GetDevice() const override; - virtual void Close() override; - virtual bool ClaimInterface(int interface_number) override; - virtual bool ReleaseInterface(int interface_number) override; - virtual bool SetInterfaceAlternateSetting(int interface_number, - int alternate_setting) override; - virtual bool ResetDevice() override; - virtual bool GetStringDescriptor(uint8 string_id, - base::string16* string) override; - - virtual void ControlTransfer(UsbEndpointDirection direction, - TransferRequestType request_type, - TransferRecipient recipient, - uint8 request, - uint16 value, - uint16 index, - net::IOBuffer* buffer, - size_t length, - unsigned int timeout, - const UsbTransferCallback& callback) override; - - virtual void BulkTransfer(UsbEndpointDirection direction, - uint8 endpoint, - net::IOBuffer* buffer, - size_t length, - unsigned int timeout, - const UsbTransferCallback& callback) override; - - virtual void InterruptTransfer(UsbEndpointDirection direction, - uint8 endpoint, - net::IOBuffer* buffer, - size_t length, - unsigned int timeout, - const UsbTransferCallback& callback) override; - - virtual void IsochronousTransfer( - UsbEndpointDirection direction, - uint8 endpoint, - net::IOBuffer* buffer, - size_t length, - unsigned int packets, - unsigned int packet_length, - unsigned int timeout, - const UsbTransferCallback& callback) override; + scoped_refptr<UsbDevice> GetDevice() const override; + void Close() override; + bool ClaimInterface(int interface_number) override; + bool ReleaseInterface(int interface_number) override; + bool SetInterfaceAlternateSetting(int interface_number, + int alternate_setting) override; + bool ResetDevice() override; + bool GetStringDescriptor(uint8 string_id, base::string16* string) override; + + void ControlTransfer(UsbEndpointDirection direction, + TransferRequestType request_type, + TransferRecipient recipient, + uint8 request, + uint16 value, + uint16 index, + net::IOBuffer* buffer, + size_t length, + unsigned int timeout, + const UsbTransferCallback& callback) override; + + void BulkTransfer(UsbEndpointDirection direction, + uint8 endpoint, + net::IOBuffer* buffer, + size_t length, + unsigned int timeout, + const UsbTransferCallback& callback) override; + + void InterruptTransfer(UsbEndpointDirection direction, + uint8 endpoint, + net::IOBuffer* buffer, + size_t length, + unsigned int timeout, + const UsbTransferCallback& callback) override; + + void IsochronousTransfer(UsbEndpointDirection direction, + uint8 endpoint, + net::IOBuffer* buffer, + size_t length, + unsigned int packets, + unsigned int packet_length, + unsigned int timeout, + const UsbTransferCallback& callback) override; PlatformUsbDeviceHandle handle() const { return handle_; } @@ -89,7 +87,7 @@ class UsbDeviceHandleImpl : public UsbDeviceHandle { PlatformUsbDeviceHandle handle, const UsbConfigDescriptor& config); - virtual ~UsbDeviceHandleImpl(); + ~UsbDeviceHandleImpl() override; private: class InterfaceClaimer; diff --git a/device/usb/usb_device_impl.h b/device/usb/usb_device_impl.h index 2718998..e962c6d 100644 --- a/device/usb/usb_device_impl.h +++ b/device/usb/usb_device_impl.h @@ -36,12 +36,12 @@ class UsbDeviceImpl : public UsbDevice { int interface_id, const base::Callback<void(bool success)>& callback) override; #endif // OS_CHROMEOS - virtual scoped_refptr<UsbDeviceHandle> Open() override; - virtual bool Close(scoped_refptr<UsbDeviceHandle> handle) override; - virtual const UsbConfigDescriptor& GetConfiguration() override; - virtual bool GetManufacturer(base::string16* manufacturer) override; - virtual bool GetProduct(base::string16* product) override; - virtual bool GetSerialNumber(base::string16* serial_number) override; + scoped_refptr<UsbDeviceHandle> Open() override; + bool Close(scoped_refptr<UsbDeviceHandle> handle) override; + const UsbConfigDescriptor& GetConfiguration() override; + bool GetManufacturer(base::string16* manufacturer) override; + bool GetProduct(base::string16* product) override; + bool GetSerialNumber(base::string16* serial_number) override; protected: friend class UsbServiceImpl; @@ -54,7 +54,7 @@ class UsbDeviceImpl : public UsbDevice { uint16 product_id, uint32 unique_id); - virtual ~UsbDeviceImpl(); + ~UsbDeviceImpl() override; // Called only by UsbService. void OnDisconnect(); diff --git a/device/usb/usb_service_impl.cc b/device/usb/usb_service_impl.cc index e639870..215aba1 100644 --- a/device/usb/usb_service_impl.cc +++ b/device/usb/usb_service_impl.cc @@ -34,16 +34,15 @@ class UsbServiceImpl : public UsbService, explicit UsbServiceImpl( PlatformUsbContext context, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); - virtual ~UsbServiceImpl(); + ~UsbServiceImpl() override; private: // device::UsbService implementation - virtual scoped_refptr<UsbDevice> GetDeviceById(uint32 unique_id) override; - virtual void GetDevices( - std::vector<scoped_refptr<UsbDevice> >* devices) override; + scoped_refptr<UsbDevice> GetDeviceById(uint32 unique_id) override; + void GetDevices(std::vector<scoped_refptr<UsbDevice>>* devices) override; // base::MessageLoop::DestructionObserver implementation. - virtual void WillDestroyCurrentMessageLoop() override; + void WillDestroyCurrentMessageLoop() override; // Enumerate USB devices from OS and update devices_ map. void RefreshDevices(); |