diff options
author | dcheng <dcheng@chromium.org> | 2014-10-29 14:27:50 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-29 21:28:20 +0000 |
commit | 30a1b15432dd20cf910f96ec35e27a94f769640e (patch) | |
tree | c9f5ffdb5c802fe2a26a22d499b700b49fe8f509 /components/storage_monitor | |
parent | 6913b7737d6124633109d6e3da31689d7ffef838 (diff) | |
download | chromium_src-30a1b15432dd20cf910f96ec35e27a94f769640e.zip chromium_src-30a1b15432dd20cf910f96ec35e27a94f769640e.tar.gz chromium_src-30a1b15432dd20cf910f96ec35e27a94f769640e.tar.bz2 |
Standardize usage of virtual/override/final specifiers.
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
R=caitkp@chromium.org
Review URL: https://codereview.chromium.org/684513002
Cr-Commit-Position: refs/heads/master@{#301931}
Diffstat (limited to 'components/storage_monitor')
7 files changed, 46 insertions, 46 deletions
diff --git a/components/storage_monitor/media_storage_util_unittest.cc b/components/storage_monitor/media_storage_util_unittest.cc index de13437..5dab94c 100644 --- a/components/storage_monitor/media_storage_util_unittest.cc +++ b/components/storage_monitor/media_storage_util_unittest.cc @@ -31,7 +31,7 @@ class MediaStorageUtilTest : public testing::Test { public: MediaStorageUtilTest() : thread_bundle_(content::TestBrowserThreadBundle::REAL_FILE_THREAD) {} - virtual ~MediaStorageUtilTest() {} + ~MediaStorageUtilTest() override {} // Verify mounted device type. void CheckDCIMDeviceType(const base::FilePath& mount_point) { @@ -60,12 +60,12 @@ class MediaStorageUtilTest : public testing::Test { return scoped_temp_dir_.path(); } - virtual void SetUp() override { + void SetUp() override { monitor_ = TestStorageMonitor::CreateAndInstall(); ASSERT_TRUE(scoped_temp_dir_.CreateUniqueTempDir()); } - virtual void TearDown() override { + void TearDown() override { WaitForFileThread(); TestStorageMonitor::Destroy(); } diff --git a/components/storage_monitor/media_transfer_protocol_device_observer_linux.h b/components/storage_monitor/media_transfer_protocol_device_observer_linux.h index 3b9d122..50467ad 100644 --- a/components/storage_monitor/media_transfer_protocol_device_observer_linux.h +++ b/components/storage_monitor/media_transfer_protocol_device_observer_linux.h @@ -37,7 +37,7 @@ class MediaTransferProtocolDeviceObserverLinux MediaTransferProtocolDeviceObserverLinux( StorageMonitor::Receiver* receiver, device::MediaTransferProtocolManager* mtp_manager); - virtual ~MediaTransferProtocolDeviceObserverLinux(); + ~MediaTransferProtocolDeviceObserverLinux() override; // Finds the storage that contains |path| and populates |storage_info|. // Returns false if unable to find the storage. @@ -56,8 +56,8 @@ class MediaTransferProtocolDeviceObserverLinux // device::MediaTransferProtocolManager::Observer implementation. // Exposed for unit tests. - virtual void StorageChanged(bool is_attached, - const std::string& storage_name) override; + void StorageChanged(bool is_attached, + const std::string& storage_name) override; private: // Mapping of storage location and mtp storage info object. diff --git a/components/storage_monitor/media_transfer_protocol_device_observer_linux_unittest.cc b/components/storage_monitor/media_transfer_protocol_device_observer_linux_unittest.cc index f39ccdf..10f6e9a 100644 --- a/components/storage_monitor/media_transfer_protocol_device_observer_linux_unittest.cc +++ b/components/storage_monitor/media_transfer_protocol_device_observer_linux_unittest.cc @@ -96,10 +96,10 @@ class MediaTransferProtocolDeviceObserverLinuxTest : public testing::Test { MediaTransferProtocolDeviceObserverLinuxTest() : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) {} - virtual ~MediaTransferProtocolDeviceObserverLinuxTest() {} + ~MediaTransferProtocolDeviceObserverLinuxTest() override {} protected: - virtual void SetUp() override { + void SetUp() override { mock_storage_observer_.reset(new MockRemovableStorageObserver); TestStorageMonitor* monitor = TestStorageMonitor::CreateAndInstall(); mtp_device_observer_.reset( @@ -108,7 +108,7 @@ class MediaTransferProtocolDeviceObserverLinuxTest : public testing::Test { monitor->AddObserver(mock_storage_observer_.get()); } - virtual void TearDown() override { + void TearDown() override { StorageMonitor* monitor = StorageMonitor::GetInstance(); monitor->RemoveObserver(mock_storage_observer_.get()); mtp_device_observer_.reset(); diff --git a/components/storage_monitor/storage_monitor_linux.h b/components/storage_monitor/storage_monitor_linux.h index ce44369..c8ff79a 100644 --- a/components/storage_monitor/storage_monitor_linux.h +++ b/components/storage_monitor/storage_monitor_linux.h @@ -39,10 +39,10 @@ class StorageMonitorLinux : public StorageMonitor, // Use StorageMonitor::GetInstance() instead. // |mtab_file_path| is the path to a mtab file to watch for mount points. explicit StorageMonitorLinux(const base::FilePath& mtab_file_path); - virtual ~StorageMonitorLinux(); + ~StorageMonitorLinux() override; // Must be called for StorageMonitorLinux to work. - virtual void Init() override; + void Init() override; protected: // Gets device information given a |device_path| and |mount_point|. @@ -57,7 +57,7 @@ class StorageMonitorLinux : public StorageMonitor, device::MediaTransferProtocolManager* test_manager); // MtabWatcherLinux::Delegate implementation. - virtual void UpdateMtab( + void UpdateMtab( const MtabWatcherLinux::MountPointDeviceMap& new_mtab) override; private: @@ -90,12 +90,12 @@ class StorageMonitorLinux : public StorageMonitor, typedef std::map<base::FilePath, ReferencedMountPoint> MountPriorityMap; // StorageMonitor implementation. - virtual bool GetStorageInfoForPath(const base::FilePath& path, - StorageInfo* device_info) const override; - virtual void EjectDevice(const std::string& device_id, - base::Callback<void(EjectStatus)> callback) override; - virtual device::MediaTransferProtocolManager* - media_transfer_protocol_manager() override; + bool GetStorageInfoForPath(const base::FilePath& path, + StorageInfo* device_info) const override; + void EjectDevice(const std::string& device_id, + base::Callback<void(EjectStatus)> callback) override; + device::MediaTransferProtocolManager* media_transfer_protocol_manager() + override; // Called when the MtabWatcher has been created. void OnMtabWatcherCreated(MtabWatcherLinux* watcher); diff --git a/components/storage_monitor/storage_monitor_linux_unittest.cc b/components/storage_monitor/storage_monitor_linux_unittest.cc index 96e23f6..3e77145 100644 --- a/components/storage_monitor/storage_monitor_linux_unittest.cc +++ b/components/storage_monitor/storage_monitor_linux_unittest.cc @@ -126,10 +126,10 @@ class TestStorageMonitorLinux : public StorageMonitorLinux { new TestMediaTransferProtocolManagerLinux()); SetGetDeviceInfoCallbackForTest(base::Bind(&GetDeviceInfo)); } - virtual ~TestStorageMonitorLinux() {} + ~TestStorageMonitorLinux() override {} private: - virtual void UpdateMtab( + void UpdateMtab( const MtabWatcherLinux::MountPointDeviceMap& new_mtab) override { StorageMonitorLinux::UpdateMtab(new_mtab); base::MessageLoopProxy::current()->PostTask( @@ -157,10 +157,10 @@ class StorageMonitorLinuxTest : public testing::Test { StorageMonitorLinuxTest() : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) {} - virtual ~StorageMonitorLinuxTest() {} + ~StorageMonitorLinuxTest() override {} protected: - virtual void SetUp() override { + void SetUp() override { // Create and set up a temp dir with files for the test. ASSERT_TRUE(scoped_temp_dir_.CreateUniqueTempDir()); base::FilePath test_dir = scoped_temp_dir_.path().AppendASCII("test_etc"); @@ -182,7 +182,7 @@ class StorageMonitorLinuxTest : public testing::Test { base::RunLoop().RunUntilIdle(); } - virtual void TearDown() override { + void TearDown() override { base::RunLoop().RunUntilIdle(); monitor_->RemoveObserver(mock_storage_observer_.get()); base::RunLoop().RunUntilIdle(); diff --git a/components/storage_monitor/test_media_transfer_protocol_manager_linux.h b/components/storage_monitor/test_media_transfer_protocol_manager_linux.h index 64bd18d..195c891 100644 --- a/components/storage_monitor/test_media_transfer_protocol_manager_linux.h +++ b/components/storage_monitor/test_media_transfer_protocol_manager_linux.h @@ -14,31 +14,31 @@ class TestMediaTransferProtocolManagerLinux : public device::MediaTransferProtocolManager { public: TestMediaTransferProtocolManagerLinux(); - virtual ~TestMediaTransferProtocolManagerLinux(); + ~TestMediaTransferProtocolManagerLinux() override; private: // device::MediaTransferProtocolManager implementation. - virtual void AddObserver(Observer* observer) override; - virtual void RemoveObserver(Observer* observer) override; - virtual const std::vector<std::string> GetStorages() const override; - virtual const MtpStorageInfo* GetStorageInfo( + void AddObserver(Observer* observer) override; + void RemoveObserver(Observer* observer) override; + const std::vector<std::string> GetStorages() const override; + const MtpStorageInfo* GetStorageInfo( const std::string& storage_name) const override; - virtual void OpenStorage(const std::string& storage_name, - const std::string& mode, - const OpenStorageCallback& callback) override; - virtual void CloseStorage(const std::string& storage_handle, - const CloseStorageCallback& callback) override; - virtual void ReadDirectory(const std::string& storage_handle, - uint32 file_id, - const ReadDirectoryCallback& callback) override; - virtual void ReadFileChunk(const std::string& storage_handle, - uint32 file_id, - uint32 offset, - uint32 count, - const ReadFileCallback& callback) override; - virtual void GetFileInfo(const std::string& storage_handle, - uint32 file_id, - const GetFileInfoCallback& callback) override; + void OpenStorage(const std::string& storage_name, + const std::string& mode, + const OpenStorageCallback& callback) override; + void CloseStorage(const std::string& storage_handle, + const CloseStorageCallback& callback) override; + void ReadDirectory(const std::string& storage_handle, + uint32 file_id, + const ReadDirectoryCallback& callback) override; + void ReadFileChunk(const std::string& storage_handle, + uint32 file_id, + uint32 offset, + uint32 count, + const ReadFileCallback& callback) override; + void GetFileInfo(const std::string& storage_handle, + uint32 file_id, + const GetFileInfoCallback& callback) override; DISALLOW_COPY_AND_ASSIGN(TestMediaTransferProtocolManagerLinux); }; diff --git a/components/storage_monitor/test_storage_monitor.h b/components/storage_monitor/test_storage_monitor.h index a42949f..7eff7fb 100644 --- a/components/storage_monitor/test_storage_monitor.h +++ b/components/storage_monitor/test_storage_monitor.h @@ -45,8 +45,8 @@ class TestStorageMonitor : public StorageMonitor { #endif #if defined(OS_LINUX) - virtual device::MediaTransferProtocolManager* - media_transfer_protocol_manager() override; + device::MediaTransferProtocolManager* media_transfer_protocol_manager() + override; #endif Receiver* receiver() const override; |