diff options
author | dcheng <dcheng@chromium.org> | 2014-12-29 10:30:17 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-29 18:31:06 +0000 |
commit | 3bb7119cdc809b01f9cf6f6c3b5dfd5c8a436dfb (patch) | |
tree | 21b2f10a5bb378adeda64f1462694d496bc41517 /dbus | |
parent | 4a1efdc8f8d4f63d803e4e541fbe44f8ddc67e46 (diff) | |
download | chromium_src-3bb7119cdc809b01f9cf6f6c3b5dfd5c8a436dfb.zip chromium_src-3bb7119cdc809b01f9cf6f6c3b5dfd5c8a436dfb.tar.gz chromium_src-3bb7119cdc809b01f9cf6f6c3b5dfd5c8a436dfb.tar.bz2 |
Standardize usage of virtual/override/final specifiers in dbus/.
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.
Several formatting edits by clang-format were manually reverted, due to
mangling of some of the more complicate IPC macros.
BUG=417463
Review URL: https://codereview.chromium.org/802213003
Cr-Commit-Position: refs/heads/master@{#309710}
Diffstat (limited to 'dbus')
-rw-r--r-- | dbus/bus.cc | 8 | ||||
-rw-r--r-- | dbus/dbus_statistics_unittest.cc | 8 | ||||
-rw-r--r-- | dbus/end_to_end_async_unittest.cc | 6 | ||||
-rw-r--r-- | dbus/end_to_end_sync_unittest.cc | 4 | ||||
-rw-r--r-- | dbus/mock_unittest.cc | 6 | ||||
-rw-r--r-- | dbus/object_manager_unittest.cc | 19 | ||||
-rw-r--r-- | dbus/object_proxy_unittest.cc | 6 | ||||
-rw-r--r-- | dbus/property_unittest.cc | 4 | ||||
-rw-r--r-- | dbus/signal_sender_verification_unittest.cc | 4 | ||||
-rw-r--r-- | dbus/test_service.h | 4 |
10 files changed, 29 insertions, 40 deletions
diff --git a/dbus/bus.cc b/dbus/bus.cc index 9398019..2f1300a 100644 --- a/dbus/bus.cc +++ b/dbus/bus.cc @@ -47,9 +47,7 @@ class Watch : public base::MessagePumpLibevent::Watcher { dbus_watch_set_data(raw_watch_, this, NULL); } - virtual ~Watch() { - dbus_watch_set_data(raw_watch_, NULL, NULL); - } + ~Watch() override { dbus_watch_set_data(raw_watch_, NULL, NULL); } // Returns true if the underlying file descriptor is ready to be watched. bool IsReadyToBeWatched() { @@ -84,13 +82,13 @@ class Watch : public base::MessagePumpLibevent::Watcher { private: // Implement MessagePumpLibevent::Watcher. - virtual void OnFileCanReadWithoutBlocking(int file_descriptor) override { + void OnFileCanReadWithoutBlocking(int file_descriptor) override { const bool success = dbus_watch_handle(raw_watch_, DBUS_WATCH_READABLE); CHECK(success) << "Unable to allocate memory"; } // Implement MessagePumpLibevent::Watcher. - virtual void OnFileCanWriteWithoutBlocking(int file_descriptor) override { + void OnFileCanWriteWithoutBlocking(int file_descriptor) override { const bool success = dbus_watch_handle(raw_watch_, DBUS_WATCH_WRITABLE); CHECK(success) << "Unable to allocate memory"; } diff --git a/dbus/dbus_statistics_unittest.cc b/dbus/dbus_statistics_unittest.cc index 0c0dd03..6260a63 100644 --- a/dbus/dbus_statistics_unittest.cc +++ b/dbus/dbus_statistics_unittest.cc @@ -15,13 +15,9 @@ class DBusStatisticsTest : public testing::Test { DBusStatisticsTest() { } - virtual void SetUp() override { - statistics::Initialize(); - } + void SetUp() override { statistics::Initialize(); } - virtual void TearDown() override { - statistics::Shutdown(); - } + void TearDown() override { statistics::Shutdown(); } protected: void AddTestMethodCalls() { diff --git a/dbus/end_to_end_async_unittest.cc b/dbus/end_to_end_async_unittest.cc index bd75bba4..8846830 100644 --- a/dbus/end_to_end_async_unittest.cc +++ b/dbus/end_to_end_async_unittest.cc @@ -35,7 +35,7 @@ const int kHugePayloadSize = 64 << 20; // 64 MB // ExportedObject. class EndToEndAsyncTest : public testing::Test { public: - virtual void SetUp() { + void SetUp() override { // Make the main thread not to allow IO. base::ThreadRestrictions::SetIOAllowed(false); @@ -112,7 +112,7 @@ class EndToEndAsyncTest : public testing::Test { run_loop_->Run(); } - virtual void TearDown() { + void TearDown() override { bus_->ShutdownOnDBusThreadAndBlock(); // Shut down the service. @@ -582,7 +582,7 @@ class SignalMultipleHandlerTest : public EndToEndAsyncTest { SignalMultipleHandlerTest() { } - virtual void SetUp() { + void SetUp() override { // Set up base class. EndToEndAsyncTest::SetUp(); diff --git a/dbus/end_to_end_sync_unittest.cc b/dbus/end_to_end_sync_unittest.cc index e3b316a..1167d96 100644 --- a/dbus/end_to_end_sync_unittest.cc +++ b/dbus/end_to_end_sync_unittest.cc @@ -21,7 +21,7 @@ class EndToEndSyncTest : public testing::Test { EndToEndSyncTest() { } - virtual void SetUp() { + void SetUp() override { // Start the test service; TestService::Options options; test_service_.reset(new TestService(options)); @@ -40,7 +40,7 @@ class EndToEndSyncTest : public testing::Test { ASSERT_FALSE(client_bus_->HasDBusThread()); } - virtual void TearDown() { + void TearDown() override { test_service_->ShutdownAndBlock(); test_service_->Stop(); client_bus_->ShutdownAndBlock(); diff --git a/dbus/mock_unittest.cc b/dbus/mock_unittest.cc index bfdc5a30..6b2a521 100644 --- a/dbus/mock_unittest.cc +++ b/dbus/mock_unittest.cc @@ -29,7 +29,7 @@ class MockTest : public testing::Test { MockTest() { } - virtual void SetUp() { + void SetUp() override { // Create a mock bus. Bus::Options options; options.bus_type = Bus::SYSTEM; @@ -66,9 +66,7 @@ class MockTest : public testing::Test { EXPECT_CALL(*mock_bus_.get(), ShutdownAndBlock()).WillOnce(Return()); } - virtual void TearDown() { - mock_bus_->ShutdownAndBlock(); - } + void TearDown() override { mock_bus_->ShutdownAndBlock(); } // Called when the response is received. void OnResponse(Response* response) { diff --git a/dbus/object_manager_unittest.cc b/dbus/object_manager_unittest.cc index cd02c5e..76ddb85 100644 --- a/dbus/object_manager_unittest.cc +++ b/dbus/object_manager_unittest.cc @@ -48,10 +48,9 @@ class ObjectManagerTest } }; - virtual PropertySet* CreateProperties( - ObjectProxy* object_proxy, - const ObjectPath& object_path, - const std::string& interface_name) override { + PropertySet* CreateProperties(ObjectProxy* object_proxy, + const ObjectPath& object_path, + const std::string& interface_name) override { Properties* properties = new Properties( object_proxy, interface_name, base::Bind(&ObjectManagerTest::OnPropertyChanged, @@ -59,7 +58,7 @@ class ObjectManagerTest return static_cast<PropertySet*>(properties); } - virtual void SetUp() { + void SetUp() override { // Make the main thread not to allow IO. base::ThreadRestrictions::SetIOAllowed(false); @@ -93,7 +92,7 @@ class ObjectManagerTest WaitForObject(); } - virtual void TearDown() { + void TearDown() override { bus_->ShutdownOnDBusThreadAndBlock(); // Shut down the service. @@ -126,15 +125,15 @@ class ObjectManagerTest protected: // Called when an object is added. - virtual void ObjectAdded(const ObjectPath& object_path, - const std::string& interface_name) override { + void ObjectAdded(const ObjectPath& object_path, + const std::string& interface_name) override { added_objects_.push_back(std::make_pair(object_path, interface_name)); run_loop_->Quit(); } // Called when an object is removed. - virtual void ObjectRemoved(const ObjectPath& object_path, - const std::string& interface_name) override { + void ObjectRemoved(const ObjectPath& object_path, + const std::string& interface_name) override { removed_objects_.push_back(std::make_pair(object_path, interface_name)); run_loop_->Quit(); } diff --git a/dbus/object_proxy_unittest.cc b/dbus/object_proxy_unittest.cc index 246058d..22130b6 100644 --- a/dbus/object_proxy_unittest.cc +++ b/dbus/object_proxy_unittest.cc @@ -15,7 +15,7 @@ namespace { class ObjectProxyTest : public testing::Test { protected: - virtual void SetUp() override { + void SetUp() override { Bus::Options bus_options; bus_options.bus_type = Bus::SESSION; bus_options.connection_type = Bus::PRIVATE; @@ -25,9 +25,7 @@ class ObjectProxyTest : public testing::Test { "org.chromium.TestService", ObjectPath("/org/chromium/TestObject")); } - virtual void TearDown() override { - bus_->ShutdownAndBlock(); - } + void TearDown() override { bus_->ShutdownAndBlock(); } base::MessageLoopForIO message_loop_; scoped_refptr<Bus> bus_; diff --git a/dbus/property_unittest.cc b/dbus/property_unittest.cc index 879a9a6..1e86817a 100644 --- a/dbus/property_unittest.cc +++ b/dbus/property_unittest.cc @@ -49,7 +49,7 @@ class PropertyTest : public testing::Test { } }; - virtual void SetUp() { + void SetUp() override { // Make the main thread not to allow IO. base::ThreadRestrictions::SetIOAllowed(false); @@ -87,7 +87,7 @@ class PropertyTest : public testing::Test { properties_->GetAll(); } - virtual void TearDown() { + void TearDown() override { bus_->ShutdownOnDBusThreadAndBlock(); // Shut down the service. diff --git a/dbus/signal_sender_verification_unittest.cc b/dbus/signal_sender_verification_unittest.cc index c8589f8..0f718a4 100644 --- a/dbus/signal_sender_verification_unittest.cc +++ b/dbus/signal_sender_verification_unittest.cc @@ -28,7 +28,7 @@ class SignalSenderVerificationTest : public testing::Test { on_ownership_called_(false) { } - virtual void SetUp() { + void SetUp() override { base::StatisticsRecorder::Initialize(); // Make the main thread not to allow IO. @@ -94,7 +94,7 @@ class SignalSenderVerificationTest : public testing::Test { ASSERT_FALSE(latest_name_owner_.empty()); } - virtual void TearDown() { + void TearDown() override { bus_->ShutdownOnDBusThreadAndBlock(); // Shut down the service. diff --git a/dbus/test_service.h b/dbus/test_service.h index cc7d521..5f215d3 100644 --- a/dbus/test_service.h +++ b/dbus/test_service.h @@ -46,7 +46,7 @@ class TestService : public base::Thread { static const int kNumMethodsToExport; explicit TestService(const Options& options); - virtual ~TestService(); + ~TestService() override; // Starts the service in a separate thread. // Returns true if the thread is started successfully. @@ -106,7 +106,7 @@ class TestService : public base::Thread { bool success); // base::Thread override. - virtual void Run(base::MessageLoop* message_loop) override; + void Run(base::MessageLoop* message_loop) override; // // Exported methods. |