diff options
author | dcheng <dcheng@chromium.org> | 2014-10-21 03:54:51 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-21 10:55:12 +0000 |
commit | 5648818ef9d5ef5fda79cd5dde2e42567af07785 (patch) | |
tree | c7a0e1c173409ad3a70736413504d6ba3c2b0422 /base | |
parent | 08038795458017a039565cfa158f0c379f91a007 (diff) | |
download | chromium_src-5648818ef9d5ef5fda79cd5dde2e42567af07785.zip chromium_src-5648818ef9d5ef5fda79cd5dde2e42567af07785.tar.gz chromium_src-5648818ef9d5ef5fda79cd5dde2e42567af07785.tar.bz2 |
Standardize usage of virtual/override/final in base/
BUG=417463
TBR=danakj@chromium.org
Review URL: https://codereview.chromium.org/668783004
Cr-Commit-Position: refs/heads/master@{#300447}
Diffstat (limited to 'base')
123 files changed, 651 insertions, 740 deletions
diff --git a/base/async_socket_io_handler.h b/base/async_socket_io_handler.h index 71ca5f4..bedb00f 100644 --- a/base/async_socket_io_handler.h +++ b/base/async_socket_io_handler.h @@ -54,7 +54,7 @@ class BASE_EXPORT AsyncSocketIoHandler #endif public: AsyncSocketIoHandler(); - virtual ~AsyncSocketIoHandler(); + ~AsyncSocketIoHandler() override; // Type definition for the callback. The parameter tells how many // bytes were read and is 0 if an error occurred. @@ -81,8 +81,8 @@ class BASE_EXPORT AsyncSocketIoHandler DWORD error) override; #elif defined(OS_POSIX) // Implementation of base::MessageLoopForIO::Watcher. - virtual void OnFileCanWriteWithoutBlocking(int socket) override {} - virtual void OnFileCanReadWithoutBlocking(int socket) override; + void OnFileCanWriteWithoutBlocking(int socket) override {} + void OnFileCanReadWithoutBlocking(int socket) override; void EnsureWatchingSocket(); #endif diff --git a/base/bind_unittest.cc b/base/bind_unittest.cc index ce1af1b..a30b775 100644 --- a/base/bind_unittest.cc +++ b/base/bind_unittest.cc @@ -66,7 +66,7 @@ class Parent { class Child : public Parent { public: - virtual void VirtualSet() override { value = kChildValue; } + void VirtualSet() override { value = kChildValue; } void NonVirtualSet() { value = kChildValue; } }; @@ -78,7 +78,7 @@ class NoRefParent { }; class NoRefChild : public NoRefParent { - virtual void VirtualSet() override { value = kChildValue; } + void VirtualSet() override { value = kChildValue; } void NonVirtualSet() { value = kChildValue; } }; diff --git a/base/debug/stack_trace_posix.cc b/base/debug/stack_trace_posix.cc index 25acbe0..2eac14e 100644 --- a/base/debug/stack_trace_posix.cc +++ b/base/debug/stack_trace_posix.cc @@ -402,7 +402,7 @@ class PrintBacktraceOutputHandler : public BacktraceOutputHandler { public: PrintBacktraceOutputHandler() {} - virtual void HandleOutput(const char* output) override { + void HandleOutput(const char* output) override { // NOTE: This code MUST be async-signal safe (it's used by in-process // stack dumping signal handler). NO malloc or stdio is allowed here. PrintToStderr(output); @@ -417,9 +417,7 @@ class StreamBacktraceOutputHandler : public BacktraceOutputHandler { explicit StreamBacktraceOutputHandler(std::ostream* os) : os_(os) { } - virtual void HandleOutput(const char* output) override { - (*os_) << output; - } + void HandleOutput(const char* output) override { (*os_) << output; } private: std::ostream* os_; diff --git a/base/debug/trace_event_argument.h b/base/debug/trace_event_argument.h index 7aa7c87..98f1bcf 100644 --- a/base/debug/trace_event_argument.h +++ b/base/debug/trace_event_argument.h @@ -40,10 +40,10 @@ class BASE_EXPORT TracedValue : public ConvertableToTraceFormat { void BeginArray(); void BeginDictionary(); - virtual void AppendAsTraceFormat(std::string* out) const override; + void AppendAsTraceFormat(std::string* out) const override; private: - virtual ~TracedValue(); + ~TracedValue() override; DictionaryValue* GetCurrentDictionary(); ListValue* GetCurrentArray(); diff --git a/base/debug/trace_event_impl.cc b/base/debug/trace_event_impl.cc index d8f32cc..ce62766 100644 --- a/base/debug/trace_event_impl.cc +++ b/base/debug/trace_event_impl.cc @@ -140,7 +140,7 @@ class TraceBufferRingBuffer : public TraceBuffer { recyclable_chunks_queue_[i] = i; } - virtual scoped_ptr<TraceBufferChunk> GetChunk(size_t* index) override { + scoped_ptr<TraceBufferChunk> GetChunk(size_t* index) override { // Because the number of threads is much less than the number of chunks, // the queue should never be empty. DCHECK(!QueueIsEmpty()); @@ -162,8 +162,7 @@ class TraceBufferRingBuffer : public TraceBuffer { return scoped_ptr<TraceBufferChunk>(chunk); } - virtual void ReturnChunk(size_t index, - scoped_ptr<TraceBufferChunk> chunk) override { + void ReturnChunk(size_t index, scoped_ptr<TraceBufferChunk> chunk) override { // When this method is called, the queue should not be full because it // can contain all chunks including the one to be returned. DCHECK(!QueueIsFull()); @@ -175,20 +174,18 @@ class TraceBufferRingBuffer : public TraceBuffer { queue_tail_ = NextQueueIndex(queue_tail_); } - virtual bool IsFull() const override { - return false; - } + bool IsFull() const override { return false; } - virtual size_t Size() const override { + size_t Size() const override { // This is approximate because not all of the chunks are full. return chunks_.size() * kTraceBufferChunkSize; } - virtual size_t Capacity() const override { + size_t Capacity() const override { return max_chunks_ * kTraceBufferChunkSize; } - virtual TraceEvent* GetEventByHandle(TraceEventHandle handle) override { + TraceEvent* GetEventByHandle(TraceEventHandle handle) override { if (handle.chunk_index >= chunks_.size()) return NULL; TraceBufferChunk* chunk = chunks_[handle.chunk_index]; @@ -197,7 +194,7 @@ class TraceBufferRingBuffer : public TraceBuffer { return chunk->GetEventAt(handle.event_index); } - virtual const TraceBufferChunk* NextChunk() override { + const TraceBufferChunk* NextChunk() override { if (chunks_.empty()) return NULL; @@ -212,7 +209,7 @@ class TraceBufferRingBuffer : public TraceBuffer { return NULL; } - virtual scoped_ptr<TraceBuffer> CloneForIteration() const override { + scoped_ptr<TraceBuffer> CloneForIteration() const override { scoped_ptr<ClonedTraceBuffer> cloned_buffer(new ClonedTraceBuffer()); for (size_t queue_index = queue_head_; queue_index != queue_tail_; queue_index = NextQueueIndex(queue_index)) { @@ -231,26 +228,25 @@ class TraceBufferRingBuffer : public TraceBuffer { ClonedTraceBuffer() : current_iteration_index_(0) {} // The only implemented method. - virtual const TraceBufferChunk* NextChunk() override { + const TraceBufferChunk* NextChunk() override { return current_iteration_index_ < chunks_.size() ? chunks_[current_iteration_index_++] : NULL; } - virtual scoped_ptr<TraceBufferChunk> GetChunk(size_t* index) override { + scoped_ptr<TraceBufferChunk> GetChunk(size_t* index) override { NOTIMPLEMENTED(); return scoped_ptr<TraceBufferChunk>(); } - virtual void ReturnChunk(size_t index, - scoped_ptr<TraceBufferChunk>) override { + void ReturnChunk(size_t index, scoped_ptr<TraceBufferChunk>) override { NOTIMPLEMENTED(); } - virtual bool IsFull() const override { return false; } - virtual size_t Size() const override { return 0; } - virtual size_t Capacity() const override { return 0; } - virtual TraceEvent* GetEventByHandle(TraceEventHandle handle) override { + bool IsFull() const override { return false; } + size_t Size() const override { return 0; } + size_t Capacity() const override { return 0; } + TraceEvent* GetEventByHandle(TraceEventHandle handle) override { return NULL; } - virtual scoped_ptr<TraceBuffer> CloneForIteration() const override { + scoped_ptr<TraceBuffer> CloneForIteration() const override { NOTIMPLEMENTED(); return scoped_ptr<TraceBuffer>(); } @@ -306,7 +302,7 @@ class TraceBufferVector : public TraceBuffer { chunks_.reserve(max_chunks_); } - virtual scoped_ptr<TraceBufferChunk> GetChunk(size_t* index) override { + scoped_ptr<TraceBufferChunk> GetChunk(size_t* index) override { // This function may be called when adding normal events or indirectly from // AddMetadataEventsWhileLocked(). We can not DECHECK(!IsFull()) because we // have to add the metadata events and flush thread-local buffers even if @@ -319,8 +315,7 @@ class TraceBufferVector : public TraceBuffer { new TraceBufferChunk(static_cast<uint32>(*index) + 1)); } - virtual void ReturnChunk(size_t index, - scoped_ptr<TraceBufferChunk> chunk) override { + void ReturnChunk(size_t index, scoped_ptr<TraceBufferChunk> chunk) override { DCHECK_GT(in_flight_chunk_count_, 0u); DCHECK_LT(index, chunks_.size()); DCHECK(!chunks_[index]); @@ -328,20 +323,18 @@ class TraceBufferVector : public TraceBuffer { chunks_[index] = chunk.release(); } - virtual bool IsFull() const override { - return chunks_.size() >= max_chunks_; - } + bool IsFull() const override { return chunks_.size() >= max_chunks_; } - virtual size_t Size() const override { + size_t Size() const override { // This is approximate because not all of the chunks are full. return chunks_.size() * kTraceBufferChunkSize; } - virtual size_t Capacity() const override { + size_t Capacity() const override { return max_chunks_ * kTraceBufferChunkSize; } - virtual TraceEvent* GetEventByHandle(TraceEventHandle handle) override { + TraceEvent* GetEventByHandle(TraceEventHandle handle) override { if (handle.chunk_index >= chunks_.size()) return NULL; TraceBufferChunk* chunk = chunks_[handle.chunk_index]; @@ -350,7 +343,7 @@ class TraceBufferVector : public TraceBuffer { return chunk->GetEventAt(handle.event_index); } - virtual const TraceBufferChunk* NextChunk() override { + const TraceBufferChunk* NextChunk() override { while (current_iteration_index_ < chunks_.size()) { // Skip in-flight chunks. const TraceBufferChunk* chunk = chunks_[current_iteration_index_++]; @@ -360,7 +353,7 @@ class TraceBufferVector : public TraceBuffer { return NULL; } - virtual scoped_ptr<TraceBuffer> CloneForIteration() const override { + scoped_ptr<TraceBuffer> CloneForIteration() const override { NOTIMPLEMENTED(); return scoped_ptr<TraceBuffer>(); } @@ -866,10 +859,10 @@ class TraceBucketData { class TraceSamplingThread : public PlatformThread::Delegate { public: TraceSamplingThread(); - virtual ~TraceSamplingThread(); + ~TraceSamplingThread() override; // Implementation of PlatformThread::Delegate: - virtual void ThreadMain() override; + void ThreadMain() override; static void DefaultSamplingCallback(TraceBucketData* bucekt_data); @@ -1047,7 +1040,7 @@ class TraceLog::ThreadLocalEventBuffer : public MessageLoop::DestructionObserver { public: ThreadLocalEventBuffer(TraceLog* trace_log); - virtual ~ThreadLocalEventBuffer(); + ~ThreadLocalEventBuffer() override; TraceEvent* AddTraceEvent(TraceEventHandle* handle); @@ -1066,7 +1059,7 @@ class TraceLog::ThreadLocalEventBuffer private: // MessageLoop::DestructionObserver - virtual void WillDestroyCurrentMessageLoop() override; + void WillDestroyCurrentMessageLoop() override; void FlushWhileLocked(); diff --git a/base/debug/trace_event_memory.cc b/base/debug/trace_event_memory.cc index 5cb0908..2831865 100644 --- a/base/debug/trace_event_memory.cc +++ b/base/debug/trace_event_memory.cc @@ -33,12 +33,12 @@ class MemoryDumpHolder : public base::debug::ConvertableToTraceFormat { explicit MemoryDumpHolder(char* dump) : dump_(dump) {} // base::debug::ConvertableToTraceFormat overrides: - virtual void AppendAsTraceFormat(std::string* out) const override { + void AppendAsTraceFormat(std::string* out) const override { AppendHeapProfileAsTraceFormat(dump_, out); } private: - virtual ~MemoryDumpHolder() { free(dump_); } + ~MemoryDumpHolder() override { free(dump_); } char* dump_; diff --git a/base/debug/trace_event_memory.h b/base/debug/trace_event_memory.h index 4caeef4..94c3f91 100644 --- a/base/debug/trace_event_memory.h +++ b/base/debug/trace_event_memory.h @@ -47,8 +47,8 @@ class BASE_EXPORT TraceMemoryController virtual ~TraceMemoryController(); // base::debug::TraceLog::EnabledStateChangedObserver overrides: - virtual void OnTraceLogEnabled() override; - virtual void OnTraceLogDisabled() override; + void OnTraceLogEnabled() override; + void OnTraceLogDisabled() override; // Starts heap memory profiling. void StartProfiling(); diff --git a/base/debug/trace_event_synthetic_delay.cc b/base/debug/trace_event_synthetic_delay.cc index efb797a..6abfe18 100644 --- a/base/debug/trace_event_synthetic_delay.cc +++ b/base/debug/trace_event_synthetic_delay.cc @@ -23,7 +23,7 @@ class TraceEventSyntheticDelayRegistry : public TraceEventSyntheticDelayClock { void ResetAllDelays(); // TraceEventSyntheticDelayClock implementation. - virtual base::TimeTicks Now() override; + base::TimeTicks Now() override; private: TraceEventSyntheticDelayRegistry(); diff --git a/base/debug/trace_event_synthetic_delay_unittest.cc b/base/debug/trace_event_synthetic_delay_unittest.cc index 124706f..60e4d20 100644 --- a/base/debug/trace_event_synthetic_delay_unittest.cc +++ b/base/debug/trace_event_synthetic_delay_unittest.cc @@ -26,7 +26,7 @@ class TraceEventSyntheticDelayTest : public testing::Test, } // TraceEventSyntheticDelayClock implementation. - virtual base::TimeTicks Now() override { + base::TimeTicks Now() override { AdvanceTime(base::TimeDelta::FromMilliseconds(kShortDurationMs / 10)); return now_; } diff --git a/base/debug/trace_event_system_stats_monitor.cc b/base/debug/trace_event_system_stats_monitor.cc index b2bf2ae8..9cbefd8 100644 --- a/base/debug/trace_event_system_stats_monitor.cc +++ b/base/debug/trace_event_system_stats_monitor.cc @@ -31,12 +31,12 @@ class SystemStatsHolder : public base::debug::ConvertableToTraceFormat { void GetSystemProfilingStats(); // base::debug::ConvertableToTraceFormat overrides: - virtual void AppendAsTraceFormat(std::string* out) const override { + void AppendAsTraceFormat(std::string* out) const override { AppendSystemProfileAsTraceFormat(system_stats_, out); } private: - virtual ~SystemStatsHolder() { } + ~SystemStatsHolder() override {} SystemMetrics system_stats_; diff --git a/base/debug/trace_event_system_stats_monitor.h b/base/debug/trace_event_system_stats_monitor.h index f676fce..143f187 100644 --- a/base/debug/trace_event_system_stats_monitor.h +++ b/base/debug/trace_event_system_stats_monitor.h @@ -36,8 +36,8 @@ class BASE_EXPORT TraceEventSystemStatsMonitor virtual ~TraceEventSystemStatsMonitor(); // base::debug::TraceLog::EnabledStateChangedObserver overrides: - virtual void OnTraceLogEnabled() override; - virtual void OnTraceLogDisabled() override; + void OnTraceLogEnabled() override; + void OnTraceLogDisabled() override; // Retrieves system profiling at the current time. void DumpSystemStats(); diff --git a/base/debug/trace_event_unittest.cc b/base/debug/trace_event_unittest.cc index 836a0bb..69b5743 100644 --- a/base/debug/trace_event_unittest.cc +++ b/base/debug/trace_event_unittest.cc @@ -995,11 +995,11 @@ class AfterStateChangeEnabledStateObserver virtual ~AfterStateChangeEnabledStateObserver() {} // TraceLog::EnabledStateObserver overrides: - virtual void OnTraceLogEnabled() override { + void OnTraceLogEnabled() override { EXPECT_TRUE(TraceLog::GetInstance()->IsEnabled()); } - virtual void OnTraceLogDisabled() override { + void OnTraceLogDisabled() override { EXPECT_FALSE(TraceLog::GetInstance()->IsEnabled()); } }; @@ -1028,9 +1028,9 @@ class SelfRemovingEnabledStateObserver virtual ~SelfRemovingEnabledStateObserver() {} // TraceLog::EnabledStateObserver overrides: - virtual void OnTraceLogEnabled() override {} + void OnTraceLogEnabled() override {} - virtual void OnTraceLogDisabled() override { + void OnTraceLogDisabled() override { TraceLog::GetInstance()->RemoveEnabledStateObserver(this); } }; @@ -1918,12 +1918,12 @@ class MyData : public ConvertableToTraceFormat { public: MyData() {} - virtual void AppendAsTraceFormat(std::string* out) const override { + void AppendAsTraceFormat(std::string* out) const override { out->append("{\"foo\":1}"); } private: - virtual ~MyData() {} + ~MyData() override {} DISALLOW_COPY_AND_ASSIGN(MyData); }; diff --git a/base/deferred_sequenced_task_runner.h b/base/deferred_sequenced_task_runner.h index 3220ac1..bc8db7a 100644 --- a/base/deferred_sequenced_task_runner.h +++ b/base/deferred_sequenced_task_runner.h @@ -27,16 +27,15 @@ class BASE_EXPORT DeferredSequencedTaskRunner : public SequencedTaskRunner { const scoped_refptr<SequencedTaskRunner>& target_runner); // TaskRunner implementation - virtual bool PostDelayedTask(const tracked_objects::Location& from_here, - const Closure& task, - TimeDelta delay) override; - virtual bool RunsTasksOnCurrentThread() const override; + bool PostDelayedTask(const tracked_objects::Location& from_here, + const Closure& task, + TimeDelta delay) override; + bool RunsTasksOnCurrentThread() const override; // SequencedTaskRunner implementation - virtual bool PostNonNestableDelayedTask( - const tracked_objects::Location& from_here, - const Closure& task, - TimeDelta delay) override; + bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, + const Closure& task, + TimeDelta delay) override; // Start the execution - posts all queued tasks to the target executor. The // deferred tasks are posted with their initial delay, meaning that the task @@ -56,7 +55,7 @@ class BASE_EXPORT DeferredSequencedTaskRunner : public SequencedTaskRunner { bool is_non_nestable; }; - virtual ~DeferredSequencedTaskRunner(); + ~DeferredSequencedTaskRunner() override; // Creates a |Task| object and adds it to |deferred_tasks_queue_|. void QueueDeferredTask(const tracked_objects::Location& from_here, diff --git a/base/environment.cc b/base/environment.cc index 94a766c..6cf7a18 100644 --- a/base/environment.cc +++ b/base/environment.cc @@ -22,8 +22,7 @@ namespace { class EnvironmentImpl : public base::Environment { public: - virtual bool GetVar(const char* variable_name, - std::string* result) override { + bool GetVar(const char* variable_name, std::string* result) override { if (GetVarImpl(variable_name, result)) return true; @@ -42,12 +41,12 @@ class EnvironmentImpl : public base::Environment { return GetVarImpl(alternate_case_var.c_str(), result); } - virtual bool SetVar(const char* variable_name, - const std::string& new_value) override { + bool SetVar(const char* variable_name, + const std::string& new_value) override { return SetVarImpl(variable_name, new_value); } - virtual bool UnSetVar(const char* variable_name) override { + bool UnSetVar(const char* variable_name) override { return UnSetVarImpl(variable_name); } diff --git a/base/file_version_info_mac.h b/base/file_version_info_mac.h index 50a04eb..a18dbbd 100644 --- a/base/file_version_info_mac.h +++ b/base/file_version_info_mac.h @@ -19,26 +19,26 @@ class NSBundle; class FileVersionInfoMac : public FileVersionInfo { public: explicit FileVersionInfoMac(NSBundle *bundle); - virtual ~FileVersionInfoMac(); + ~FileVersionInfoMac() override; // Accessors to the different version properties. // Returns an empty string if the property is not found. - virtual base::string16 company_name() override; - virtual base::string16 company_short_name() override; - virtual base::string16 product_name() override; - virtual base::string16 product_short_name() override; - virtual base::string16 internal_name() override; - virtual base::string16 product_version() override; - virtual base::string16 private_build() override; - virtual base::string16 special_build() override; - virtual base::string16 comments() override; - virtual base::string16 original_filename() override; - virtual base::string16 file_description() override; - virtual base::string16 file_version() override; - virtual base::string16 legal_copyright() override; - virtual base::string16 legal_trademarks() override; - virtual base::string16 last_change() override; - virtual bool is_official_build() override; + base::string16 company_name() override; + base::string16 company_short_name() override; + base::string16 product_name() override; + base::string16 product_short_name() override; + base::string16 internal_name() override; + base::string16 product_version() override; + base::string16 private_build() override; + base::string16 special_build() override; + base::string16 comments() override; + base::string16 original_filename() override; + base::string16 file_description() override; + base::string16 file_version() override; + base::string16 legal_copyright() override; + base::string16 legal_trademarks() override; + base::string16 last_change() override; + bool is_official_build() override; private: // Returns a base::string16 value for a property name. diff --git a/base/files/file_path_watcher_browsertest.cc b/base/files/file_path_watcher_browsertest.cc index f6d6d33..0e19b2e 100644 --- a/base/files/file_path_watcher_browsertest.cc +++ b/base/files/file_path_watcher_browsertest.cc @@ -111,9 +111,9 @@ class TestDelegate : public TestDelegateBase { : collector_(collector) { collector_->Register(this); } - virtual ~TestDelegate() {} + ~TestDelegate() override {} - virtual void OnFileChanged(const FilePath& path, bool error) override { + void OnFileChanged(const FilePath& path, bool error) override { if (error) ADD_FAILURE() << "Error " << path.value(); else @@ -272,9 +272,9 @@ class Deleter : public TestDelegateBase { : watcher_(watcher), loop_(loop) { } - virtual ~Deleter() {} + ~Deleter() override {} - virtual void OnFileChanged(const FilePath&, bool) override { + void OnFileChanged(const FilePath&, bool) override { watcher_.reset(); loop_->PostTask(FROM_HERE, MessageLoop::QuitWhenIdleClosure()); } diff --git a/base/files/file_path_watcher_fsevents.cc b/base/files/file_path_watcher_fsevents.cc index f658efe..f240e33 100644 --- a/base/files/file_path_watcher_fsevents.cc +++ b/base/files/file_path_watcher_fsevents.cc @@ -28,7 +28,7 @@ class FSEventsTaskRunner : public mac::LibDispatchTaskRunner { } protected: - virtual ~FSEventsTaskRunner() {} + ~FSEventsTaskRunner() override {} }; static LazyInstance<FSEventsTaskRunner>::Leaky g_task_runner = diff --git a/base/files/file_path_watcher_fsevents.h b/base/files/file_path_watcher_fsevents.h index d2fb8da..800c5b4 100644 --- a/base/files/file_path_watcher_fsevents.h +++ b/base/files/file_path_watcher_fsevents.h @@ -36,13 +36,13 @@ class FilePathWatcherFSEvents : public FilePathWatcher::PlatformDelegate { bool ResolveTargetPath(); // FilePathWatcher::PlatformDelegate overrides. - virtual bool Watch(const FilePath& path, - bool recursive, - const FilePathWatcher::Callback& callback) override; - virtual void Cancel() override; + bool Watch(const FilePath& path, + bool recursive, + const FilePathWatcher::Callback& callback) override; + void Cancel() override; private: - virtual ~FilePathWatcherFSEvents(); + ~FilePathWatcherFSEvents() override; // Destroy the event stream. void DestroyEventStream(); @@ -51,7 +51,7 @@ class FilePathWatcherFSEvents : public FilePathWatcher::PlatformDelegate { void StartEventStream(FSEventStreamEventId start_event); // Cleans up and stops the event stream. - virtual void CancelOnMessageLoopThread() override; + void CancelOnMessageLoopThread() override; // Callback to notify upon changes. FilePathWatcher::Callback callback_; diff --git a/base/files/file_path_watcher_kqueue.h b/base/files/file_path_watcher_kqueue.h index aa13af3..87af891 100644 --- a/base/files/file_path_watcher_kqueue.h +++ b/base/files/file_path_watcher_kqueue.h @@ -33,20 +33,20 @@ class FilePathWatcherKQueue : public FilePathWatcher::PlatformDelegate, FilePathWatcherKQueue(); // MessageLoopForIO::Watcher overrides. - virtual void OnFileCanReadWithoutBlocking(int fd) override; - virtual void OnFileCanWriteWithoutBlocking(int fd) override; + void OnFileCanReadWithoutBlocking(int fd) override; + void OnFileCanWriteWithoutBlocking(int fd) override; // MessageLoop::DestructionObserver overrides. - virtual void WillDestroyCurrentMessageLoop() override; + void WillDestroyCurrentMessageLoop() override; // FilePathWatcher::PlatformDelegate overrides. - virtual bool Watch(const FilePath& path, - bool recursive, - const FilePathWatcher::Callback& callback) override; - virtual void Cancel() override; + bool Watch(const FilePath& path, + bool recursive, + const FilePathWatcher::Callback& callback) override; + void Cancel() override; protected: - virtual ~FilePathWatcherKQueue(); + ~FilePathWatcherKQueue() override; private: class EventData { @@ -60,7 +60,7 @@ class FilePathWatcherKQueue : public FilePathWatcher::PlatformDelegate, typedef std::vector<struct kevent> EventVector; // Can only be called on |io_message_loop_|'s thread. - virtual void CancelOnMessageLoopThread() override; + void CancelOnMessageLoopThread() override; // Returns true if the kevent values are error free. bool AreKeventValuesValid(struct kevent* kevents, int count); diff --git a/base/files/file_path_watcher_mac.cc b/base/files/file_path_watcher_mac.cc index 58f78bd..6f55ba4 100644 --- a/base/files/file_path_watcher_mac.cc +++ b/base/files/file_path_watcher_mac.cc @@ -15,9 +15,9 @@ namespace { class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate { public: - virtual bool Watch(const FilePath& path, - bool recursive, - const FilePathWatcher::Callback& callback) override { + bool Watch(const FilePath& path, + bool recursive, + const FilePathWatcher::Callback& callback) override { // Use kqueue for non-recursive watches and FSEvents for recursive ones. DCHECK(!impl_.get()); if (recursive) { @@ -33,20 +33,20 @@ class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate { return impl_->Watch(path, recursive, callback); } - virtual void Cancel() override { + void Cancel() override { if (impl_.get()) impl_->Cancel(); set_cancelled(); } - virtual void CancelOnMessageLoopThread() override { + void CancelOnMessageLoopThread() override { if (impl_.get()) impl_->Cancel(); set_cancelled(); } protected: - virtual ~FilePathWatcherImpl() {} + ~FilePathWatcherImpl() override {} scoped_refptr<PlatformDelegate> impl_; }; diff --git a/base/files/important_file_writer_unittest.cc b/base/files/important_file_writer_unittest.cc index 71242ee..96d0d05 100644 --- a/base/files/important_file_writer_unittest.cc +++ b/base/files/important_file_writer_unittest.cc @@ -33,7 +33,7 @@ class DataSerializer : public ImportantFileWriter::DataSerializer { explicit DataSerializer(const std::string& data) : data_(data) { } - virtual bool SerializeData(std::string* output) override { + bool SerializeData(std::string* output) override { output->assign(data_); return true; } diff --git a/base/json/json_file_value_serializer.h b/base/json/json_file_value_serializer.h index 642729f..f0f556c 100644 --- a/base/json/json_file_value_serializer.h +++ b/base/json/json_file_value_serializer.h @@ -22,7 +22,7 @@ class BASE_EXPORT JSONFileValueSerializer : public base::ValueSerializer { : json_file_path_(json_file_path), allow_trailing_comma_(false) {} - virtual ~JSONFileValueSerializer() {} + ~JSONFileValueSerializer() override {} // DO NOT USE except in unit tests to verify the file was written properly. // We should never serialize directly to a file since this will block the @@ -32,7 +32,7 @@ class BASE_EXPORT JSONFileValueSerializer : public base::ValueSerializer { // Attempt to serialize the data structure represented by Value into // JSON. If the return value is true, the result will have been written // into the file whose name was passed into the constructor. - virtual bool Serialize(const base::Value& root) override; + bool Serialize(const base::Value& root) override; // Equivalent to Serialize(root) except binary values are omitted from the // output. @@ -45,8 +45,8 @@ class BASE_EXPORT JSONFileValueSerializer : public base::ValueSerializer { // If |error_message| is non-null, it will be filled in with a formatted // error message including the location of the error if appropriate. // The caller takes ownership of the returned value. - virtual base::Value* Deserialize(int* error_code, - std::string* error_message) override; + base::Value* Deserialize(int* error_code, + std::string* error_message) override; // This enum is designed to safely overlap with JSONReader::JsonParseError. enum JsonFileError { diff --git a/base/json/json_parser.cc b/base/json/json_parser.cc index 5e59a46..6a25bc7 100644 --- a/base/json/json_parser.cc +++ b/base/json/json_parser.cc @@ -37,7 +37,7 @@ class DictionaryHiddenRootValue : public base::DictionaryValue { DictionaryValue::Swap(static_cast<DictionaryValue*>(root)); } - virtual void Swap(DictionaryValue* other) override { + void Swap(DictionaryValue* other) override { DVLOG(1) << "Swap()ing a DictionaryValue inefficiently."; // First deep copy to convert JSONStringValue to std::string and swap that @@ -55,8 +55,8 @@ class DictionaryHiddenRootValue : public base::DictionaryValue { // Not overriding DictionaryValue::Remove because it just calls through to // the method below. - virtual bool RemoveWithoutPathExpansion(const std::string& key, - scoped_ptr<Value>* out) override { + bool RemoveWithoutPathExpansion(const std::string& key, + scoped_ptr<Value>* out) override { // If the caller won't take ownership of the removed value, just call up. if (!out) return DictionaryValue::RemoveWithoutPathExpansion(key, out); @@ -87,7 +87,7 @@ class ListHiddenRootValue : public base::ListValue { ListValue::Swap(static_cast<ListValue*>(root)); } - virtual void Swap(ListValue* other) override { + void Swap(ListValue* other) override { DVLOG(1) << "Swap()ing a ListValue inefficiently."; // First deep copy to convert JSONStringValue to std::string and swap that @@ -102,7 +102,7 @@ class ListHiddenRootValue : public base::ListValue { ListValue::Swap(copy.get()); } - virtual bool Remove(size_t index, scoped_ptr<Value>* out) override { + bool Remove(size_t index, scoped_ptr<Value>* out) override { // If the caller won't take ownership of the removed value, just call up. if (!out) return ListValue::Remove(index, out); @@ -137,18 +137,18 @@ class JSONStringValue : public base::Value { } // Overridden from base::Value: - virtual bool GetAsString(std::string* out_value) const override { + bool GetAsString(std::string* out_value) const override { string_piece_.CopyToString(out_value); return true; } - virtual bool GetAsString(string16* out_value) const override { + bool GetAsString(string16* out_value) const override { *out_value = UTF8ToUTF16(string_piece_); return true; } - virtual Value* DeepCopy() const override { + Value* DeepCopy() const override { return new StringValue(string_piece_.as_string()); } - virtual bool Equals(const Value* other) const override { + bool Equals(const Value* other) const override { std::string other_string; return other->IsType(TYPE_STRING) && other->GetAsString(&other_string) && StringPiece(other_string) == string_piece_; diff --git a/base/json/json_string_value_serializer.h b/base/json/json_string_value_serializer.h index 7fc5c6e..6435051 100644 --- a/base/json/json_string_value_serializer.h +++ b/base/json/json_string_value_serializer.h @@ -33,12 +33,12 @@ class BASE_EXPORT JSONStringValueSerializer : public base::ValueSerializer { allow_trailing_comma_(false) { } - virtual ~JSONStringValueSerializer(); + ~JSONStringValueSerializer() override; // Attempt to serialize the data structure represented by Value into // JSON. If the return value is true, the result will have been written // into the string passed into the constructor. - virtual bool Serialize(const base::Value& root) override; + bool Serialize(const base::Value& root) override; // Equivalent to Serialize(root) except binary values are omitted from the // output. @@ -51,8 +51,8 @@ class BASE_EXPORT JSONStringValueSerializer : public base::ValueSerializer { // If |error_message| is non-null, it will be filled in with a formatted // error message including the location of the error if appropriate. // The caller takes ownership of the returned value. - virtual base::Value* Deserialize(int* error_code, - std::string* error_message) override; + base::Value* Deserialize(int* error_code, + std::string* error_message) override; void set_pretty_print(bool new_value) { pretty_print_ = new_value; } bool pretty_print() { return pretty_print_; } diff --git a/base/lazy_instance_unittest.cc b/base/lazy_instance_unittest.cc index bf293c7..ec9ef26 100644 --- a/base/lazy_instance_unittest.cc +++ b/base/lazy_instance_unittest.cc @@ -46,7 +46,7 @@ class SlowDelegate : public base::DelegateSimpleThread::Delegate { explicit SlowDelegate(base::LazyInstance<SlowConstructor>* lazy) : lazy_(lazy) {} - virtual void Run() override { + void Run() override { EXPECT_EQ(12, lazy_->Get().some_int()); EXPECT_EQ(12, lazy_->Pointer()->some_int()); } diff --git a/base/mac/libdispatch_task_runner.h b/base/mac/libdispatch_task_runner.h index afe1fb7..f5fd866 100644 --- a/base/mac/libdispatch_task_runner.h +++ b/base/mac/libdispatch_task_runner.h @@ -38,16 +38,15 @@ class BASE_EXPORT LibDispatchTaskRunner : public base::SingleThreadTaskRunner { explicit LibDispatchTaskRunner(const char* name); // base::TaskRunner: - virtual bool PostDelayedTask(const tracked_objects::Location& from_here, - const Closure& task, - base::TimeDelta delay) override; - virtual bool RunsTasksOnCurrentThread() const override; + bool PostDelayedTask(const tracked_objects::Location& from_here, + const Closure& task, + base::TimeDelta delay) override; + bool RunsTasksOnCurrentThread() const override; // base::SequencedTaskRunner: - virtual bool PostNonNestableDelayedTask( - const tracked_objects::Location& from_here, - const Closure& task, - base::TimeDelta delay) override; + bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, + const Closure& task, + base::TimeDelta delay) override; // This blocks the calling thread until all work on the dispatch queue has // been run and the queue has been destroyed. Destroying a queue requires @@ -64,7 +63,7 @@ class BASE_EXPORT LibDispatchTaskRunner : public base::SingleThreadTaskRunner { dispatch_queue_t GetDispatchQueue() const; protected: - virtual ~LibDispatchTaskRunner(); + ~LibDispatchTaskRunner() override; private: static void Finalizer(void* context); diff --git a/base/memory/discardable_memory_emulated.h b/base/memory/discardable_memory_emulated.h index 33889ad..0dc15e3 100644 --- a/base/memory/discardable_memory_emulated.h +++ b/base/memory/discardable_memory_emulated.h @@ -17,7 +17,7 @@ class DiscardableMemoryEmulated public internal::DiscardableMemoryManagerAllocation { public: explicit DiscardableMemoryEmulated(size_t bytes); - virtual ~DiscardableMemoryEmulated(); + ~DiscardableMemoryEmulated() override; static bool ReduceMemoryUsage(); @@ -31,14 +31,14 @@ class DiscardableMemoryEmulated bool Initialize(); // Overridden from DiscardableMemory: - virtual DiscardableMemoryLockStatus Lock() override; - virtual void Unlock() override; - virtual void* Memory() const override; + DiscardableMemoryLockStatus Lock() override; + void Unlock() override; + void* Memory() const override; // Overridden from internal::DiscardableMemoryManagerAllocation: - virtual bool AllocateAndAcquireLock() override; - virtual void ReleaseLock() override {} - virtual void Purge() override; + bool AllocateAndAcquireLock() override; + void ReleaseLock() override {} + void Purge() override; private: const size_t bytes_; diff --git a/base/memory/discardable_memory_mach.h b/base/memory/discardable_memory_mach.h index a409047..4da13d3f 100644 --- a/base/memory/discardable_memory_mach.h +++ b/base/memory/discardable_memory_mach.h @@ -18,21 +18,21 @@ class DiscardableMemoryMach public internal::DiscardableMemoryManagerAllocation { public: explicit DiscardableMemoryMach(size_t bytes); - virtual ~DiscardableMemoryMach(); + ~DiscardableMemoryMach() override; static void PurgeForTesting(); bool Initialize(); // Overridden from DiscardableMemory: - virtual DiscardableMemoryLockStatus Lock() override; - virtual void Unlock() override; - virtual void* Memory() const override; + DiscardableMemoryLockStatus Lock() override; + void Unlock() override; + void* Memory() const override; // Overridden from internal::DiscardableMemoryManagerAllocation: - virtual bool AllocateAndAcquireLock() override; - virtual void ReleaseLock() override; - virtual void Purge() override; + bool AllocateAndAcquireLock() override; + void ReleaseLock() override; + void Purge() override; private: mac::ScopedMachVM memory_; diff --git a/base/memory/discardable_memory_manager_unittest.cc b/base/memory/discardable_memory_manager_unittest.cc index 18ceec3..fce7593 100644 --- a/base/memory/discardable_memory_manager_unittest.cc +++ b/base/memory/discardable_memory_manager_unittest.cc @@ -15,21 +15,21 @@ namespace { class TestAllocationImpl : public internal::DiscardableMemoryManagerAllocation { public: TestAllocationImpl() : is_allocated_(false), is_locked_(false) {} - virtual ~TestAllocationImpl() { DCHECK(!is_locked_); } + ~TestAllocationImpl() override { DCHECK(!is_locked_); } // Overridden from internal::DiscardableMemoryManagerAllocation: - virtual bool AllocateAndAcquireLock() override { + bool AllocateAndAcquireLock() override { bool was_allocated = is_allocated_; is_allocated_ = true; DCHECK(!is_locked_); is_locked_ = true; return was_allocated; } - virtual void ReleaseLock() override { + void ReleaseLock() override { DCHECK(is_locked_); is_locked_ = false; } - virtual void Purge() override { + void Purge() override { DCHECK(is_allocated_); is_allocated_ = false; } @@ -58,7 +58,7 @@ class TestDiscardableMemoryManagerImpl private: // Overriden from internal::DiscardableMemoryManager: - virtual TimeTicks Now() const override { return now_; } + TimeTicks Now() const override { return now_; } TimeTicks now_; }; diff --git a/base/memory/linked_ptr_unittest.cc b/base/memory/linked_ptr_unittest.cc index 2dbc4bd..f6bc410 100644 --- a/base/memory/linked_ptr_unittest.cc +++ b/base/memory/linked_ptr_unittest.cc @@ -25,10 +25,8 @@ struct A { // Subclass struct B: public A { B() { history += base::StringPrintf("B%d ctor\n", mynum); } - virtual ~B() { history += base::StringPrintf("B%d dtor\n", mynum); } - virtual void Use() override { - history += base::StringPrintf("B%d use\n", mynum); - } + ~B() override { history += base::StringPrintf("B%d dtor\n", mynum); } + void Use() override { history += base::StringPrintf("B%d use\n", mynum); } }; } // namespace diff --git a/base/memory/ref_counted_memory.h b/base/memory/ref_counted_memory.h index f7acc65..66dc65f 100644 --- a/base/memory/ref_counted_memory.h +++ b/base/memory/ref_counted_memory.h @@ -52,11 +52,11 @@ class BASE_EXPORT RefCountedStaticMemory : public RefCountedMemory { length_(length) {} // Overridden from RefCountedMemory: - virtual const unsigned char* front() const override; - virtual size_t size() const override; + const unsigned char* front() const override; + size_t size() const override; private: - virtual ~RefCountedStaticMemory(); + ~RefCountedStaticMemory() override; const unsigned char* data_; size_t length_; @@ -81,14 +81,14 @@ class BASE_EXPORT RefCountedBytes : public RefCountedMemory { static RefCountedBytes* TakeVector(std::vector<unsigned char>* to_destroy); // Overridden from RefCountedMemory: - virtual const unsigned char* front() const override; - virtual size_t size() const override; + const unsigned char* front() const override; + size_t size() const override; const std::vector<unsigned char>& data() const { return data_; } std::vector<unsigned char>& data() { return data_; } private: - virtual ~RefCountedBytes(); + ~RefCountedBytes() override; std::vector<unsigned char> data_; @@ -107,14 +107,14 @@ class BASE_EXPORT RefCountedString : public RefCountedMemory { static RefCountedString* TakeString(std::string* to_destroy); // Overridden from RefCountedMemory: - virtual const unsigned char* front() const override; - virtual size_t size() const override; + const unsigned char* front() const override; + size_t size() const override; const std::string& data() const { return data_; } std::string& data() { return data_; } private: - virtual ~RefCountedString(); + ~RefCountedString() override; std::string data_; @@ -129,11 +129,11 @@ class BASE_EXPORT RefCountedMallocedMemory : public base::RefCountedMemory { RefCountedMallocedMemory(void* data, size_t length); // Overridden from RefCountedMemory: - virtual const unsigned char* front() const override; - virtual size_t size() const override; + const unsigned char* front() const override; + size_t size() const override; private: - virtual ~RefCountedMallocedMemory(); + ~RefCountedMallocedMemory() override; unsigned char* data_; size_t length_; diff --git a/base/memory/scoped_ptr_unittest.cc b/base/memory/scoped_ptr_unittest.cc index 3da8d3b..6af19b6 100644 --- a/base/memory/scoped_ptr_unittest.cc +++ b/base/memory/scoped_ptr_unittest.cc @@ -25,11 +25,14 @@ class ConDecLogger : public ConDecLoggerParent { public: ConDecLogger() : ptr_(NULL) { } explicit ConDecLogger(int* ptr) { SetPtr(ptr); } - virtual ~ConDecLogger() { --*ptr_; } + ~ConDecLogger() override { --*ptr_; } - virtual void SetPtr(int* ptr) override { ptr_ = ptr; ++*ptr_; } + void SetPtr(int* ptr) override { + ptr_ = ptr; + ++*ptr_; + } - virtual int SomeMeth(int x) const override { return x; } + int SomeMeth(int x) const override { return x; } private: int* ptr_; diff --git a/base/memory/scoped_vector_unittest.cc b/base/memory/scoped_vector_unittest.cc index ae870d5..b60ca14 100644 --- a/base/memory/scoped_vector_unittest.cc +++ b/base/memory/scoped_vector_unittest.cc @@ -62,11 +62,11 @@ enum LifeCycleState { class LifeCycleWatcher : public LifeCycleObject::Observer { public: LifeCycleWatcher() : life_cycle_state_(LC_INITIAL) {} - virtual ~LifeCycleWatcher() {} + ~LifeCycleWatcher() override {} // Assert INITIAL -> CONSTRUCTED and no LifeCycleObject associated with this // LifeCycleWatcher. - virtual void OnLifeCycleConstruct(LifeCycleObject* object) override { + void OnLifeCycleConstruct(LifeCycleObject* object) override { ASSERT_EQ(LC_INITIAL, life_cycle_state_); ASSERT_EQ(NULL, constructed_life_cycle_object_.get()); life_cycle_state_ = LC_CONSTRUCTED; @@ -75,7 +75,7 @@ class LifeCycleWatcher : public LifeCycleObject::Observer { // Assert CONSTRUCTED -> DESTROYED and the |object| being destroyed is the // same one we saw constructed. - virtual void OnLifeCycleDestroy(LifeCycleObject* object) override { + void OnLifeCycleDestroy(LifeCycleObject* object) override { ASSERT_EQ(LC_CONSTRUCTED, life_cycle_state_); LifeCycleObject* constructed_life_cycle_object = constructed_life_cycle_object_.release(); diff --git a/base/memory/shared_memory_unittest.cc b/base/memory/shared_memory_unittest.cc index 775e1c8..0b3fd7b 100644 --- a/base/memory/shared_memory_unittest.cc +++ b/base/memory/shared_memory_unittest.cc @@ -47,7 +47,7 @@ namespace { class MultipleThreadMain : public PlatformThread::Delegate { public: explicit MultipleThreadMain(int16 id) : id_(id) {} - virtual ~MultipleThreadMain() {} + ~MultipleThreadMain() override {} static void CleanUp() { SharedMemory memory; @@ -55,7 +55,7 @@ class MultipleThreadMain : public PlatformThread::Delegate { } // PlatformThread::Delegate interface. - virtual void ThreadMain() override { + void ThreadMain() override { #if defined(OS_MACOSX) mac::ScopedNSAutoreleasePool pool; #endif diff --git a/base/memory/weak_ptr_unittest.cc b/base/memory/weak_ptr_unittest.cc index d79e8d4..d89a5c6 100644 --- a/base/memory/weak_ptr_unittest.cc +++ b/base/memory/weak_ptr_unittest.cc @@ -62,9 +62,7 @@ class BackgroundThread : public Thread { public: BackgroundThread() : Thread("owner_thread") {} - virtual ~BackgroundThread() { - Stop(); - } + ~BackgroundThread() override { Stop(); } void CreateArrowFromTarget(Arrow** arrow, Target* target) { WaitableEvent completion(true, false); diff --git a/base/message_loop/message_loop.h b/base/message_loop/message_loop.h index a180cc3..b781711 100644 --- a/base/message_loop/message_loop.h +++ b/base/message_loop/message_loop.h @@ -115,7 +115,7 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate { // Creates a TYPE_CUSTOM MessageLoop with the supplied MessagePump, which must // be non-NULL. explicit MessageLoop(scoped_ptr<base::MessagePump> pump); - virtual ~MessageLoop(); + ~MessageLoop() override; // Returns the MessageLoop object for the current thread, or null if none. static MessageLoop* current(); @@ -442,9 +442,9 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate { void HistogramEvent(int event); // MessagePump::Delegate methods: - virtual bool DoWork() override; - virtual bool DoDelayedWork(TimeTicks* next_delayed_work_time) override; - virtual bool DoIdleWork() override; + bool DoWork() override; + bool DoDelayedWork(TimeTicks* next_delayed_work_time) override; + bool DoIdleWork() override; const Type type_; diff --git a/base/message_loop/message_loop_proxy.h b/base/message_loop/message_loop_proxy.h index 4ace802..88eeac4 100644 --- a/base/message_loop/message_loop_proxy.h +++ b/base/message_loop/message_loop_proxy.h @@ -30,7 +30,7 @@ class BASE_EXPORT MessageLoopProxy : public SingleThreadTaskRunner { protected: MessageLoopProxy(); - virtual ~MessageLoopProxy(); + ~MessageLoopProxy() override; }; } // namespace base diff --git a/base/message_loop/message_loop_proxy_impl.h b/base/message_loop/message_loop_proxy_impl.h index ca9543e..0fe629f 100644 --- a/base/message_loop/message_loop_proxy_impl.h +++ b/base/message_loop/message_loop_proxy_impl.h @@ -25,18 +25,17 @@ class BASE_EXPORT MessageLoopProxyImpl : public MessageLoopProxy { scoped_refptr<IncomingTaskQueue> incoming_queue); // MessageLoopProxy implementation - virtual bool PostDelayedTask(const tracked_objects::Location& from_here, - const base::Closure& task, - base::TimeDelta delay) override; - virtual bool PostNonNestableDelayedTask( - const tracked_objects::Location& from_here, - const base::Closure& task, - base::TimeDelta delay) override; - virtual bool RunsTasksOnCurrentThread() const override; + bool PostDelayedTask(const tracked_objects::Location& from_here, + const base::Closure& task, + base::TimeDelta delay) override; + bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, + const base::Closure& task, + base::TimeDelta delay) override; + bool RunsTasksOnCurrentThread() const override; private: friend class RefCountedThreadSafe<MessageLoopProxyImpl>; - virtual ~MessageLoopProxyImpl(); + ~MessageLoopProxyImpl() override; // THe incoming queue receiving all posted tasks. scoped_refptr<IncomingTaskQueue> incoming_queue_; diff --git a/base/message_loop/message_loop_unittest.cc b/base/message_loop/message_loop_unittest.cc index 1a42cc6..733f5e5 100644 --- a/base/message_loop/message_loop_unittest.cc +++ b/base/message_loop/message_loop_unittest.cc @@ -664,16 +664,16 @@ class DummyTaskObserver : public MessageLoop::TaskObserver { num_tasks_processed_(0), num_tasks_(num_tasks) {} - virtual ~DummyTaskObserver() {} + ~DummyTaskObserver() override {} - virtual void WillProcessTask(const PendingTask& pending_task) override { + void WillProcessTask(const PendingTask& pending_task) override { num_tasks_started_++; EXPECT_TRUE(pending_task.time_posted != TimeTicks()); EXPECT_LE(num_tasks_started_, num_tasks_); EXPECT_EQ(num_tasks_started_, num_tasks_processed_ + 1); } - virtual void DidProcessTask(const PendingTask& pending_task) override { + void DidProcessTask(const PendingTask& pending_task) override { num_tasks_processed_++; EXPECT_TRUE(pending_task.time_posted != TimeTicks()); EXPECT_LE(num_tasks_started_, num_tasks_); @@ -756,10 +756,10 @@ namespace { class QuitDelegate : public MessageLoopForIO::Watcher { public: - virtual void OnFileCanWriteWithoutBlocking(int fd) override { + void OnFileCanWriteWithoutBlocking(int fd) override { MessageLoop::current()->QuitWhenIdle(); } - virtual void OnFileCanReadWithoutBlocking(int fd) override { + void OnFileCanReadWithoutBlocking(int fd) override { MessageLoop::current()->QuitWhenIdle(); } }; @@ -857,7 +857,7 @@ class MLDestructionObserver : public MessageLoop::DestructionObserver { destruction_observer_called_(destruction_observer_called), task_destroyed_before_message_loop_(false) { } - virtual void WillDestroyCurrentMessageLoop() override { + void WillDestroyCurrentMessageLoop() override { task_destroyed_before_message_loop_ = *task_destroyed_; *destruction_observer_called_ = true; } diff --git a/base/message_loop/message_pump_default.h b/base/message_loop/message_pump_default.h index e9f7302..d63e8101 100644 --- a/base/message_loop/message_pump_default.h +++ b/base/message_loop/message_pump_default.h @@ -15,13 +15,13 @@ namespace base { class BASE_EXPORT MessagePumpDefault : public MessagePump { public: MessagePumpDefault(); - virtual ~MessagePumpDefault(); + ~MessagePumpDefault() override; // MessagePump methods: - virtual void Run(Delegate* delegate) override; - virtual void Quit() override; - virtual void ScheduleWork() override; - virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time) override; + void Run(Delegate* delegate) override; + void Quit() override; + void ScheduleWork() override; + void ScheduleDelayedWork(const TimeTicks& delayed_work_time) override; private: // This flag is set to false when Run should return. diff --git a/base/message_loop/message_pump_libevent.h b/base/message_loop/message_pump_libevent.h index 2f1812f..3f5ad51 100644 --- a/base/message_loop/message_pump_libevent.h +++ b/base/message_loop/message_pump_libevent.h @@ -98,7 +98,7 @@ class BASE_EXPORT MessagePumpLibevent : public MessagePump { }; MessagePumpLibevent(); - virtual ~MessagePumpLibevent(); + ~MessagePumpLibevent() override; // Have the current thread's message loop watch for a a situation in which // reading/writing to the FD can be performed without blocking. @@ -122,10 +122,10 @@ class BASE_EXPORT MessagePumpLibevent : public MessagePump { void RemoveIOObserver(IOObserver* obs); // MessagePump methods: - virtual void Run(Delegate* delegate) override; - virtual void Quit() override; - virtual void ScheduleWork() override; - virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time) override; + void Run(Delegate* delegate) override; + void Quit() override; + void ScheduleWork() override; + void ScheduleDelayedWork(const TimeTicks& delayed_work_time) override; private: friend class MessagePumpLibeventTest; diff --git a/base/message_loop/message_pump_libevent_unittest.cc b/base/message_loop/message_pump_libevent_unittest.cc index e598d76..f9b89c4 100644 --- a/base/message_loop/message_pump_libevent_unittest.cc +++ b/base/message_loop/message_pump_libevent_unittest.cc @@ -62,11 +62,11 @@ namespace { // nothing useful. class StupidWatcher : public MessagePumpLibevent::Watcher { public: - virtual ~StupidWatcher() {} + ~StupidWatcher() override {} // base:MessagePumpLibevent::Watcher interface - virtual void OnFileCanReadWithoutBlocking(int fd) override {} - virtual void OnFileCanWriteWithoutBlocking(int fd) override {} + void OnFileCanReadWithoutBlocking(int fd) override {} + void OnFileCanWriteWithoutBlocking(int fd) override {} }; #if GTEST_HAS_DEATH_TEST && !defined(NDEBUG) @@ -97,16 +97,12 @@ class BaseWatcher : public MessagePumpLibevent::Watcher { : controller_(controller) { DCHECK(controller_); } - virtual ~BaseWatcher() {} + ~BaseWatcher() override {} // base:MessagePumpLibevent::Watcher interface - virtual void OnFileCanReadWithoutBlocking(int /* fd */) override { - NOTREACHED(); - } + void OnFileCanReadWithoutBlocking(int /* fd */) override { NOTREACHED(); } - virtual void OnFileCanWriteWithoutBlocking(int /* fd */) override { - NOTREACHED(); - } + void OnFileCanWriteWithoutBlocking(int /* fd */) override { NOTREACHED(); } protected: MessagePumpLibevent::FileDescriptorWatcher* controller_; @@ -118,11 +114,9 @@ class DeleteWatcher : public BaseWatcher { MessagePumpLibevent::FileDescriptorWatcher* controller) : BaseWatcher(controller) {} - virtual ~DeleteWatcher() { - DCHECK(!controller_); - } + ~DeleteWatcher() override { DCHECK(!controller_); } - virtual void OnFileCanWriteWithoutBlocking(int /* fd */) override { + void OnFileCanWriteWithoutBlocking(int /* fd */) override { DCHECK(controller_); delete controller_; controller_ = NULL; @@ -147,9 +141,9 @@ class StopWatcher : public BaseWatcher { MessagePumpLibevent::FileDescriptorWatcher* controller) : BaseWatcher(controller) {} - virtual ~StopWatcher() {} + ~StopWatcher() override {} - virtual void OnFileCanWriteWithoutBlocking(int /* fd */) override { + void OnFileCanWriteWithoutBlocking(int /* fd */) override { controller_->StopWatchingFileDescriptor(); } }; @@ -177,16 +171,16 @@ void QuitMessageLoopAndStart(const Closure& quit_closure) { class NestedPumpWatcher : public MessagePumpLibevent::Watcher { public: NestedPumpWatcher() {} - virtual ~NestedPumpWatcher() {} + ~NestedPumpWatcher() override {} - virtual void OnFileCanReadWithoutBlocking(int /* fd */) override { + void OnFileCanReadWithoutBlocking(int /* fd */) override { RunLoop runloop; MessageLoop::current()->PostTask(FROM_HERE, Bind(&QuitMessageLoopAndStart, runloop.QuitClosure())); runloop.Run(); } - virtual void OnFileCanWriteWithoutBlocking(int /* fd */) override {} + void OnFileCanWriteWithoutBlocking(int /* fd */) override {} }; TEST_F(MessagePumpLibeventTest, NestedPumpWatcher) { diff --git a/base/message_loop/message_pump_mac.h b/base/message_loop/message_pump_mac.h index d16db8c..55ab2c6 100644 --- a/base/message_loop/message_pump_mac.h +++ b/base/message_loop/message_pump_mac.h @@ -82,18 +82,18 @@ class MessagePumpCFRunLoopBase : public MessagePump { friend class MessagePumpScopedAutoreleasePool; public: MessagePumpCFRunLoopBase(); - virtual ~MessagePumpCFRunLoopBase(); + ~MessagePumpCFRunLoopBase() override; // Subclasses should implement the work they need to do in MessagePump::Run // in the DoRun method. MessagePumpCFRunLoopBase::Run calls DoRun directly. // This arrangement is used because MessagePumpCFRunLoopBase needs to set // up and tear down things before and after the "meat" of DoRun. - virtual void Run(Delegate* delegate) override; + void Run(Delegate* delegate) override; virtual void DoRun(Delegate* delegate) = 0; - virtual void ScheduleWork() override; - virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time) override; - virtual void SetTimerSlack(TimerSlack timer_slack) override; + void ScheduleWork() override; + void ScheduleDelayedWork(const TimeTicks& delayed_work_time) override; + void SetTimerSlack(TimerSlack timer_slack) override; protected: // Accessors for private data members to be used by subclasses. @@ -220,13 +220,13 @@ class MessagePumpCFRunLoopBase : public MessagePump { class BASE_EXPORT MessagePumpCFRunLoop : public MessagePumpCFRunLoopBase { public: MessagePumpCFRunLoop(); - virtual ~MessagePumpCFRunLoop(); + ~MessagePumpCFRunLoop() override; - virtual void DoRun(Delegate* delegate) override; - virtual void Quit() override; + void DoRun(Delegate* delegate) override; + void Quit() override; private: - virtual void EnterExitRunLoop(CFRunLoopActivity activity) override; + void EnterExitRunLoop(CFRunLoopActivity activity) override; // True if Quit is called to stop the innermost MessagePump // (innermost_quittable_) but some other CFRunLoopRun loop (nesting_level_) @@ -239,10 +239,10 @@ class BASE_EXPORT MessagePumpCFRunLoop : public MessagePumpCFRunLoopBase { class BASE_EXPORT MessagePumpNSRunLoop : public MessagePumpCFRunLoopBase { public: MessagePumpNSRunLoop(); - virtual ~MessagePumpNSRunLoop(); + ~MessagePumpNSRunLoop() override; - virtual void DoRun(Delegate* delegate) override; - virtual void Quit() override; + void DoRun(Delegate* delegate) override; + void Quit() override; private: // A source that doesn't do anything but provide something signalable @@ -282,10 +282,10 @@ class MessagePumpUIApplication : public MessagePumpCFRunLoopBase { class MessagePumpNSApplication : public MessagePumpCFRunLoopBase { public: MessagePumpNSApplication(); - virtual ~MessagePumpNSApplication(); + ~MessagePumpNSApplication() override; - virtual void DoRun(Delegate* delegate) override; - virtual void Quit() override; + void DoRun(Delegate* delegate) override; + void Quit() override; private: // False after Quit is called. @@ -303,12 +303,12 @@ class MessagePumpNSApplication : public MessagePumpCFRunLoopBase { class MessagePumpCrApplication : public MessagePumpNSApplication { public: MessagePumpCrApplication(); - virtual ~MessagePumpCrApplication(); + ~MessagePumpCrApplication() override; protected: // Returns nil if NSApp is currently in the middle of calling // -sendEvent. Requires NSApp implementing CrAppProtocol. - virtual AutoreleasePoolType* CreateAutoreleasePool() override; + AutoreleasePoolType* CreateAutoreleasePool() override; private: DISALLOW_COPY_AND_ASSIGN(MessagePumpCrApplication); diff --git a/base/message_loop/message_pump_perftest.cc b/base/message_loop/message_pump_perftest.cc index 40550e1..9fca465 100644 --- a/base/message_loop/message_pump_perftest.cc +++ b/base/message_loop/message_pump_perftest.cc @@ -230,14 +230,13 @@ static void DoNothing() { class FakeMessagePump : public MessagePump { public: FakeMessagePump() {} - virtual ~FakeMessagePump() {} + ~FakeMessagePump() override {} - virtual void Run(Delegate* delegate) override {} + void Run(Delegate* delegate) override {} - virtual void Quit() override {} - virtual void ScheduleWork() override {} - virtual void ScheduleDelayedWork( - const TimeTicks& delayed_work_time) override {} + void Quit() override {} + void ScheduleWork() override {} + void ScheduleDelayedWork(const TimeTicks& delayed_work_time) override {} }; class PostTaskTest : public testing::Test { diff --git a/base/metrics/field_trial_unittest.cc b/base/metrics/field_trial_unittest.cc index 5080d65..905cc22 100644 --- a/base/metrics/field_trial_unittest.cc +++ b/base/metrics/field_trial_unittest.cc @@ -44,12 +44,10 @@ class TestFieldTrialObserver : public FieldTrialList::Observer { FieldTrialList::AddObserver(this); } - virtual ~TestFieldTrialObserver() { - FieldTrialList::RemoveObserver(this); - } + ~TestFieldTrialObserver() override { FieldTrialList::RemoveObserver(this); } - virtual void OnFieldTrialGroupFinalized(const std::string& trial, - const std::string& group) override { + void OnFieldTrialGroupFinalized(const std::string& trial, + const std::string& group) override { trial_name_ = trial; group_name_ = group; } diff --git a/base/metrics/histogram.h b/base/metrics/histogram.h index 47cfc79..5ed9d9e 100644 --- a/base/metrics/histogram.h +++ b/base/metrics/histogram.h @@ -359,7 +359,7 @@ class BASE_EXPORT Histogram : public HistogramBase { // produce a false-alarm if a race occurred in the reading of the data during // a SnapShot process, but should otherwise be false at all times (unless we // have memory over-writes, or DRAM failures). - virtual int FindCorruption(const HistogramSamples& samples) const override; + int FindCorruption(const HistogramSamples& samples) const override; //---------------------------------------------------------------------------- // Accessors for factory construction, serialization and testing. @@ -382,17 +382,16 @@ class BASE_EXPORT Histogram : public HistogramBase { size_t* bucket_count); // HistogramBase implementation: - virtual HistogramType GetHistogramType() const override; - virtual bool HasConstructionArguments( - Sample expected_minimum, - Sample expected_maximum, - size_t expected_bucket_count) const override; - virtual void Add(Sample value) override; - virtual scoped_ptr<HistogramSamples> SnapshotSamples() const override; - virtual void AddSamples(const HistogramSamples& samples) override; - virtual bool AddSamplesFromPickle(PickleIterator* iter) override; - virtual void WriteHTMLGraph(std::string* output) const override; - virtual void WriteAscii(std::string* output) const override; + HistogramType GetHistogramType() const override; + bool HasConstructionArguments(Sample expected_minimum, + Sample expected_maximum, + size_t expected_bucket_count) const override; + void Add(Sample value) override; + scoped_ptr<HistogramSamples> SnapshotSamples() const override; + void AddSamples(const HistogramSamples& samples) override; + bool AddSamplesFromPickle(PickleIterator* iter) override; + void WriteHTMLGraph(std::string* output) const override; + void WriteAscii(std::string* output) const override; protected: // |ranges| should contain the underflow and overflow buckets. See top @@ -402,10 +401,10 @@ class BASE_EXPORT Histogram : public HistogramBase { Sample maximum, const BucketRanges* ranges); - virtual ~Histogram(); + ~Histogram() override; // HistogramBase implementation: - virtual bool SerializeInfoImpl(Pickle* pickle) const override; + bool SerializeInfoImpl(Pickle* pickle) const override; // Method to override to skip the display of the i'th bucket if it's empty. virtual bool PrintEmptyBucket(size_t index) const; @@ -458,11 +457,11 @@ class BASE_EXPORT Histogram : public HistogramBase { std::string* output) const; // WriteJSON calls these. - virtual void GetParameters(DictionaryValue* params) const override; + void GetParameters(DictionaryValue* params) const override; - virtual void GetCountAndBucketData(Count* count, - int64* sum, - ListValue* buckets) const override; + void GetCountAndBucketData(Count* count, + int64* sum, + ListValue* buckets) const override; // Does not own this object. Should get from StatisticsRecorder. const BucketRanges* bucket_ranges_; @@ -483,7 +482,7 @@ class BASE_EXPORT Histogram : public HistogramBase { // buckets. class BASE_EXPORT LinearHistogram : public Histogram { public: - virtual ~LinearHistogram(); + ~LinearHistogram() override; /* minimum should start from 1. 0 is as minimum is invalid. 0 is an implicit default underflow bucket. */ @@ -521,7 +520,7 @@ class BASE_EXPORT LinearHistogram : public Histogram { BucketRanges* ranges); // Overridden from Histogram: - virtual HistogramType GetHistogramType() const override; + HistogramType GetHistogramType() const override; protected: LinearHistogram(const std::string& name, @@ -529,15 +528,15 @@ class BASE_EXPORT LinearHistogram : public Histogram { Sample maximum, const BucketRanges* ranges); - virtual double GetBucketSize(Count current, size_t i) const override; + double GetBucketSize(Count current, size_t i) const override; // If we have a description for a bucket, then return that. Otherwise // let parent class provide a (numeric) description. - virtual const std::string GetAsciiBucketRange(size_t i) const override; + const std::string GetAsciiBucketRange(size_t i) const override; // Skip printing of name for numeric range if we have a name (and if this is // an empty bucket). - virtual bool PrintEmptyBucket(size_t index) const override; + bool PrintEmptyBucket(size_t index) const override; private: friend BASE_EXPORT_PRIVATE HistogramBase* DeserializeHistogramInfo( @@ -560,7 +559,7 @@ class BASE_EXPORT BooleanHistogram : public LinearHistogram { public: static HistogramBase* FactoryGet(const std::string& name, int32 flags); - virtual HistogramType GetHistogramType() const override; + HistogramType GetHistogramType() const override; private: BooleanHistogram(const std::string& name, const BucketRanges* ranges); @@ -586,7 +585,7 @@ class BASE_EXPORT CustomHistogram : public Histogram { int32 flags); // Overridden from Histogram: - virtual HistogramType GetHistogramType() const override; + HistogramType GetHistogramType() const override; // Helper method for transforming an array of valid enumeration values // to the std::vector<int> expected by UMA_HISTOGRAM_CUSTOM_ENUMERATION. @@ -601,9 +600,9 @@ class BASE_EXPORT CustomHistogram : public Histogram { const BucketRanges* ranges); // HistogramBase implementation: - virtual bool SerializeInfoImpl(Pickle* pickle) const override; + bool SerializeInfoImpl(Pickle* pickle) const override; - virtual double GetBucketSize(Count current, size_t i) const override; + double GetBucketSize(Count current, size_t i) const override; private: friend BASE_EXPORT_PRIVATE HistogramBase* DeserializeHistogramInfo( diff --git a/base/metrics/histogram_delta_serialization.h b/base/metrics/histogram_delta_serialization.h index 037d0b5..a379914 100644 --- a/base/metrics/histogram_delta_serialization.h +++ b/base/metrics/histogram_delta_serialization.h @@ -23,7 +23,7 @@ class BASE_EXPORT HistogramDeltaSerialization : public HistogramFlattener { public: // |caller_name| is string used in histograms for counting inconsistencies. explicit HistogramDeltaSerialization(const std::string& caller_name); - virtual ~HistogramDeltaSerialization(); + ~HistogramDeltaSerialization() override; // Computes deltas in histogram bucket counts relative to the previous call to // this method. Stores the deltas in serialized form into |serialized_deltas|. @@ -38,13 +38,12 @@ class BASE_EXPORT HistogramDeltaSerialization : public HistogramFlattener { private: // HistogramFlattener implementation. - virtual void RecordDelta(const HistogramBase& histogram, - const HistogramSamples& snapshot) override; - virtual void InconsistencyDetected( + void RecordDelta(const HistogramBase& histogram, + const HistogramSamples& snapshot) override; + void InconsistencyDetected(HistogramBase::Inconsistency problem) override; + void UniqueInconsistencyDetected( HistogramBase::Inconsistency problem) override; - virtual void UniqueInconsistencyDetected( - HistogramBase::Inconsistency problem) override; - virtual void InconsistencyDetectedInLoggedCount(int amount) override; + void InconsistencyDetectedInLoggedCount(int amount) override; // Calculates deltas in histogram counters. HistogramSnapshotManager histogram_snapshot_manager_; diff --git a/base/metrics/histogram_samples.cc b/base/metrics/histogram_samples.cc index 26c2aeb..f5e03b9 100644 --- a/base/metrics/histogram_samples.cc +++ b/base/metrics/histogram_samples.cc @@ -15,11 +15,12 @@ class SampleCountPickleIterator : public SampleCountIterator { public: explicit SampleCountPickleIterator(PickleIterator* iter); - virtual bool Done() const override; - virtual void Next() override; - virtual void Get(HistogramBase::Sample* min, - HistogramBase::Sample* max, - HistogramBase::Count* count) const override; + bool Done() const override; + void Next() override; + void Get(HistogramBase::Sample* min, + HistogramBase::Sample* max, + HistogramBase::Count* count) const override; + private: PickleIterator* const iter_; diff --git a/base/metrics/histogram_snapshot_manager_unittest.cc b/base/metrics/histogram_snapshot_manager_unittest.cc index 2da22be..5dd72a7 100644 --- a/base/metrics/histogram_snapshot_manager_unittest.cc +++ b/base/metrics/histogram_snapshot_manager_unittest.cc @@ -18,22 +18,21 @@ class HistogramFlattenerDeltaRecorder : public HistogramFlattener { public: HistogramFlattenerDeltaRecorder() {} - virtual void RecordDelta(const HistogramBase& histogram, - const HistogramSamples& snapshot) override { + void RecordDelta(const HistogramBase& histogram, + const HistogramSamples& snapshot) override { recorded_delta_histogram_names_.push_back(histogram.histogram_name()); } - virtual void InconsistencyDetected( - HistogramBase::Inconsistency problem) override { + void InconsistencyDetected(HistogramBase::Inconsistency problem) override { ASSERT_TRUE(false); } - virtual void UniqueInconsistencyDetected( + void UniqueInconsistencyDetected( HistogramBase::Inconsistency problem) override { ASSERT_TRUE(false); } - virtual void InconsistencyDetectedInLoggedCount(int amount) override { + void InconsistencyDetectedInLoggedCount(int amount) override { ASSERT_TRUE(false); } diff --git a/base/metrics/sample_map.h b/base/metrics/sample_map.h index 0972acd..7a780ea 100644 --- a/base/metrics/sample_map.h +++ b/base/metrics/sample_map.h @@ -20,18 +20,17 @@ namespace base { class BASE_EXPORT_PRIVATE SampleMap : public HistogramSamples { public: SampleMap(); - virtual ~SampleMap(); + ~SampleMap() override; // HistogramSamples implementation: - virtual void Accumulate(HistogramBase::Sample value, - HistogramBase::Count count) override; - virtual HistogramBase::Count GetCount( - HistogramBase::Sample value) const override; - virtual HistogramBase::Count TotalCount() const override; - virtual scoped_ptr<SampleCountIterator> Iterator() const override; + void Accumulate(HistogramBase::Sample value, + HistogramBase::Count count) override; + HistogramBase::Count GetCount(HistogramBase::Sample value) const override; + HistogramBase::Count TotalCount() const override; + scoped_ptr<SampleCountIterator> Iterator() const override; protected: - virtual bool AddSubtractImpl( + bool AddSubtractImpl( SampleCountIterator* iter, HistogramSamples::Operator op) override; // |op| is ADD or SUBTRACT. @@ -47,14 +46,15 @@ class BASE_EXPORT_PRIVATE SampleMapIterator : public SampleCountIterator { SampleToCountMap; explicit SampleMapIterator(const SampleToCountMap& sample_counts); - virtual ~SampleMapIterator(); + ~SampleMapIterator() override; // SampleCountIterator implementation: - virtual bool Done() const override; - virtual void Next() override; - virtual void Get(HistogramBase::Sample* min, - HistogramBase::Sample* max, - HistogramBase::Count* count) const override; + bool Done() const override; + void Next() override; + void Get(HistogramBase::Sample* min, + HistogramBase::Sample* max, + HistogramBase::Count* count) const override; + private: SampleToCountMap::const_iterator iter_; const SampleToCountMap::const_iterator end_; diff --git a/base/metrics/sample_vector.h b/base/metrics/sample_vector.h index 8cc8ce9..55f9b96 100644 --- a/base/metrics/sample_vector.h +++ b/base/metrics/sample_vector.h @@ -23,21 +23,20 @@ class BucketRanges; class BASE_EXPORT_PRIVATE SampleVector : public HistogramSamples { public: explicit SampleVector(const BucketRanges* bucket_ranges); - virtual ~SampleVector(); + ~SampleVector() override; // HistogramSamples implementation: - virtual void Accumulate(HistogramBase::Sample value, - HistogramBase::Count count) override; - virtual HistogramBase::Count GetCount( - HistogramBase::Sample value) const override; - virtual HistogramBase::Count TotalCount() const override; - virtual scoped_ptr<SampleCountIterator> Iterator() const override; + void Accumulate(HistogramBase::Sample value, + HistogramBase::Count count) override; + HistogramBase::Count GetCount(HistogramBase::Sample value) const override; + HistogramBase::Count TotalCount() const override; + scoped_ptr<SampleCountIterator> Iterator() const override; // Get count of a specific bucket. HistogramBase::Count GetCountAtIndex(size_t bucket_index) const; protected: - virtual bool AddSubtractImpl( + bool AddSubtractImpl( SampleCountIterator* iter, HistogramSamples::Operator op) override; // |op| is ADD or SUBTRACT. @@ -58,17 +57,17 @@ class BASE_EXPORT_PRIVATE SampleVectorIterator : public SampleCountIterator { public: SampleVectorIterator(const std::vector<HistogramBase::AtomicCount>* counts, const BucketRanges* bucket_ranges); - virtual ~SampleVectorIterator(); + ~SampleVectorIterator() override; // SampleCountIterator implementation: - virtual bool Done() const override; - virtual void Next() override; - virtual void Get(HistogramBase::Sample* min, - HistogramBase::Sample* max, - HistogramBase::Count* count) const override; + bool Done() const override; + void Next() override; + void Get(HistogramBase::Sample* min, + HistogramBase::Sample* max, + HistogramBase::Count* count) const override; // SampleVector uses predefined buckets, so iterator can return bucket index. - virtual bool GetBucketIndex(size_t* index) const override; + bool GetBucketIndex(size_t* index) const override; private: void SkipEmptyBuckets(); diff --git a/base/metrics/sparse_histogram.h b/base/metrics/sparse_histogram.h index 321c630..8c05613 100644 --- a/base/metrics/sparse_histogram.h +++ b/base/metrics/sparse_histogram.h @@ -34,24 +34,23 @@ class BASE_EXPORT_PRIVATE SparseHistogram : public HistogramBase { // new one. static HistogramBase* FactoryGet(const std::string& name, int32 flags); - virtual ~SparseHistogram(); + ~SparseHistogram() override; // HistogramBase implementation: - virtual HistogramType GetHistogramType() const override; - virtual bool HasConstructionArguments( - Sample expected_minimum, - Sample expected_maximum, - size_t expected_bucket_count) const override; - virtual void Add(Sample value) override; - virtual void AddSamples(const HistogramSamples& samples) override; - virtual bool AddSamplesFromPickle(PickleIterator* iter) override; - virtual scoped_ptr<HistogramSamples> SnapshotSamples() const override; - virtual void WriteHTMLGraph(std::string* output) const override; - virtual void WriteAscii(std::string* output) const override; + HistogramType GetHistogramType() const override; + bool HasConstructionArguments(Sample expected_minimum, + Sample expected_maximum, + size_t expected_bucket_count) const override; + void Add(Sample value) override; + void AddSamples(const HistogramSamples& samples) override; + bool AddSamplesFromPickle(PickleIterator* iter) override; + scoped_ptr<HistogramSamples> SnapshotSamples() const override; + void WriteHTMLGraph(std::string* output) const override; + void WriteAscii(std::string* output) const override; protected: // HistogramBase implementation: - virtual bool SerializeInfoImpl(Pickle* pickle) const override; + bool SerializeInfoImpl(Pickle* pickle) const override; private: // Clients should always use FactoryGet to create SparseHistogram. @@ -61,10 +60,10 @@ class BASE_EXPORT_PRIVATE SparseHistogram : public HistogramBase { PickleIterator* iter); static HistogramBase* DeserializeInfoImpl(PickleIterator* iter); - virtual void GetParameters(DictionaryValue* params) const override; - virtual void GetCountAndBucketData(Count* count, - int64* sum, - ListValue* buckets) const override; + void GetParameters(DictionaryValue* params) const override; + void GetCountAndBucketData(Count* count, + int64* sum, + ListValue* buckets) const override; // Helpers for emitting Ascii graphic. Each method appends data to output. void WriteAsciiImpl(bool graph_it, diff --git a/base/metrics/stats_counters.h b/base/metrics/stats_counters.h index a2c7dec..0f8354f 100644 --- a/base/metrics/stats_counters.h +++ b/base/metrics/stats_counters.h @@ -133,7 +133,7 @@ class BASE_EXPORT StatsCounterTimer : protected StatsCounter { public: // Constructs and starts the timer. explicit StatsCounterTimer(const std::string& name); - virtual ~StatsCounterTimer(); + ~StatsCounterTimer() override; // Start the timer. void Start(); @@ -162,9 +162,9 @@ class BASE_EXPORT StatsRate : public StatsCounterTimer { public: // Constructs and starts the timer. explicit StatsRate(const std::string& name); - virtual ~StatsRate(); + ~StatsRate() override; - virtual void Add(int value) override; + void Add(int value) override; private: StatsCounter counter_; diff --git a/base/metrics/stats_table_unittest.cc b/base/metrics/stats_table_unittest.cc index 501cbc7..45b0a43 100644 --- a/base/metrics/stats_table_unittest.cc +++ b/base/metrics/stats_table_unittest.cc @@ -70,7 +70,7 @@ class StatsTableThread : public SimpleThread { : SimpleThread(name), id_(id) {} - virtual void Run() override; + void Run() override; private: int id_; diff --git a/base/observer_list_unittest.cc b/base/observer_list_unittest.cc index 3df8db0..11f59be 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_; diff --git a/base/posix/file_descriptor_shuffle.h b/base/posix/file_descriptor_shuffle.h index 875fdf5..78e3a7d 100644 --- a/base/posix/file_descriptor_shuffle.h +++ b/base/posix/file_descriptor_shuffle.h @@ -48,9 +48,9 @@ class InjectionDelegate { // An implementation of the InjectionDelegate interface using the file // descriptor table of the current process as the domain. class BASE_EXPORT FileDescriptorTableInjection : public InjectionDelegate { - virtual bool Duplicate(int* result, int fd) override; - virtual bool Move(int src, int dest) override; - virtual void Close(int fd) override; + bool Duplicate(int* result, int fd) override; + bool Move(int src, int dest) override; + void Close(int fd) override; }; // A single arc of the directed graph which describes an injective multimapping. diff --git a/base/posix/file_descriptor_shuffle_unittest.cc b/base/posix/file_descriptor_shuffle_unittest.cc index b12c909..3dfbf7e 100644 --- a/base/posix/file_descriptor_shuffle_unittest.cc +++ b/base/posix/file_descriptor_shuffle_unittest.cc @@ -44,20 +44,18 @@ class InjectionTracer : public InjectionDelegate { : next_duplicate_(kDuplicateBase) { } - virtual bool Duplicate(int* result, int fd) override { + bool Duplicate(int* result, int fd) override { *result = next_duplicate_++; actions_.push_back(Action(Action::DUPLICATE, *result, fd)); return true; } - virtual bool Move(int src, int dest) override { + bool Move(int src, int dest) override { actions_.push_back(Action(Action::MOVE, src, dest)); return true; } - virtual void Close(int fd) override { - actions_.push_back(Action(Action::CLOSE, fd)); - } + void Close(int fd) override { actions_.push_back(Action(Action::CLOSE, fd)); } const std::vector<Action>& actions() const { return actions_; } @@ -250,15 +248,11 @@ TEST(FileDescriptorShuffleTest, FanoutAndClose3) { class FailingDelegate : public InjectionDelegate { public: - virtual bool Duplicate(int* result, int fd) override { - return false; - } + bool Duplicate(int* result, int fd) override { return false; } - virtual bool Move(int src, int dest) override { - return false; - } + bool Move(int src, int dest) override { return false; } - virtual void Close(int fd) override {} + void Close(int fd) override {} }; TEST(FileDescriptorShuffleTest, EmptyWithFailure) { diff --git a/base/power_monitor/power_monitor_device_source.h b/base/power_monitor/power_monitor_device_source.h index 3d264b4..29f17c2 100644 --- a/base/power_monitor/power_monitor_device_source.h +++ b/base/power_monitor/power_monitor_device_source.h @@ -37,7 +37,7 @@ namespace base { class BASE_EXPORT PowerMonitorDeviceSource : public PowerMonitorSource { public: PowerMonitorDeviceSource(); - virtual ~PowerMonitorDeviceSource(); + ~PowerMonitorDeviceSource() override; #if defined(OS_MACOSX) // Allocate system resources needed by the PowerMonitor class. @@ -90,7 +90,7 @@ class BASE_EXPORT PowerMonitorDeviceSource : public PowerMonitorSource { // Platform-specific method to check whether the system is currently // running on battery power. Returns true if running on batteries, // false otherwise. - virtual bool IsOnBatteryPowerImpl() override; + bool IsOnBatteryPowerImpl() override; // Checks the battery status and notifies observers if the battery // status has changed. diff --git a/base/prefs/default_pref_store.h b/base/prefs/default_pref_store.h index 9939876..26462da 100644 --- a/base/prefs/default_pref_store.h +++ b/base/prefs/default_pref_store.h @@ -21,11 +21,11 @@ class BASE_PREFS_EXPORT DefaultPrefStore : public PrefStore { DefaultPrefStore(); // PrefStore implementation: - virtual bool GetValue(const std::string& key, - const base::Value** result) const override; - virtual void AddObserver(PrefStore::Observer* observer) override; - virtual void RemoveObserver(PrefStore::Observer* observer) override; - virtual bool HasObservers() const override; + bool GetValue(const std::string& key, + const base::Value** result) const override; + void AddObserver(PrefStore::Observer* observer) override; + void RemoveObserver(PrefStore::Observer* observer) override; + bool HasObservers() const override; // Sets a |value| for |key|. Should only be called if a value has not been // set yet; otherwise call ReplaceDefaultValue(). @@ -40,7 +40,7 @@ class BASE_PREFS_EXPORT DefaultPrefStore : public PrefStore { const_iterator end() const; private: - virtual ~DefaultPrefStore(); + ~DefaultPrefStore() override; PrefValueMap prefs_; diff --git a/base/prefs/default_pref_store_unittest.cc b/base/prefs/default_pref_store_unittest.cc index 3f28132..9299937 100644 --- a/base/prefs/default_pref_store_unittest.cc +++ b/base/prefs/default_pref_store_unittest.cc @@ -13,15 +13,15 @@ namespace { class MockPrefStoreObserver : public PrefStore::Observer { public: explicit MockPrefStoreObserver(DefaultPrefStore* pref_store); - virtual ~MockPrefStoreObserver(); + ~MockPrefStoreObserver() override; int change_count() { return change_count_; } // PrefStore::Observer implementation: - virtual void OnPrefValueChanged(const std::string& key) override; - virtual void OnInitializationCompleted(bool succeeded) override {} + void OnPrefValueChanged(const std::string& key) override; + void OnInitializationCompleted(bool succeeded) override {} private: DefaultPrefStore* pref_store_; diff --git a/base/prefs/json_pref_store.h b/base/prefs/json_pref_store.h index b6d0b19..16e431b 100644 --- a/base/prefs/json_pref_store.h +++ b/base/prefs/json_pref_store.h @@ -66,29 +66,27 @@ class BASE_PREFS_EXPORT JsonPrefStore scoped_ptr<PrefFilter> pref_filter); // PrefStore overrides: - virtual bool GetValue(const std::string& key, - const base::Value** result) const override; - virtual void AddObserver(PrefStore::Observer* observer) override; - virtual void RemoveObserver(PrefStore::Observer* observer) override; - virtual bool HasObservers() const override; - virtual bool IsInitializationComplete() const override; + bool GetValue(const std::string& key, + const base::Value** result) const override; + void AddObserver(PrefStore::Observer* observer) override; + void RemoveObserver(PrefStore::Observer* observer) override; + bool HasObservers() const override; + bool IsInitializationComplete() const override; // PersistentPrefStore overrides: - virtual bool GetMutableValue(const std::string& key, - base::Value** result) override; - virtual void SetValue(const std::string& key, base::Value* value) override; - virtual void SetValueSilently(const std::string& key, - base::Value* value) override; - virtual void RemoveValue(const std::string& key) override; - virtual bool ReadOnly() const override; - virtual PrefReadError GetReadError() const override; + bool GetMutableValue(const std::string& key, base::Value** result) override; + void SetValue(const std::string& key, base::Value* value) override; + void SetValueSilently(const std::string& key, base::Value* value) override; + void RemoveValue(const std::string& key) override; + bool ReadOnly() const override; + PrefReadError GetReadError() const override; // Note this method may be asynchronous if this instance has a |pref_filter_| // in which case it will return PREF_READ_ERROR_ASYNCHRONOUS_TASK_INCOMPLETE. // See details in pref_filter.h. - virtual PrefReadError ReadPrefs() override; - virtual void ReadPrefsAsync(ReadErrorDelegate* error_delegate) override; - virtual void CommitPendingWrite() override; - virtual void ReportValueChanged(const std::string& key) override; + PrefReadError ReadPrefs() override; + void ReadPrefsAsync(ReadErrorDelegate* error_delegate) override; + void CommitPendingWrite() override; + void ReportValueChanged(const std::string& key) override; // Just like RemoveValue(), but doesn't notify observers. Used when doing some // cleanup that shouldn't otherwise alert observers. @@ -100,7 +98,7 @@ class BASE_PREFS_EXPORT JsonPrefStore const base::Closure& on_next_successful_write); private: - virtual ~JsonPrefStore(); + ~JsonPrefStore() override; // This method is called after the JSON file has been read. It then hands // |value| (or an empty dictionary in some read error cases) to the @@ -111,7 +109,7 @@ class BASE_PREFS_EXPORT JsonPrefStore void OnFileRead(scoped_ptr<ReadResult> read_result); // ImportantFileWriter::DataSerializer overrides: - virtual bool SerializeData(std::string* output) override; + bool SerializeData(std::string* output) override; // This method is called after the JSON file has been read and the result has // potentially been intercepted and modified by |pref_filter_|. diff --git a/base/prefs/json_pref_store_unittest.cc b/base/prefs/json_pref_store_unittest.cc index 45bf895..dc4043e 100644 --- a/base/prefs/json_pref_store_unittest.cc +++ b/base/prefs/json_pref_store_unittest.cc @@ -32,14 +32,14 @@ const char kHomePage[] = "homepage"; class InterceptingPrefFilter : public PrefFilter { public: InterceptingPrefFilter(); - virtual ~InterceptingPrefFilter(); + ~InterceptingPrefFilter() override; // PrefFilter implementation: - virtual void FilterOnLoad( + void FilterOnLoad( const PostFilterOnLoadCallback& post_filter_on_load_callback, scoped_ptr<base::DictionaryValue> pref_store_contents) override; - virtual void FilterUpdate(const std::string& path) override {} - virtual void FilterSerializeData( + void FilterUpdate(const std::string& path) override {} + void FilterSerializeData( base::DictionaryValue* pref_store_contents) override {} bool has_intercepted_prefs() const { return intercepted_prefs_ != NULL; } diff --git a/base/prefs/overlay_user_pref_store.h b/base/prefs/overlay_user_pref_store.h index 0e78230..5194a7b 100644 --- a/base/prefs/overlay_user_pref_store.h +++ b/base/prefs/overlay_user_pref_store.h @@ -30,37 +30,35 @@ class BASE_PREFS_EXPORT OverlayUserPrefStore : public PersistentPrefStore, virtual bool IsSetInOverlay(const std::string& key) const; // Methods of PrefStore. - virtual void AddObserver(PrefStore::Observer* observer) override; - virtual void RemoveObserver(PrefStore::Observer* observer) override; - virtual bool HasObservers() const override; - virtual bool IsInitializationComplete() const override; - virtual bool GetValue(const std::string& key, - const base::Value** result) const override; + void AddObserver(PrefStore::Observer* observer) override; + void RemoveObserver(PrefStore::Observer* observer) override; + bool HasObservers() const override; + bool IsInitializationComplete() const override; + bool GetValue(const std::string& key, + const base::Value** result) const override; // Methods of PersistentPrefStore. - virtual bool GetMutableValue(const std::string& key, - base::Value** result) override; - virtual void SetValue(const std::string& key, base::Value* value) override; - virtual void SetValueSilently(const std::string& key, - base::Value* value) override; - virtual void RemoveValue(const std::string& key) override; - virtual bool ReadOnly() const override; - virtual PrefReadError GetReadError() const override; - virtual PrefReadError ReadPrefs() override; - virtual void ReadPrefsAsync(ReadErrorDelegate* delegate) override; - virtual void CommitPendingWrite() override; - virtual void ReportValueChanged(const std::string& key) override; + bool GetMutableValue(const std::string& key, base::Value** result) override; + void SetValue(const std::string& key, base::Value* value) override; + void SetValueSilently(const std::string& key, base::Value* value) override; + void RemoveValue(const std::string& key) override; + bool ReadOnly() const override; + PrefReadError GetReadError() const override; + PrefReadError ReadPrefs() override; + void ReadPrefsAsync(ReadErrorDelegate* delegate) override; + void CommitPendingWrite() override; + void ReportValueChanged(const std::string& key) override; // Methods of PrefStore::Observer. - virtual void OnPrefValueChanged(const std::string& key) override; - virtual void OnInitializationCompleted(bool succeeded) override; + void OnPrefValueChanged(const std::string& key) override; + void OnInitializationCompleted(bool succeeded) override; void RegisterOverlayPref(const std::string& key); void RegisterOverlayPref(const std::string& overlay_key, const std::string& underlay_key); protected: - virtual ~OverlayUserPrefStore(); + ~OverlayUserPrefStore() override; private: typedef std::map<std::string, std::string> NamesMap; diff --git a/base/prefs/persistent_pref_store.h b/base/prefs/persistent_pref_store.h index 093ea8d5..e70e2a6 100644 --- a/base/prefs/persistent_pref_store.h +++ b/base/prefs/persistent_pref_store.h @@ -68,7 +68,7 @@ class BASE_PREFS_EXPORT PersistentPrefStore : public WriteablePrefStore { virtual void CommitPendingWrite() = 0; protected: - virtual ~PersistentPrefStore() {} + ~PersistentPrefStore() override {} }; #endif // BASE_PREFS_PERSISTENT_PREF_STORE_H_ diff --git a/base/prefs/pref_change_registrar.h b/base/prefs/pref_change_registrar.h index 693d3e7..70c22fe 100644 --- a/base/prefs/pref_change_registrar.h +++ b/base/prefs/pref_change_registrar.h @@ -64,8 +64,8 @@ class BASE_PREFS_EXPORT PrefChangeRegistrar : public PrefObserver { private: // PrefObserver: - virtual void OnPreferenceChanged(PrefService* service, - const std::string& pref_name) override; + void OnPreferenceChanged(PrefService* service, + const std::string& pref_name) override; static void InvokeUnnamedCallback(const base::Closure& callback, const std::string& pref_name); diff --git a/base/prefs/pref_member.h b/base/prefs/pref_member.h index fc27793..a05d60e 100644 --- a/base/prefs/pref_member.h +++ b/base/prefs/pref_member.h @@ -116,8 +116,8 @@ class BASE_PREFS_EXPORT PrefMemberBase : public PrefObserver { const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); // PrefObserver - virtual void OnPreferenceChanged(PrefService* service, - const std::string& pref_name) override; + void OnPreferenceChanged(PrefService* service, + const std::string& pref_name) override; void VerifyValuePrefName() const { DCHECK(!pref_name_.empty()); diff --git a/base/prefs/pref_notifier_impl.h b/base/prefs/pref_notifier_impl.h index 1aa243f..3f4c254 100644 --- a/base/prefs/pref_notifier_impl.h +++ b/base/prefs/pref_notifier_impl.h @@ -25,7 +25,7 @@ class BASE_PREFS_EXPORT PrefNotifierImpl public: PrefNotifierImpl(); explicit PrefNotifierImpl(PrefService* pref_service); - virtual ~PrefNotifierImpl(); + ~PrefNotifierImpl() override; // If the pref at the given path changes, we call the observer's // OnPreferenceChanged method. @@ -41,8 +41,8 @@ class BASE_PREFS_EXPORT PrefNotifierImpl protected: // PrefNotifier overrides. - virtual void OnPreferenceChanged(const std::string& pref_name) override; - virtual void OnInitializationCompleted(bool succeeded) override; + void OnPreferenceChanged(const std::string& pref_name) override; + void OnInitializationCompleted(bool succeeded) override; // A map from pref names to a list of observers. Observers get fired in the // order they are added. These should only be accessed externally for unit diff --git a/base/prefs/pref_registry_simple.h b/base/prefs/pref_registry_simple.h index 50b6467..41fe590 100644 --- a/base/prefs/pref_registry_simple.h +++ b/base/prefs/pref_registry_simple.h @@ -36,7 +36,7 @@ class BASE_PREFS_EXPORT PrefRegistrySimple : public PrefRegistry { int64 default_value); private: - virtual ~PrefRegistrySimple(); + ~PrefRegistrySimple() override; DISALLOW_COPY_AND_ASSIGN(PrefRegistrySimple); }; diff --git a/base/prefs/pref_service.cc b/base/prefs/pref_service.cc index bc86ac1..433f814 100644 --- a/base/prefs/pref_service.cc +++ b/base/prefs/pref_service.cc @@ -28,7 +28,7 @@ class ReadErrorHandler : public PersistentPrefStore::ReadErrorDelegate { ReadErrorHandler(base::Callback<void(PersistentPrefStore::PrefReadError)> cb) : callback_(cb) {} - virtual void OnError(PersistentPrefStore::PrefReadError error) override { + void OnError(PersistentPrefStore::PrefReadError error) override { callback_.Run(error); } diff --git a/base/prefs/pref_store_observer_mock.h b/base/prefs/pref_store_observer_mock.h index de7cc9d..1b24b4e 100644 --- a/base/prefs/pref_store_observer_mock.h +++ b/base/prefs/pref_store_observer_mock.h @@ -16,13 +16,13 @@ class PrefStoreObserverMock : public PrefStore::Observer { public: PrefStoreObserverMock(); - virtual ~PrefStoreObserverMock(); + ~PrefStoreObserverMock() override; void VerifyAndResetChangedKey(const std::string& expected); // PrefStore::Observer implementation - virtual void OnPrefValueChanged(const std::string& key) override; - virtual void OnInitializationCompleted(bool success) override; + void OnPrefValueChanged(const std::string& key) override; + void OnInitializationCompleted(bool success) override; std::vector<std::string> changed_keys; bool initialized; diff --git a/base/prefs/pref_value_store.h b/base/prefs/pref_value_store.h index a0409ef..db82a82 100644 --- a/base/prefs/pref_value_store.h +++ b/base/prefs/pref_value_store.h @@ -149,7 +149,7 @@ class BASE_PREFS_EXPORT PrefValueStore { class PrefStoreKeeper : public PrefStore::Observer { public: PrefStoreKeeper(); - virtual ~PrefStoreKeeper(); + ~PrefStoreKeeper() override; // Takes ownership of |pref_store|. void Initialize(PrefValueStore* store, @@ -161,8 +161,8 @@ class BASE_PREFS_EXPORT PrefValueStore { private: // PrefStore::Observer implementation. - virtual void OnPrefValueChanged(const std::string& key) override; - virtual void OnInitializationCompleted(bool succeeded) override; + void OnPrefValueChanged(const std::string& key) override; + void OnInitializationCompleted(bool succeeded) override; // PrefValueStore this keeper is part of. PrefValueStore* pref_value_store_; diff --git a/base/prefs/testing_pref_service.h b/base/prefs/testing_pref_service.h index a9ab937..2f6d494 100644 --- a/base/prefs/testing_pref_service.h +++ b/base/prefs/testing_pref_service.h @@ -84,7 +84,7 @@ class TestingPrefServiceSimple : public TestingPrefServiceBase<PrefService, PrefRegistry> { public: TestingPrefServiceSimple(); - virtual ~TestingPrefServiceSimple(); + ~TestingPrefServiceSimple() override; // This is provided as a convenience for registering preferences on // an existing TestingPrefServiceSimple instance. On a production diff --git a/base/prefs/testing_pref_store.h b/base/prefs/testing_pref_store.h index aa2bd80..866b4ae 100644 --- a/base/prefs/testing_pref_store.h +++ b/base/prefs/testing_pref_store.h @@ -21,26 +21,24 @@ class TestingPrefStore : public PersistentPrefStore { TestingPrefStore(); // Overriden from PrefStore. - virtual bool GetValue(const std::string& key, - const base::Value** result) const override; - virtual void AddObserver(PrefStore::Observer* observer) override; - virtual void RemoveObserver(PrefStore::Observer* observer) override; - virtual bool HasObservers() const override; - virtual bool IsInitializationComplete() const override; + bool GetValue(const std::string& key, + const base::Value** result) const override; + void AddObserver(PrefStore::Observer* observer) override; + void RemoveObserver(PrefStore::Observer* observer) override; + bool HasObservers() const override; + bool IsInitializationComplete() const override; // PersistentPrefStore overrides: - virtual bool GetMutableValue(const std::string& key, - base::Value** result) override; - virtual void ReportValueChanged(const std::string& key) override; - virtual void SetValue(const std::string& key, base::Value* value) override; - virtual void SetValueSilently(const std::string& key, - base::Value* value) override; - virtual void RemoveValue(const std::string& key) override; - virtual bool ReadOnly() const override; - virtual PrefReadError GetReadError() const override; - virtual PersistentPrefStore::PrefReadError ReadPrefs() override; - virtual void ReadPrefsAsync(ReadErrorDelegate* error_delegate) override; - virtual void CommitPendingWrite() override; + bool GetMutableValue(const std::string& key, base::Value** result) override; + void ReportValueChanged(const std::string& key) override; + void SetValue(const std::string& key, base::Value* value) override; + void SetValueSilently(const std::string& key, base::Value* value) override; + void RemoveValue(const std::string& key) override; + bool ReadOnly() const override; + PrefReadError GetReadError() const override; + PersistentPrefStore::PrefReadError ReadPrefs() override; + void ReadPrefsAsync(ReadErrorDelegate* error_delegate) override; + void CommitPendingWrite() override; // Marks the store as having completed initialization. void SetInitializationCompleted(); @@ -72,7 +70,7 @@ class TestingPrefStore : public PersistentPrefStore { bool committed() { return committed_; } protected: - virtual ~TestingPrefStore(); + ~TestingPrefStore() override; private: // Stores the preference values. diff --git a/base/prefs/value_map_pref_store.h b/base/prefs/value_map_pref_store.h index d90d0c0..8c515ed 100644 --- a/base/prefs/value_map_pref_store.h +++ b/base/prefs/value_map_pref_store.h @@ -21,23 +21,21 @@ class BASE_PREFS_EXPORT ValueMapPrefStore : public WriteablePrefStore { ValueMapPrefStore(); // PrefStore overrides: - virtual bool GetValue(const std::string& key, - const base::Value** value) const override; - virtual void AddObserver(PrefStore::Observer* observer) override; - virtual void RemoveObserver(PrefStore::Observer* observer) override; - virtual bool HasObservers() const override; + bool GetValue(const std::string& key, + const base::Value** value) const override; + void AddObserver(PrefStore::Observer* observer) override; + void RemoveObserver(PrefStore::Observer* observer) override; + bool HasObservers() const override; // WriteablePrefStore overrides: - virtual void SetValue(const std::string& key, base::Value* value) override; - virtual void RemoveValue(const std::string& key) override; - virtual bool GetMutableValue(const std::string& key, - base::Value** value) override; - virtual void ReportValueChanged(const std::string& key) override; - virtual void SetValueSilently(const std::string& key, - base::Value* value) override; + void SetValue(const std::string& key, base::Value* value) override; + void RemoveValue(const std::string& key) override; + bool GetMutableValue(const std::string& key, base::Value** value) override; + void ReportValueChanged(const std::string& key) override; + void SetValueSilently(const std::string& key, base::Value* value) override; protected: - virtual ~ValueMapPrefStore(); + ~ValueMapPrefStore() override; // Notify observers about the initialization completed event. void NotifyInitializationCompleted(); diff --git a/base/prefs/writeable_pref_store.h b/base/prefs/writeable_pref_store.h index d320dcf..5ebab64 100644 --- a/base/prefs/writeable_pref_store.h +++ b/base/prefs/writeable_pref_store.h @@ -43,7 +43,7 @@ class BASE_PREFS_EXPORT WriteablePrefStore : public PrefStore { virtual void SetValueSilently(const std::string& key, base::Value* value) = 0; protected: - virtual ~WriteablePrefStore() {} + ~WriteablePrefStore() override {} private: DISALLOW_COPY_AND_ASSIGN(WriteablePrefStore); diff --git a/base/process/process_iterator.h b/base/process/process_iterator.h index 185965a..bdd07c6 100644 --- a/base/process/process_iterator.h +++ b/base/process/process_iterator.h @@ -163,10 +163,10 @@ class BASE_EXPORT NamedProcessIterator : public ProcessIterator { public: NamedProcessIterator(const FilePath::StringType& executable_name, const ProcessFilter* filter); - virtual ~NamedProcessIterator(); + ~NamedProcessIterator() override; protected: - virtual bool IncludeEntry() override; + bool IncludeEntry() override; private: FilePath::StringType executable_name_; diff --git a/base/sequenced_task_runner.h b/base/sequenced_task_runner.h index f6ca646..71dcf05 100644 --- a/base/sequenced_task_runner.h +++ b/base/sequenced_task_runner.h @@ -139,7 +139,7 @@ class BASE_EXPORT SequencedTaskRunner : public TaskRunner { } protected: - virtual ~SequencedTaskRunner() {} + ~SequencedTaskRunner() override {} private: template <class T, class R> friend class subtle::DeleteHelperInternal; diff --git a/base/single_thread_task_runner.h b/base/single_thread_task_runner.h index e82941a..b5311db 100644 --- a/base/single_thread_task_runner.h +++ b/base/single_thread_task_runner.h @@ -29,7 +29,7 @@ class BASE_EXPORT SingleThreadTaskRunner : public SequencedTaskRunner { } protected: - virtual ~SingleThreadTaskRunner() {} + ~SingleThreadTaskRunner() override {} }; } // namespace base diff --git a/base/supports_user_data_unittest.cc b/base/supports_user_data_unittest.cc index f6afc37..faa8140 100644 --- a/base/supports_user_data_unittest.cc +++ b/base/supports_user_data_unittest.cc @@ -19,7 +19,7 @@ struct UsesItself : public SupportsUserData::Data { key_(key) { } - virtual ~UsesItself() { + ~UsesItself() override { EXPECT_EQ(NULL, supports_user_data_->GetUserData(key_)); } diff --git a/base/sync_socket.h b/base/sync_socket.h index b8d947e..4da9d3b 100644 --- a/base/sync_socket.h +++ b/base/sync_socket.h @@ -106,7 +106,7 @@ class BASE_EXPORT CancelableSyncSocket : public SyncSocket { public: CancelableSyncSocket(); explicit CancelableSyncSocket(Handle handle); - virtual ~CancelableSyncSocket() {} + ~CancelableSyncSocket() override {} // Initializes a pair of cancelable sockets. See documentation for // SyncSocket::CreatePair for more details. @@ -136,7 +136,7 @@ class BASE_EXPORT CancelableSyncSocket : public SyncSocket { // implementation of Send() will not block indefinitely as // SyncSocket::Send will, but instead return 0, as no bytes could be sent. // Note that the socket will not be closed in this case. - virtual size_t Send(const void* buffer, size_t length) override; + size_t Send(const void* buffer, size_t length) override; private: #if defined(OS_WIN) diff --git a/base/sync_socket_unittest.cc b/base/sync_socket_unittest.cc index ddd2fcc..7c8c97c 100644 --- a/base/sync_socket_unittest.cc +++ b/base/sync_socket_unittest.cc @@ -20,9 +20,9 @@ class HangingReceiveThread : public base::DelegateSimpleThread::Delegate { thread_.Start(); } - virtual ~HangingReceiveThread() {} + ~HangingReceiveThread() override {} - virtual void Run() override { + void Run() override { int data = 0; ASSERT_EQ(socket_->Peek(), 0u); diff --git a/base/synchronization/condition_variable_unittest.cc b/base/synchronization/condition_variable_unittest.cc index 4232734..5d7a0ab 100644 --- a/base/synchronization/condition_variable_unittest.cc +++ b/base/synchronization/condition_variable_unittest.cc @@ -64,10 +64,10 @@ class ConditionVariableTest : public PlatformTest { class WorkQueue : public PlatformThread::Delegate { public: explicit WorkQueue(int thread_count); - virtual ~WorkQueue(); + ~WorkQueue() override; // PlatformThread::Delegate interface. - virtual void ThreadMain() override; + void ThreadMain() override; //---------------------------------------------------------------------------- // Worker threads only call the following methods. diff --git a/base/synchronization/lock_unittest.cc b/base/synchronization/lock_unittest.cc index 60f4250..967efb8 100644 --- a/base/synchronization/lock_unittest.cc +++ b/base/synchronization/lock_unittest.cc @@ -18,7 +18,7 @@ class BasicLockTestThread : public PlatformThread::Delegate { public: explicit BasicLockTestThread(Lock* lock) : lock_(lock), acquired_(0) {} - virtual void ThreadMain() override { + void ThreadMain() override { for (int i = 0; i < 10; i++) { lock_->Acquire(); acquired_++; @@ -93,7 +93,7 @@ class TryLockTestThread : public PlatformThread::Delegate { public: explicit TryLockTestThread(Lock* lock) : lock_(lock), got_lock_(false) {} - virtual void ThreadMain() override { + void ThreadMain() override { got_lock_ = lock_->Try(); if (got_lock_) lock_->Release(); @@ -162,9 +162,7 @@ class MutexLockTestThread : public PlatformThread::Delegate { } } - virtual void ThreadMain() override { - DoStuff(lock_, value_); - } + void ThreadMain() override { DoStuff(lock_, value_); } private: Lock* lock_; diff --git a/base/synchronization/waitable_event_posix.cc b/base/synchronization/waitable_event_posix.cc index f34b2a4..696ffc7 100644 --- a/base/synchronization/waitable_event_posix.cc +++ b/base/synchronization/waitable_event_posix.cc @@ -91,7 +91,7 @@ class SyncWaiter : public WaitableEvent::Waiter { cv_(&lock_) { } - virtual bool Fire(WaitableEvent* signaling_event) override { + bool Fire(WaitableEvent* signaling_event) override { base::AutoLock locked(lock_); if (fired_) @@ -117,9 +117,7 @@ class SyncWaiter : public WaitableEvent::Waiter { // These waiters are always stack allocated and don't delete themselves. Thus // there's no problem and the ABA tag is the same as the object pointer. // --------------------------------------------------------------------------- - virtual bool Compare(void* tag) override { - return this == tag; - } + bool Compare(void* tag) override { return this == tag; } // --------------------------------------------------------------------------- // Called with lock held. diff --git a/base/synchronization/waitable_event_unittest.cc b/base/synchronization/waitable_event_unittest.cc index a8913fd..abba935 100644 --- a/base/synchronization/waitable_event_unittest.cc +++ b/base/synchronization/waitable_event_unittest.cc @@ -78,7 +78,7 @@ class WaitableEventSignaler : public PlatformThread::Delegate { ev_(ev) { } - virtual void ThreadMain() override { + void ThreadMain() override { PlatformThread::Sleep(TimeDelta::FromSecondsD(seconds_)); ev_->Signal(); } diff --git a/base/synchronization/waitable_event_watcher.h b/base/synchronization/waitable_event_watcher.h index 4d2f9b5..d4d8e77 100644 --- a/base/synchronization/waitable_event_watcher.h +++ b/base/synchronization/waitable_event_watcher.h @@ -67,7 +67,7 @@ class BASE_EXPORT WaitableEventWatcher public: typedef Callback<void(WaitableEvent*)> EventCallback; WaitableEventWatcher(); - virtual ~WaitableEventWatcher(); + ~WaitableEventWatcher() override; // When @event is signaled, the given callback is called on the thread of the // current message loop when StartWatching is called. @@ -96,7 +96,7 @@ class BASE_EXPORT WaitableEventWatcher win::ObjectWatcher watcher_; #else // Implementation of MessageLoop::DestructionObserver - virtual void WillDestroyCurrentMessageLoop() override; + void WillDestroyCurrentMessageLoop() override; MessageLoop* message_loop_; scoped_refptr<Flag> cancel_flag_; diff --git a/base/synchronization/waitable_event_watcher_posix.cc b/base/synchronization/waitable_event_watcher_posix.cc index e791871..6fc337c 100644 --- a/base/synchronization/waitable_event_watcher_posix.cc +++ b/base/synchronization/waitable_event_watcher_posix.cc @@ -65,7 +65,7 @@ class AsyncWaiter : public WaitableEvent::Waiter { callback_(callback), flag_(flag) { } - virtual bool Fire(WaitableEvent* event) override { + bool Fire(WaitableEvent* event) override { // Post the callback if we haven't been cancelled. if (!flag_->value()) { message_loop_->PostTask(FROM_HERE, callback_); @@ -81,9 +81,7 @@ class AsyncWaiter : public WaitableEvent::Waiter { } // See StopWatching for discussion - virtual bool Compare(void* tag) override { - return tag == flag_.get(); - } + bool Compare(void* tag) override { return tag == flag_.get(); } private: MessageLoop *const message_loop_; diff --git a/base/task_runner.cc b/base/task_runner.cc index f2c64f3..262e1f8 100644 --- a/base/task_runner.cc +++ b/base/task_runner.cc @@ -20,8 +20,8 @@ class PostTaskAndReplyTaskRunner : public internal::PostTaskAndReplyImpl { explicit PostTaskAndReplyTaskRunner(TaskRunner* destination); private: - virtual bool PostTask(const tracked_objects::Location& from_here, - const Closure& task) override; + bool PostTask(const tracked_objects::Location& from_here, + const Closure& task) override; // Non-owning. TaskRunner* destination_; diff --git a/base/test/expectations/parser_unittest.cc b/base/test/expectations/parser_unittest.cc index d1d10a5..074d634 100644 --- a/base/test/expectations/parser_unittest.cc +++ b/base/test/expectations/parser_unittest.cc @@ -15,16 +15,16 @@ using test_expectations::Parser; class TestExpectationParserTest : public testing::Test, public Parser::Delegate { public: - virtual void EmitExpectation( + void EmitExpectation( const test_expectations::Expectation& expectation) override { expectations_.push_back(expectation); } - virtual void OnSyntaxError(const std::string& message) override { + void OnSyntaxError(const std::string& message) override { syntax_error_ = message; } - virtual void OnDataError(const std::string& error) override { + void OnDataError(const std::string& error) override { data_errors_.push_back(error); } diff --git a/base/test/launcher/test_launcher.cc b/base/test/launcher/test_launcher.cc index eab51f4..c0ae6a9 100644 --- a/base/test/launcher/test_launcher.cc +++ b/base/test/launcher/test_launcher.cc @@ -142,7 +142,7 @@ class SignalFDWatcher : public MessageLoopForIO::Watcher { SignalFDWatcher() { } - virtual void OnFileCanReadWithoutBlocking(int fd) override { + void OnFileCanReadWithoutBlocking(int fd) override { fprintf(stdout, "\nCaught signal. Killing spawned test processes...\n"); fflush(stdout); @@ -152,9 +152,7 @@ class SignalFDWatcher : public MessageLoopForIO::Watcher { exit(1); } - virtual void OnFileCanWriteWithoutBlocking(int fd) override { - NOTREACHED(); - } + void OnFileCanWriteWithoutBlocking(int fd) override { NOTREACHED(); } private: DISALLOW_COPY_AND_ASSIGN(SignalFDWatcher); diff --git a/base/test/launcher/unit_test_launcher.cc b/base/test/launcher/unit_test_launcher.cc index d6aeef8..44846a1 100644 --- a/base/test/launcher/unit_test_launcher.cc +++ b/base/test/launcher/unit_test_launcher.cc @@ -107,7 +107,7 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate { use_job_objects_(use_job_objects) { } - virtual ~UnitTestLauncherDelegate() { + ~UnitTestLauncherDelegate() override { DCHECK(thread_checker_.CalledOnValidThread()); } @@ -118,16 +118,16 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate { FilePath output_file; }; - virtual bool ShouldRunTest(const testing::TestCase* test_case, - const testing::TestInfo* test_info) override { + bool ShouldRunTest(const testing::TestCase* test_case, + const testing::TestInfo* test_info) override { DCHECK(thread_checker_.CalledOnValidThread()); // There is no additional logic to disable specific tests. return true; } - virtual size_t RunTests(TestLauncher* test_launcher, - const std::vector<std::string>& test_names) override { + size_t RunTests(TestLauncher* test_launcher, + const std::vector<std::string>& test_names) override { DCHECK(thread_checker_.CalledOnValidThread()); std::vector<std::string> batch; @@ -145,9 +145,8 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate { return test_names.size(); } - virtual size_t RetryTests( - TestLauncher* test_launcher, - const std::vector<std::string>& test_names) override { + size_t RetryTests(TestLauncher* test_launcher, + const std::vector<std::string>& test_names) override { MessageLoop::current()->PostTask( FROM_HERE, Bind(&UnitTestLauncherDelegate::RunSerially, diff --git a/base/test/null_task_runner.h b/base/test/null_task_runner.h index 9515733..2cde880 100644 --- a/base/test/null_task_runner.h +++ b/base/test/null_task_runner.h @@ -15,18 +15,17 @@ class NullTaskRunner : public base::SingleThreadTaskRunner { public: NullTaskRunner(); - virtual bool PostDelayedTask(const tracked_objects::Location& from_here, - const base::Closure& task, - base::TimeDelta delay) override; - virtual bool PostNonNestableDelayedTask( - const tracked_objects::Location& from_here, - const base::Closure& task, - base::TimeDelta delay) override; + bool PostDelayedTask(const tracked_objects::Location& from_here, + const base::Closure& task, + base::TimeDelta delay) override; + bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, + const base::Closure& task, + base::TimeDelta delay) override; // Always returns true to avoid triggering DCHECKs. - virtual bool RunsTasksOnCurrentThread() const override; + bool RunsTasksOnCurrentThread() const override; protected: - virtual ~NullTaskRunner(); + ~NullTaskRunner() override; DISALLOW_COPY_AND_ASSIGN(NullTaskRunner); }; diff --git a/base/test/perf_test_suite.h b/base/test/perf_test_suite.h index df8162b..52528f0 100644 --- a/base/test/perf_test_suite.h +++ b/base/test/perf_test_suite.h @@ -13,8 +13,8 @@ class PerfTestSuite : public TestSuite { public: PerfTestSuite(int argc, char** argv); - virtual void Initialize() override; - virtual void Shutdown() override; + void Initialize() override; + void Shutdown() override; }; } // namespace base diff --git a/base/test/power_monitor_test_base.h b/base/test/power_monitor_test_base.h index 4aaafb9..4655eae 100644 --- a/base/test/power_monitor_test_base.h +++ b/base/test/power_monitor_test_base.h @@ -14,14 +14,14 @@ namespace base { class PowerMonitorTestSource : public PowerMonitorSource { public: PowerMonitorTestSource(); - virtual ~PowerMonitorTestSource(); + ~PowerMonitorTestSource() override; void GeneratePowerStateEvent(bool on_battery_power); void GenerateSuspendEvent(); void GenerateResumeEvent(); protected: - virtual bool IsOnBatteryPowerImpl() override; + bool IsOnBatteryPowerImpl() override; bool test_on_battery_power_; MessageLoop message_loop_; @@ -30,12 +30,12 @@ class PowerMonitorTestSource : public PowerMonitorSource { class PowerMonitorTestObserver : public PowerObserver { public: PowerMonitorTestObserver(); - virtual ~PowerMonitorTestObserver(); + ~PowerMonitorTestObserver() override; // PowerObserver callbacks. - virtual void OnPowerStateChange(bool on_battery_power) override; - virtual void OnSuspend() override; - virtual void OnResume() override; + void OnPowerStateChange(bool on_battery_power) override; + void OnSuspend() override; + void OnResume() override; // Test status counts. bool last_power_state() { return last_power_state_; } diff --git a/base/test/sequenced_worker_pool_owner.h b/base/test/sequenced_worker_pool_owner.h index f6f0bb2..b52dd67 100644 --- a/base/test/sequenced_worker_pool_owner.h +++ b/base/test/sequenced_worker_pool_owner.h @@ -30,7 +30,7 @@ class SequencedWorkerPoolOwner : public SequencedWorkerPool::TestingObserver { SequencedWorkerPoolOwner(size_t max_threads, const std::string& thread_name_prefix); - virtual ~SequencedWorkerPoolOwner(); + ~SequencedWorkerPoolOwner() override; // Don't change the returned pool's testing observer. const scoped_refptr<SequencedWorkerPool>& pool(); @@ -42,9 +42,9 @@ class SequencedWorkerPoolOwner : public SequencedWorkerPool::TestingObserver { private: // SequencedWorkerPool::TestingObserver implementation. - virtual void OnHasWork() override; - virtual void WillWaitForShutdown() override; - virtual void OnDestruct() override; + void OnHasWork() override; + void WillWaitForShutdown() override; + void OnDestruct() override; MessageLoop* const constructor_message_loop_; scoped_refptr<SequencedWorkerPool> pool_; diff --git a/base/test/simple_test_clock.h b/base/test/simple_test_clock.h index a49cc53..e8a79c5 100644 --- a/base/test/simple_test_clock.h +++ b/base/test/simple_test_clock.h @@ -19,9 +19,9 @@ class SimpleTestClock : public Clock { public: // Starts off with a clock set to Time(). SimpleTestClock(); - virtual ~SimpleTestClock(); + ~SimpleTestClock() override; - virtual Time Now() override; + Time Now() override; // Advances the clock by |delta|. void Advance(TimeDelta delta); diff --git a/base/test/simple_test_tick_clock.h b/base/test/simple_test_tick_clock.h index c67eb55..a637543 100644 --- a/base/test/simple_test_tick_clock.h +++ b/base/test/simple_test_tick_clock.h @@ -19,9 +19,9 @@ class SimpleTestTickClock : public TickClock { public: // Starts off with a clock set to TimeTicks(). SimpleTestTickClock(); - virtual ~SimpleTestTickClock(); + ~SimpleTestTickClock() override; - virtual TimeTicks NowTicks() override; + TimeTicks NowTicks() override; // Advances the clock by |delta|, which must not be negative. void Advance(TimeDelta delta); diff --git a/base/test/test_simple_task_runner.h b/base/test/test_simple_task_runner.h index 56a1894..7481b6d 100644 --- a/base/test/test_simple_task_runner.h +++ b/base/test/test_simple_task_runner.h @@ -47,15 +47,14 @@ class TestSimpleTaskRunner : public SingleThreadTaskRunner { TestSimpleTaskRunner(); // SingleThreadTaskRunner implementation. - virtual bool PostDelayedTask(const tracked_objects::Location& from_here, - const Closure& task, - TimeDelta delay) override; - virtual bool PostNonNestableDelayedTask( - const tracked_objects::Location& from_here, - const Closure& task, - TimeDelta delay) override; + bool PostDelayedTask(const tracked_objects::Location& from_here, + const Closure& task, + TimeDelta delay) override; + bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, + const Closure& task, + TimeDelta delay) override; - virtual bool RunsTasksOnCurrentThread() const override; + bool RunsTasksOnCurrentThread() const override; const std::deque<TestPendingTask>& GetPendingTasks() const; bool HasPendingTask() const; @@ -72,7 +71,7 @@ class TestSimpleTaskRunner : public SingleThreadTaskRunner { void RunUntilIdle(); protected: - virtual ~TestSimpleTaskRunner(); + ~TestSimpleTaskRunner() override; std::deque<TestPendingTask> pending_tasks_; ThreadChecker thread_checker_; diff --git a/base/threading/non_thread_safe_unittest.cc b/base/threading/non_thread_safe_unittest.cc index 2bd7629..955c939 100644 --- a/base/threading/non_thread_safe_unittest.cc +++ b/base/threading/non_thread_safe_unittest.cc @@ -52,9 +52,7 @@ class CallDoStuffOnThread : public SimpleThread { non_thread_safe_class_(non_thread_safe_class) { } - virtual void Run() override { - non_thread_safe_class_->DoStuff(); - } + void Run() override { non_thread_safe_class_->DoStuff(); } private: NonThreadSafeClass* non_thread_safe_class_; @@ -71,9 +69,7 @@ class DeleteNonThreadSafeClassOnThread : public SimpleThread { non_thread_safe_class_(non_thread_safe_class) { } - virtual void Run() override { - non_thread_safe_class_.reset(); - } + void Run() override { non_thread_safe_class_.reset(); } private: scoped_ptr<NonThreadSafeClass> non_thread_safe_class_; diff --git a/base/threading/platform_thread_unittest.cc b/base/threading/platform_thread_unittest.cc index 6859692..21260e5 100644 --- a/base/threading/platform_thread_unittest.cc +++ b/base/threading/platform_thread_unittest.cc @@ -15,9 +15,7 @@ class TrivialThread : public PlatformThread::Delegate { public: TrivialThread() : did_run_(false) {} - virtual void ThreadMain() override { - did_run_ = true; - } + void ThreadMain() override { did_run_ = true; } bool did_run() const { return did_run_; } @@ -57,7 +55,7 @@ class FunctionTestThread : public TrivialThread { public: FunctionTestThread() : thread_id_(0) {} - virtual void ThreadMain() override { + void ThreadMain() override { thread_id_ = PlatformThread::CurrentId(); PlatformThread::YieldCurrentThread(); PlatformThread::Sleep(TimeDelta::FromMilliseconds(50)); diff --git a/base/threading/sequenced_worker_pool.cc b/base/threading/sequenced_worker_pool.cc index b0256c3..08ef5f0 100644 --- a/base/threading/sequenced_worker_pool.cc +++ b/base/threading/sequenced_worker_pool.cc @@ -98,13 +98,13 @@ class SequencedWorkerPoolTaskRunner : public TaskRunner { SequencedWorkerPool::WorkerShutdown shutdown_behavior); // TaskRunner implementation - virtual bool PostDelayedTask(const tracked_objects::Location& from_here, - const Closure& task, - TimeDelta delay) override; - virtual bool RunsTasksOnCurrentThread() const override; + bool PostDelayedTask(const tracked_objects::Location& from_here, + const Closure& task, + TimeDelta delay) override; + bool RunsTasksOnCurrentThread() const override; private: - virtual ~SequencedWorkerPoolTaskRunner(); + ~SequencedWorkerPoolTaskRunner() override; const scoped_refptr<SequencedWorkerPool> pool_; @@ -151,19 +151,18 @@ class SequencedWorkerPoolSequencedTaskRunner : public SequencedTaskRunner { SequencedWorkerPool::WorkerShutdown shutdown_behavior); // TaskRunner implementation - virtual bool PostDelayedTask(const tracked_objects::Location& from_here, - const Closure& task, - TimeDelta delay) override; - virtual bool RunsTasksOnCurrentThread() const override; + bool PostDelayedTask(const tracked_objects::Location& from_here, + const Closure& task, + TimeDelta delay) override; + bool RunsTasksOnCurrentThread() const override; // SequencedTaskRunner implementation - virtual bool PostNonNestableDelayedTask( - const tracked_objects::Location& from_here, - const Closure& task, - TimeDelta delay) override; + bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, + const Closure& task, + TimeDelta delay) override; private: - virtual ~SequencedWorkerPoolSequencedTaskRunner(); + ~SequencedWorkerPoolSequencedTaskRunner() override; const scoped_refptr<SequencedWorkerPool> pool_; @@ -235,10 +234,10 @@ class SequencedWorkerPool::Worker : public SimpleThread { Worker(const scoped_refptr<SequencedWorkerPool>& worker_pool, int thread_number, const std::string& thread_name_prefix); - virtual ~Worker(); + ~Worker() override; // SimpleThread implementation. This actually runs the background thread. - virtual void Run() override; + void Run() override; void set_running_task_info(SequenceToken token, WorkerShutdown shutdown_behavior) { diff --git a/base/threading/sequenced_worker_pool.h b/base/threading/sequenced_worker_pool.h index 4b1c749..63c6204 100644 --- a/base/threading/sequenced_worker_pool.h +++ b/base/threading/sequenced_worker_pool.h @@ -290,10 +290,10 @@ class BASE_EXPORT SequencedWorkerPool : public TaskRunner { WorkerShutdown shutdown_behavior); // TaskRunner implementation. Forwards to PostDelayedWorkerTask(). - virtual bool PostDelayedTask(const tracked_objects::Location& from_here, - const Closure& task, - TimeDelta delay) override; - virtual bool RunsTasksOnCurrentThread() const override; + bool PostDelayedTask(const tracked_objects::Location& from_here, + const Closure& task, + TimeDelta delay) override; + bool RunsTasksOnCurrentThread() const override; // Returns true if the current thread is processing a task with the given // sequence_token. @@ -336,9 +336,9 @@ class BASE_EXPORT SequencedWorkerPool : public TaskRunner { bool IsShutdownInProgress(); protected: - virtual ~SequencedWorkerPool(); + ~SequencedWorkerPool() override; - virtual void OnDestruct() const override; + void OnDestruct() const override; private: friend class RefCountedThreadSafe<SequencedWorkerPool>; diff --git a/base/threading/simple_thread.h b/base/threading/simple_thread.h index e734c29..ecd3604 100644 --- a/base/threading/simple_thread.h +++ b/base/threading/simple_thread.h @@ -78,7 +78,7 @@ class BASE_EXPORT SimpleThread : public PlatformThread::Delegate { explicit SimpleThread(const std::string& name_prefix); SimpleThread(const std::string& name_prefix, const Options& options); - virtual ~SimpleThread(); + ~SimpleThread() override; virtual void Start(); virtual void Join(); @@ -102,7 +102,7 @@ class BASE_EXPORT SimpleThread : public PlatformThread::Delegate { bool HasBeenJoined() { return joined_; } // Overridden from PlatformThread::Delegate: - virtual void ThreadMain() override; + void ThreadMain() override; // Only set priorities with a careful understanding of the consequences. // This is meant for very limited use cases. @@ -135,8 +135,9 @@ class BASE_EXPORT DelegateSimpleThread : public SimpleThread { const std::string& name_prefix, const Options& options); - virtual ~DelegateSimpleThread(); - virtual void Run() override; + ~DelegateSimpleThread() override; + void Run() override; + private: Delegate* delegate_; }; @@ -156,7 +157,7 @@ class BASE_EXPORT DelegateSimpleThreadPool typedef DelegateSimpleThread::Delegate Delegate; DelegateSimpleThreadPool(const std::string& name_prefix, int num_threads); - virtual ~DelegateSimpleThreadPool(); + ~DelegateSimpleThreadPool() override; // Start up all of the underlying threads, and start processing work if we // have any. @@ -174,7 +175,7 @@ class BASE_EXPORT DelegateSimpleThreadPool } // We implement the Delegate interface, for running our internal threads. - virtual void Run() override; + void Run() override; private: const std::string name_prefix_; diff --git a/base/threading/simple_thread_unittest.cc b/base/threading/simple_thread_unittest.cc index 89ddeba..7229d36 100644 --- a/base/threading/simple_thread_unittest.cc +++ b/base/threading/simple_thread_unittest.cc @@ -15,11 +15,9 @@ namespace { class SetIntRunner : public DelegateSimpleThread::Delegate { public: SetIntRunner(int* ptr, int val) : ptr_(ptr), val_(val) { } - virtual ~SetIntRunner() { } + ~SetIntRunner() override {} - virtual void Run() override { - *ptr_ = val_; - } + void Run() override { *ptr_ = val_; } private: int* ptr_; @@ -29,9 +27,9 @@ class SetIntRunner : public DelegateSimpleThread::Delegate { class WaitEventRunner : public DelegateSimpleThread::Delegate { public: explicit WaitEventRunner(WaitableEvent* event) : event_(event) { } - virtual ~WaitEventRunner() { } + ~WaitEventRunner() override {} - virtual void Run() override { + void Run() override { EXPECT_FALSE(event_->IsSignaled()); event_->Signal(); EXPECT_TRUE(event_->IsSignaled()); @@ -43,9 +41,7 @@ class WaitEventRunner : public DelegateSimpleThread::Delegate { class SeqRunner : public DelegateSimpleThread::Delegate { public: explicit SeqRunner(AtomicSequenceNumber* seq) : seq_(seq) { } - virtual void Run() override { - seq_->GetNext(); - } + void Run() override { seq_->GetNext(); } private: AtomicSequenceNumber* seq_; @@ -60,7 +56,7 @@ class VerifyPoolRunner : public DelegateSimpleThread::Delegate { int total, WaitableEvent* event) : seq_(seq), total_(total), event_(event) { } - virtual void Run() override { + void Run() override { if (seq_->GetNext() == total_) { event_->Signal(); } else { diff --git a/base/threading/thread.h b/base/threading/thread.h index 464a965..5010f0e 100644 --- a/base/threading/thread.h +++ b/base/threading/thread.h @@ -72,7 +72,7 @@ class BASE_EXPORT Thread : PlatformThread::Delegate { // vtable, and the thread's ThreadMain calling the virtual method Run(). It // also ensures that the CleanUp() virtual method is called on the subclass // before it is destructed. - virtual ~Thread(); + ~Thread() override; #if defined(OS_WIN) // Causes the thread to initialize COM. This must be called before calling @@ -201,7 +201,7 @@ class BASE_EXPORT Thread : PlatformThread::Delegate { #endif // PlatformThread::Delegate methods: - virtual void ThreadMain() override; + void ThreadMain() override; #if defined(OS_WIN) // Whether this thread needs to initialize COM, and if so, in what mode. diff --git a/base/threading/thread_checker_unittest.cc b/base/threading/thread_checker_unittest.cc index 1084dd9..d42cbc2 100644 --- a/base/threading/thread_checker_unittest.cc +++ b/base/threading/thread_checker_unittest.cc @@ -52,9 +52,7 @@ class CallDoStuffOnThread : public base::SimpleThread { thread_checker_class_(thread_checker_class) { } - virtual void Run() override { - thread_checker_class_->DoStuff(); - } + void Run() override { thread_checker_class_->DoStuff(); } private: ThreadCheckerClass* thread_checker_class_; @@ -71,9 +69,7 @@ class DeleteThreadCheckerClassOnThread : public base::SimpleThread { thread_checker_class_(thread_checker_class) { } - virtual void Run() override { - thread_checker_class_.reset(); - } + void Run() override { thread_checker_class_.reset(); } private: scoped_ptr<ThreadCheckerClass> thread_checker_class_; diff --git a/base/threading/thread_collision_warner.h b/base/threading/thread_collision_warner.h index 0523c91..de4e9c3 100644 --- a/base/threading/thread_collision_warner.h +++ b/base/threading/thread_collision_warner.h @@ -138,8 +138,8 @@ struct BASE_EXPORT AsserterBase { }; struct BASE_EXPORT DCheckAsserter : public AsserterBase { - virtual ~DCheckAsserter() {} - virtual void warn() override; + ~DCheckAsserter() override {} + void warn() override; }; class BASE_EXPORT ThreadCollisionWarner { diff --git a/base/threading/thread_collision_warner_unittest.cc b/base/threading/thread_collision_warner_unittest.cc index c7c7d0a..26faff4 100644 --- a/base/threading/thread_collision_warner_unittest.cc +++ b/base/threading/thread_collision_warner_unittest.cc @@ -41,11 +41,9 @@ class AssertReporter : public base::AsserterBase { AssertReporter() : failed_(false) {} - virtual void warn() override { - failed_ = true; - } + void warn() override { failed_ = true; } - virtual ~AssertReporter() {} + ~AssertReporter() override {} bool fail_state() const { return failed_; } void reset() { failed_ = false; } @@ -151,7 +149,7 @@ TEST(ThreadCollisionTest, MTBookCriticalSectionTest) { explicit QueueUser(NonThreadSafeQueue& queue) : queue_(queue) {} - virtual void Run() override { + void Run() override { queue_.push(0); queue_.pop(); } @@ -209,7 +207,7 @@ TEST(ThreadCollisionTest, MTScopedBookCriticalSectionTest) { explicit QueueUser(NonThreadSafeQueue& queue) : queue_(queue) {} - virtual void Run() override { + void Run() override { queue_.push(0); queue_.pop(); } @@ -270,7 +268,7 @@ TEST(ThreadCollisionTest, MTSynchedScopedBookCriticalSectionTest) { : queue_(queue), lock_(lock) {} - virtual void Run() override { + void Run() override { { base::AutoLock auto_lock(lock_); queue_.push(0); @@ -344,7 +342,7 @@ TEST(ThreadCollisionTest, MTSynchedScopedRecursiveBookCriticalSectionTest) { : queue_(queue), lock_(lock) {} - virtual void Run() override { + void Run() override { { base::AutoLock auto_lock(lock_); queue_.push(0); diff --git a/base/threading/thread_local_storage_unittest.cc b/base/threading/thread_local_storage_unittest.cc index 321a058..b53f577 100644 --- a/base/threading/thread_local_storage_unittest.cc +++ b/base/threading/thread_local_storage_unittest.cc @@ -33,9 +33,9 @@ class ThreadLocalStorageRunner : public DelegateSimpleThread::Delegate { explicit ThreadLocalStorageRunner(int* tls_value_ptr) : tls_value_ptr_(tls_value_ptr) {} - virtual ~ThreadLocalStorageRunner() {} + ~ThreadLocalStorageRunner() override {} - virtual void Run() override { + void Run() override { *tls_value_ptr_ = kInitialTlsValue; tls_slot.Set(tls_value_ptr_); diff --git a/base/threading/thread_local_unittest.cc b/base/threading/thread_local_unittest.cc index 9d0a7c9e..8dc7cd2 100644 --- a/base/threading/thread_local_unittest.cc +++ b/base/threading/thread_local_unittest.cc @@ -20,7 +20,7 @@ class ThreadLocalTesterBase : public base::DelegateSimpleThreadPool::Delegate { : tlp_(tlp), done_(done) { } - virtual ~ThreadLocalTesterBase() {} + ~ThreadLocalTesterBase() override {} protected: TLPType* tlp_; @@ -33,11 +33,11 @@ class SetThreadLocal : public ThreadLocalTesterBase { : ThreadLocalTesterBase(tlp, done), val_(NULL) { } - virtual ~SetThreadLocal() {} + ~SetThreadLocal() override {} void set_value(ThreadLocalTesterBase* val) { val_ = val; } - virtual void Run() override { + void Run() override { DCHECK(!done_->IsSignaled()); tlp_->Set(val_); done_->Signal(); @@ -53,11 +53,11 @@ class GetThreadLocal : public ThreadLocalTesterBase { : ThreadLocalTesterBase(tlp, done), ptr_(NULL) { } - virtual ~GetThreadLocal() {} + ~GetThreadLocal() override {} void set_ptr(ThreadLocalTesterBase** ptr) { ptr_ = ptr; } - virtual void Run() override { + void Run() override { DCHECK(!done_->IsSignaled()); *ptr_ = tlp_->Get(); done_->Signal(); diff --git a/base/threading/thread_perftest.cc b/base/threading/thread_perftest.cc index 2c9fabb..9fbc844 100644 --- a/base/threading/thread_perftest.cc +++ b/base/threading/thread_perftest.cc @@ -123,7 +123,7 @@ class TaskPerfTest : public ThreadPerfTest { return threads_[count % threads_.size()]; } - virtual void PingPong(int hops) override { + void PingPong(int hops) override { if (!hops) { FinishMeasurement(); return; @@ -149,16 +149,14 @@ TEST_F(TaskPerfTest, TaskPingPong) { // Same as above, but add observers to test their perf impact. class MessageLoopObserver : public base::MessageLoop::TaskObserver { public: - virtual void WillProcessTask(const base::PendingTask& pending_task) override { - } - virtual void DidProcessTask(const base::PendingTask& pending_task) override { - } + void WillProcessTask(const base::PendingTask& pending_task) override {} + void DidProcessTask(const base::PendingTask& pending_task) override {} }; MessageLoopObserver message_loop_observer; class TaskObserverPerfTest : public TaskPerfTest { public: - virtual void Init() override { + void Init() override { TaskPerfTest::Init(); for (size_t i = 0; i < threads_.size(); i++) { threads_[i]->message_loop()->AddTaskObserver(&message_loop_observer); diff --git a/base/threading/thread_unittest.cc b/base/threading/thread_unittest.cc index 2bac84a..f3fb334 100644 --- a/base/threading/thread_unittest.cc +++ b/base/threading/thread_unittest.cc @@ -31,11 +31,9 @@ class SleepInsideInitThread : public Thread { ANNOTATE_BENIGN_RACE( this, "Benign test-only data race on vptr - http://crbug.com/98219"); } - virtual ~SleepInsideInitThread() { - Stop(); - } + ~SleepInsideInitThread() override { Stop(); } - virtual void Init() override { + void Init() override { base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(500)); init_called_ = true; } @@ -70,17 +68,11 @@ class CaptureToEventList : public Thread { event_list_(event_list) { } - virtual ~CaptureToEventList() { - Stop(); - } + ~CaptureToEventList() override { Stop(); } - virtual void Init() override { - event_list_->push_back(THREAD_EVENT_INIT); - } + void Init() override { event_list_->push_back(THREAD_EVENT_INIT); } - virtual void CleanUp() override { - event_list_->push_back(THREAD_EVENT_CLEANUP); - } + void CleanUp() override { event_list_->push_back(THREAD_EVENT_CLEANUP); } private: EventList* event_list_; @@ -97,7 +89,7 @@ class CapturingDestructionObserver } // DestructionObserver implementation: - virtual void WillDestroyCurrentMessageLoop() override { + void WillDestroyCurrentMessageLoop() override { event_list_->push_back(THREAD_EVENT_MESSAGE_LOOP_DESTROYED); event_list_ = NULL; } diff --git a/base/threading/watchdog.h b/base/threading/watchdog.h index fe43e48..ea3be36 100644 --- a/base/threading/watchdog.h +++ b/base/threading/watchdog.h @@ -65,7 +65,8 @@ class BASE_EXPORT Watchdog { public: explicit ThreadDelegate(Watchdog* watchdog) : watchdog_(watchdog) { } - virtual void ThreadMain() override; + void ThreadMain() override; + private: void SetThreadName() const; diff --git a/base/threading/watchdog_unittest.cc b/base/threading/watchdog_unittest.cc index 2dbfdbd..b8cc7b7 100644 --- a/base/threading/watchdog_unittest.cc +++ b/base/threading/watchdog_unittest.cc @@ -26,9 +26,9 @@ class WatchdogCounter : public Watchdog { alarm_counter_(0) { } - virtual ~WatchdogCounter() {} + ~WatchdogCounter() override {} - virtual void Alarm() override { + void Alarm() override { alarm_counter_++; Watchdog::Alarm(); } diff --git a/base/threading/worker_pool.cc b/base/threading/worker_pool.cc index 5b57cab..bc016ce 100644 --- a/base/threading/worker_pool.cc +++ b/base/threading/worker_pool.cc @@ -23,8 +23,8 @@ class PostTaskAndReplyWorkerPool : public internal::PostTaskAndReplyImpl { } private: - virtual bool PostTask(const tracked_objects::Location& from_here, - const Closure& task) override { + bool PostTask(const tracked_objects::Location& from_here, + const Closure& task) override { return WorkerPool::PostTask(from_here, task, task_is_slow_); } @@ -41,13 +41,13 @@ class WorkerPoolTaskRunner : public TaskRunner { explicit WorkerPoolTaskRunner(bool tasks_are_slow); // TaskRunner implementation - virtual bool PostDelayedTask(const tracked_objects::Location& from_here, - const Closure& task, - TimeDelta delay) override; - virtual bool RunsTasksOnCurrentThread() const override; + bool PostDelayedTask(const tracked_objects::Location& from_here, + const Closure& task, + TimeDelta delay) override; + bool RunsTasksOnCurrentThread() const override; private: - virtual ~WorkerPoolTaskRunner(); + ~WorkerPoolTaskRunner() override; // Helper function for posting a delayed task. Asserts that the delay is // zero because non-zero delays are not supported. diff --git a/base/threading/worker_pool_posix.cc b/base/threading/worker_pool_posix.cc index fbf4635..f54b7ec 100644 --- a/base/threading/worker_pool_posix.cc +++ b/base/threading/worker_pool_posix.cc @@ -71,7 +71,7 @@ class WorkerThread : public PlatformThread::Delegate { : name_prefix_(name_prefix), pool_(pool) {} - virtual void ThreadMain() override; + void ThreadMain() override; private: const std::string name_prefix_; diff --git a/base/time/default_clock.h b/base/time/default_clock.h index 98bca1a..3d2e947 100644 --- a/base/time/default_clock.h +++ b/base/time/default_clock.h @@ -14,10 +14,10 @@ namespace base { // DefaultClock is a Clock implementation that uses Time::Now(). class BASE_EXPORT DefaultClock : public Clock { public: - virtual ~DefaultClock(); + ~DefaultClock() override; // Simply returns Time::Now(). - virtual Time Now() override; + Time Now() override; }; } // namespace base diff --git a/base/time/default_tick_clock.h b/base/time/default_tick_clock.h index b3d5a31..a6d6b15 100644 --- a/base/time/default_tick_clock.h +++ b/base/time/default_tick_clock.h @@ -14,10 +14,10 @@ namespace base { // DefaultClock is a Clock implementation that uses TimeTicks::Now(). class BASE_EXPORT DefaultTickClock : public TickClock { public: - virtual ~DefaultTickClock(); + ~DefaultTickClock() override; // Simply returns TimeTicks::Now(). - virtual TimeTicks NowTicks() override; + TimeTicks NowTicks() override; }; } // namespace base diff --git a/base/timer/hi_res_timer_manager.h b/base/timer/hi_res_timer_manager.h index bfe1f4d..ed0e1e0 100644 --- a/base/timer/hi_res_timer_manager.h +++ b/base/timer/hi_res_timer_manager.h @@ -16,10 +16,10 @@ namespace base { class BASE_EXPORT HighResolutionTimerManager : public base::PowerObserver { public: HighResolutionTimerManager(); - virtual ~HighResolutionTimerManager(); + ~HighResolutionTimerManager() override; // base::PowerObserver method. - virtual void OnPowerStateChange(bool on_battery_power) override; + void OnPowerStateChange(bool on_battery_power) override; // Returns true if the hi resolution clock could be used right now. bool hi_res_clock_available() const { return hi_res_clock_available_; } diff --git a/base/timer/mock_timer.h b/base/timer/mock_timer.h index c4aa92e..b07c9c0 100644 --- a/base/timer/mock_timer.h +++ b/base/timer/mock_timer.h @@ -16,16 +16,16 @@ class BASE_EXPORT MockTimer : public Timer { TimeDelta delay, const base::Closure& user_task, bool is_repeating); - virtual ~MockTimer(); + ~MockTimer() override; // base::Timer implementation. - virtual bool IsRunning() const override; - virtual base::TimeDelta GetCurrentDelay() const override; - virtual void Start(const tracked_objects::Location& posted_from, - base::TimeDelta delay, - const base::Closure& user_task) override; - virtual void Stop() override; - virtual void Reset() override; + bool IsRunning() const override; + base::TimeDelta GetCurrentDelay() const override; + void Start(const tracked_objects::Location& posted_from, + base::TimeDelta delay, + const base::Closure& user_task) override; + void Stop() override; + void Reset() override; // Testing methods. void Fire(); diff --git a/base/tools_sanity_unittest.cc b/base/tools_sanity_unittest.cc index d61d1c2..2ddaf89 100644 --- a/base/tools_sanity_unittest.cc +++ b/base/tools_sanity_unittest.cc @@ -238,8 +238,8 @@ namespace { class TOOLS_SANITY_TEST_CONCURRENT_THREAD : public PlatformThread::Delegate { public: explicit TOOLS_SANITY_TEST_CONCURRENT_THREAD(bool *value) : value_(value) {} - virtual ~TOOLS_SANITY_TEST_CONCURRENT_THREAD() {} - virtual void ThreadMain() override { + ~TOOLS_SANITY_TEST_CONCURRENT_THREAD() override {} + void ThreadMain() override { *value_ = true; // Sleep for a few milliseconds so the two threads are more likely to live @@ -254,8 +254,8 @@ class TOOLS_SANITY_TEST_CONCURRENT_THREAD : public PlatformThread::Delegate { class ReleaseStoreThread : public PlatformThread::Delegate { public: explicit ReleaseStoreThread(base::subtle::Atomic32 *value) : value_(value) {} - virtual ~ReleaseStoreThread() {} - virtual void ThreadMain() override { + ~ReleaseStoreThread() override {} + void ThreadMain() override { base::subtle::Release_Store(value_, kMagicValue); // Sleep for a few milliseconds so the two threads are more likely to live @@ -270,8 +270,8 @@ class ReleaseStoreThread : public PlatformThread::Delegate { class AcquireLoadThread : public PlatformThread::Delegate { public: explicit AcquireLoadThread(base::subtle::Atomic32 *value) : value_(value) {} - virtual ~AcquireLoadThread() {} - virtual void ThreadMain() override { + ~AcquireLoadThread() override {} + void ThreadMain() override { // Wait for the other thread to make Release_Store PlatformThread::Sleep(TimeDelta::FromMilliseconds(100)); base::subtle::Acquire_Load(value_); diff --git a/base/values.h b/base/values.h index 68dd9c8..04b2d26 100644 --- a/base/values.h +++ b/base/values.h @@ -121,16 +121,16 @@ class BASE_EXPORT FundamentalValue : public Value { explicit FundamentalValue(bool in_value); explicit FundamentalValue(int in_value); explicit FundamentalValue(double in_value); - virtual ~FundamentalValue(); + ~FundamentalValue() override; // Overridden from Value: - virtual bool GetAsBoolean(bool* out_value) const override; - virtual bool GetAsInteger(int* out_value) const override; + bool GetAsBoolean(bool* out_value) const override; + bool GetAsInteger(int* out_value) const override; // Values of both type TYPE_INTEGER and TYPE_DOUBLE can be obtained as // doubles. - virtual bool GetAsDouble(double* out_value) const override; - virtual FundamentalValue* DeepCopy() const override; - virtual bool Equals(const Value* other) const override; + bool GetAsDouble(double* out_value) const override; + FundamentalValue* DeepCopy() const override; + bool Equals(const Value* other) const override; private: union { @@ -148,18 +148,18 @@ class BASE_EXPORT StringValue : public Value { // Initializes a StringValue with a string16. explicit StringValue(const string16& in_value); - virtual ~StringValue(); + ~StringValue() override; // Returns |value_| as a pointer or reference. std::string* GetString(); const std::string& GetString() const; // Overridden from Value: - virtual bool GetAsString(std::string* out_value) const override; - virtual bool GetAsString(string16* out_value) const override; - virtual bool GetAsString(const StringValue** out_value) const override; - virtual StringValue* DeepCopy() const override; - virtual bool Equals(const Value* other) const override; + bool GetAsString(std::string* out_value) const override; + bool GetAsString(string16* out_value) const override; + bool GetAsString(const StringValue** out_value) const override; + StringValue* DeepCopy() const override; + bool Equals(const Value* other) const override; private: std::string value_; @@ -174,7 +174,7 @@ class BASE_EXPORT BinaryValue: public Value { // |buffer|. BinaryValue(scoped_ptr<char[]> buffer, size_t size); - virtual ~BinaryValue(); + ~BinaryValue() override; // For situations where you want to keep ownership of your buffer, this // factory method creates a new BinaryValue by copying the contents of the @@ -188,8 +188,8 @@ class BASE_EXPORT BinaryValue: public Value { const char* GetBuffer() const { return buffer_.get(); } // Overridden from Value: - virtual BinaryValue* DeepCopy() const override; - virtual bool Equals(const Value* other) const override; + BinaryValue* DeepCopy() const override; + bool Equals(const Value* other) const override; private: scoped_ptr<char[]> buffer_; @@ -204,12 +204,11 @@ class BASE_EXPORT BinaryValue: public Value { class BASE_EXPORT DictionaryValue : public Value { public: DictionaryValue(); - virtual ~DictionaryValue(); + ~DictionaryValue() override; // Overridden from Value: - virtual bool GetAsDictionary(DictionaryValue** out_value) override; - virtual bool GetAsDictionary( - const DictionaryValue** out_value) const override; + bool GetAsDictionary(DictionaryValue** out_value) override; + bool GetAsDictionary(const DictionaryValue** out_value) const override; // Returns true if the current dictionary has a value for the given key. bool HasKey(const std::string& key) const; @@ -362,8 +361,8 @@ class BASE_EXPORT DictionaryValue : public Value { }; // Overridden from Value: - virtual DictionaryValue* DeepCopy() const override; - virtual bool Equals(const Value* other) const override; + DictionaryValue* DeepCopy() const override; + bool Equals(const Value* other) const override; private: ValueMap dictionary_; @@ -378,7 +377,7 @@ class BASE_EXPORT ListValue : public Value { typedef ValueVector::const_iterator const_iterator; ListValue(); - virtual ~ListValue(); + ~ListValue() override; // Clears the contents of this ListValue void Clear(); @@ -476,10 +475,10 @@ class BASE_EXPORT ListValue : public Value { const_iterator end() const { return list_.end(); } // Overridden from Value: - virtual bool GetAsList(ListValue** out_value) override; - virtual bool GetAsList(const ListValue** out_value) const override; - virtual ListValue* DeepCopy() const override; - virtual bool Equals(const Value* other) const override; + bool GetAsList(ListValue** out_value) override; + bool GetAsList(const ListValue** out_value) const override; + ListValue* DeepCopy() const override; + bool Equals(const Value* other) const override; private: ValueVector list_; diff --git a/base/values_unittest.cc b/base/values_unittest.cc index c8a6cbf..cbb07f3 100644 --- a/base/values_unittest.cc +++ b/base/values_unittest.cc @@ -177,9 +177,7 @@ class DeletionTestValue : public Value { *deletion_flag_ = false; } - virtual ~DeletionTestValue() { - *deletion_flag_ = true; - } + ~DeletionTestValue() override { *deletion_flag_ = true; } private: bool* deletion_flag_; |