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

Unified Diff: base/observer_list_unittest.cc

Issue 668783004: Standardize usage of virtual/override/final in base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatted Created 6 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/metrics/stats_table_unittest.cc ('k') | base/posix/file_descriptor_shuffle.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/observer_list_unittest.cc
diff --git a/base/observer_list_unittest.cc b/base/observer_list_unittest.cc
index 3df8db0f065b5401cf95dc6d3740c2c3c39d746b..11f59be5065c873426ed56e964f5eb2025911481 100644
--- a/base/observer_list_unittest.cc
+++ b/base/observer_list_unittest.cc
@@ -26,10 +26,8 @@ class Foo {
class Adder : public Foo {
public:
explicit Adder(int scaler) : total(0), scaler_(scaler) {}
- virtual void Observe(int x) override {
- total += x * scaler_;
- }
- virtual ~Adder() {}
+ void Observe(int x) override { total += x * scaler_; }
+ ~Adder() override {}
int total;
private:
@@ -42,10 +40,8 @@ class Disrupter : public Foo {
: list_(list),
doomed_(doomed) {
}
- virtual ~Disrupter() {}
- virtual void Observe(int x) override {
- list_->RemoveObserver(doomed_);
- }
+ ~Disrupter() override {}
+ void Observe(int x) override { list_->RemoveObserver(doomed_); }
private:
ObserverList<Foo>* list_;
@@ -58,10 +54,8 @@ class ThreadSafeDisrupter : public Foo {
: list_(list),
doomed_(doomed) {
}
- virtual ~ThreadSafeDisrupter() {}
- virtual void Observe(int x) override {
- list_->RemoveObserver(doomed_);
- }
+ ~ThreadSafeDisrupter() override {}
+ void Observe(int x) override { list_->RemoveObserver(doomed_); }
private:
ObserverListThreadSafe<Foo>* list_;
@@ -109,10 +103,9 @@ class AddRemoveThread : public PlatformThread::Delegate,
weak_factory_(this) {
}
- virtual ~AddRemoveThread() {
- }
+ ~AddRemoveThread() override {}
- virtual void ThreadMain() override {
+ void ThreadMain() override {
loop_ = new MessageLoop(); // Fire up a message loop.
loop_->PostTask(
FROM_HERE,
@@ -153,7 +146,7 @@ class AddRemoveThread : public PlatformThread::Delegate,
loop_->PostTask(FROM_HERE, MessageLoop::QuitWhenIdleClosure());
}
- virtual void Observe(int x) override {
+ void Observe(int x) override {
count_observes_++;
// If we're getting called after we removed ourselves from
@@ -323,13 +316,13 @@ TEST(ObserverListThreadSafeTest, WithoutMessageLoop) {
class FooRemover : public Foo {
public:
explicit FooRemover(ObserverListThreadSafe<Foo>* list) : list_(list) {}
- virtual ~FooRemover() {}
+ ~FooRemover() override {}
void AddFooToRemove(Foo* foo) {
foos_.push_back(foo);
}
- virtual void Observe(int x) override {
+ void Observe(int x) override {
std::vector<Foo*> tmp;
tmp.swap(foos_);
for (std::vector<Foo*>::iterator it = tmp.begin();
@@ -481,7 +474,7 @@ class AddInClearObserve : public Foo {
explicit AddInClearObserve(ObserverList<Foo>* list)
: list_(list), added_(false), adder_(1) {}
- virtual void Observe(int /* x */) override {
+ void Observe(int /* x */) override {
list_->Clear();
list_->AddObserver(&adder_);
added_ = true;
@@ -524,11 +517,9 @@ TEST(ObserverListTest, ClearNotifyExistingOnly) {
class ListDestructor : public Foo {
public:
explicit ListDestructor(ObserverList<Foo>* list) : list_(list) {}
- virtual ~ListDestructor() {}
+ ~ListDestructor() override {}
- virtual void Observe(int x) override {
- delete list_;
- }
+ void Observe(int x) override { delete list_; }
private:
ObserverList<Foo>* list_;
« no previous file with comments | « base/metrics/stats_table_unittest.cc ('k') | base/posix/file_descriptor_shuffle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698