Revved to chromium 0e1d34edba6a5d8f7fe43c5b675880a36f4b3861 refs/remotes/origin/HEAD
filter gyp out of build/landmines.py
filter pepper out of mojo/examples/BUILD.gn
filter html_viewer out of mojo/services/BUILD.gn
filter js out of mojo/BUILD.gn and mojo/tools/data/unittests
filter js/bindings out of mojo/public/BUILD.gn
applied patch gpu_media.patch
applied patch cc_strip_video.patch
applied patch ui_test_support.patch
applied patch remove_ipc_deps.patch
applied patch ui_compositor.patch
applied patch net_sql.patch
diff --git a/base/BUILD.gn b/base/BUILD.gn
index 0bbc91b..669d739 100644
--- a/base/BUILD.gn
+++ b/base/BUILD.gn
@@ -852,11 +852,15 @@
#cflags = [ "/wd4267" ]
libs = [
+ "cfgmgr32.lib",
"netapi32.lib",
"powrprof.lib",
+ "setupapi.lib",
]
ldflags = [
+ "/DELAYLOAD:cfgmgr32.dll",
"/DELAYLOAD:powrprof.dll",
+ "/DELAYLOAD:setupapi.dll",
]
} else if (!is_nacl) {
# Non-Windows.
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 @@
#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 @@
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/base.gyp b/base/base.gyp
index 871b8e5..1a4b54e 100644
--- a/base/base.gyp
+++ b/base/base.gyp
@@ -160,10 +160,14 @@
'msvs_settings': {
'VCLinkerTool': {
'DelayLoadDLLs': [
+ 'cfgmgr32.dll',
'powrprof.dll',
+ 'setupapi.dll',
],
'AdditionalDependencies': [
+ 'cfgmgr32.lib',
'powrprof.lib',
+ 'setupapi.lib',
],
},
},
@@ -172,10 +176,14 @@
'msvs_settings': {
'VCLinkerTool': {
'DelayLoadDLLs': [
+ 'cfgmgr32.dll',
'powrprof.dll',
+ 'setupapi.dll',
],
'AdditionalDependencies': [
+ 'cfgmgr32.lib',
'powrprof.lib',
+ 'setupapi.lib',
],
},
},
@@ -1072,10 +1080,14 @@
'msvs_settings': {
'VCLinkerTool': {
'DelayLoadDLLs': [
+ 'cfgmgr32.dll',
'powrprof.dll',
+ 'setupapi.dll',
],
'AdditionalDependencies': [
+ 'cfgmgr32.lib',
'powrprof.lib',
+ 'setupapi.lib',
],
},
},
@@ -1084,10 +1096,14 @@
'msvs_settings': {
'VCLinkerTool': {
'DelayLoadDLLs': [
+ 'cfgmgr32.dll',
'powrprof.dll',
+ 'setupapi.dll',
],
'AdditionalDependencies': [
+ 'cfgmgr32.lib',
'powrprof.lib',
+ 'setupapi.lib',
],
},
},
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 Child : public Parent {
public:
- virtual void VirtualSet() override { value = kChildValue; }
+ void VirtualSet() override { value = kChildValue; }
void NonVirtualSet() { value = kChildValue; }
};
@@ -78,7 +78,7 @@
};
class NoRefChild : public NoRefParent {
- virtual void VirtualSet() override { value = kChildValue; }
+ void VirtualSet() override { value = kChildValue; }
void NonVirtualSet() { value = kChildValue; }
};
diff --git a/base/callback_list.h b/base/callback_list.h
index aeed5f1..5b911fd 100644
--- a/base/callback_list.h
+++ b/base/callback_list.h
@@ -1,3 +1,8 @@
+// This file was GENERATED by command:
+// pump.py callback_list.h.pump
+// DO NOT EDIT BY HAND!!!
+
+
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -203,21 +208,192 @@
template <typename Sig> class CallbackList;
-template <typename... Args>
-class CallbackList<void(Args...)>
- : public internal::CallbackListBase<Callback<void(Args...)> > {
+template <>
+class CallbackList<void(void)>
+ : public internal::CallbackListBase<Callback<void(void)> > {
public:
- typedef Callback<void(Args...)> CallbackType;
+ typedef Callback<void(void)> CallbackType;
CallbackList() {}
- void Notify(
- typename internal::CallbackParamTraits<Args>::ForwardType... args) {
+ void Notify() {
+ internal::CallbackListBase<CallbackType>::Iterator it =
+ this->GetIterator();
+ CallbackType* cb;
+ while ((cb = it.GetNext()) != NULL) {
+ cb->Run();
+ }
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CallbackList);
+};
+
+template <typename A1>
+class CallbackList<void(A1)>
+ : public internal::CallbackListBase<Callback<void(A1)> > {
+ public:
+ typedef Callback<void(A1)> CallbackType;
+
+ CallbackList() {}
+
+ void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1) {
typename internal::CallbackListBase<CallbackType>::Iterator it =
this->GetIterator();
CallbackType* cb;
while ((cb = it.GetNext()) != NULL) {
- cb->Run(args...);
+ cb->Run(a1);
+ }
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CallbackList);
+};
+
+template <typename A1, typename A2>
+class CallbackList<void(A1, A2)>
+ : public internal::CallbackListBase<Callback<void(A1, A2)> > {
+ public:
+ typedef Callback<void(A1, A2)> CallbackType;
+
+ CallbackList() {}
+
+ void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1,
+ typename internal::CallbackParamTraits<A2>::ForwardType a2) {
+ typename internal::CallbackListBase<CallbackType>::Iterator it =
+ this->GetIterator();
+ CallbackType* cb;
+ while ((cb = it.GetNext()) != NULL) {
+ cb->Run(a1, a2);
+ }
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CallbackList);
+};
+
+template <typename A1, typename A2, typename A3>
+class CallbackList<void(A1, A2, A3)>
+ : public internal::CallbackListBase<Callback<void(A1, A2, A3)> > {
+ public:
+ typedef Callback<void(A1, A2, A3)> CallbackType;
+
+ CallbackList() {}
+
+ void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1,
+ typename internal::CallbackParamTraits<A2>::ForwardType a2,
+ typename internal::CallbackParamTraits<A3>::ForwardType a3) {
+ typename internal::CallbackListBase<CallbackType>::Iterator it =
+ this->GetIterator();
+ CallbackType* cb;
+ while ((cb = it.GetNext()) != NULL) {
+ cb->Run(a1, a2, a3);
+ }
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CallbackList);
+};
+
+template <typename A1, typename A2, typename A3, typename A4>
+class CallbackList<void(A1, A2, A3, A4)>
+ : public internal::CallbackListBase<Callback<void(A1, A2, A3, A4)> > {
+ public:
+ typedef Callback<void(A1, A2, A3, A4)> CallbackType;
+
+ CallbackList() {}
+
+ void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1,
+ typename internal::CallbackParamTraits<A2>::ForwardType a2,
+ typename internal::CallbackParamTraits<A3>::ForwardType a3,
+ typename internal::CallbackParamTraits<A4>::ForwardType a4) {
+ typename internal::CallbackListBase<CallbackType>::Iterator it =
+ this->GetIterator();
+ CallbackType* cb;
+ while ((cb = it.GetNext()) != NULL) {
+ cb->Run(a1, a2, a3, a4);
+ }
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CallbackList);
+};
+
+template <typename A1, typename A2, typename A3, typename A4, typename A5>
+class CallbackList<void(A1, A2, A3, A4, A5)>
+ : public internal::CallbackListBase<Callback<void(A1, A2, A3, A4, A5)> > {
+ public:
+ typedef Callback<void(A1, A2, A3, A4, A5)> CallbackType;
+
+ CallbackList() {}
+
+ void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1,
+ typename internal::CallbackParamTraits<A2>::ForwardType a2,
+ typename internal::CallbackParamTraits<A3>::ForwardType a3,
+ typename internal::CallbackParamTraits<A4>::ForwardType a4,
+ typename internal::CallbackParamTraits<A5>::ForwardType a5) {
+ typename internal::CallbackListBase<CallbackType>::Iterator it =
+ this->GetIterator();
+ CallbackType* cb;
+ while ((cb = it.GetNext()) != NULL) {
+ cb->Run(a1, a2, a3, a4, a5);
+ }
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CallbackList);
+};
+
+template <typename A1, typename A2, typename A3, typename A4, typename A5,
+ typename A6>
+class CallbackList<void(A1, A2, A3, A4, A5, A6)>
+ : public internal::CallbackListBase<Callback<void(A1, A2, A3, A4, A5,
+ A6)> > {
+ public:
+ typedef Callback<void(A1, A2, A3, A4, A5, A6)> CallbackType;
+
+ CallbackList() {}
+
+ void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1,
+ typename internal::CallbackParamTraits<A2>::ForwardType a2,
+ typename internal::CallbackParamTraits<A3>::ForwardType a3,
+ typename internal::CallbackParamTraits<A4>::ForwardType a4,
+ typename internal::CallbackParamTraits<A5>::ForwardType a5,
+ typename internal::CallbackParamTraits<A6>::ForwardType a6) {
+ typename internal::CallbackListBase<CallbackType>::Iterator it =
+ this->GetIterator();
+ CallbackType* cb;
+ while ((cb = it.GetNext()) != NULL) {
+ cb->Run(a1, a2, a3, a4, a5, a6);
+ }
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CallbackList);
+};
+
+template <typename A1, typename A2, typename A3, typename A4, typename A5,
+ typename A6, typename A7>
+class CallbackList<void(A1, A2, A3, A4, A5, A6, A7)>
+ : public internal::CallbackListBase<Callback<void(A1, A2, A3, A4, A5, A6,
+ A7)> > {
+ public:
+ typedef Callback<void(A1, A2, A3, A4, A5, A6, A7)> CallbackType;
+
+ CallbackList() {}
+
+ void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1,
+ typename internal::CallbackParamTraits<A2>::ForwardType a2,
+ typename internal::CallbackParamTraits<A3>::ForwardType a3,
+ typename internal::CallbackParamTraits<A4>::ForwardType a4,
+ typename internal::CallbackParamTraits<A5>::ForwardType a5,
+ typename internal::CallbackParamTraits<A6>::ForwardType a6,
+ typename internal::CallbackParamTraits<A7>::ForwardType a7) {
+ typename internal::CallbackListBase<CallbackType>::Iterator it =
+ this->GetIterator();
+ CallbackType* cb;
+ while ((cb = it.GetNext()) != NULL) {
+ cb->Run(a1, a2, a3, a4, a5, a6, a7);
}
}
diff --git a/base/callback_list.h.pump b/base/callback_list.h.pump
new file mode 100644
index 0000000..d7f8473
--- /dev/null
+++ b/base/callback_list.h.pump
@@ -0,0 +1,269 @@
+$$ This is a pump file for generating file templates. Pump is a python
+$$ script that is part of the Google Test suite of utilities. Description
+$$ can be found here:
+$$
+$$ http://code.google.com/p/googletest/wiki/PumpManual
+$$
+
+$$ See comment for MAX_ARITY in base/bind.h.pump.
+$var MAX_ARITY = 7
+
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_CALLBACK_LIST_H_
+#define BASE_CALLBACK_LIST_H_
+
+#include <list>
+
+#include "base/basictypes.h"
+#include "base/callback.h"
+#include "base/callback_internal.h"
+#include "base/compiler_specific.h"
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
+
+// OVERVIEW:
+//
+// A container for a list of callbacks. Unlike a normal STL vector or list,
+// this container can be modified during iteration without invalidating the
+// iterator. It safely handles the case of a callback removing itself
+// or another callback from the list while callbacks are being run.
+//
+// TYPICAL USAGE:
+//
+// class MyWidget {
+// public:
+// ...
+//
+// typedef base::Callback<void(const Foo&)> OnFooCallback;
+//
+// scoped_ptr<base::CallbackList<void(const Foo&)>::Subscription>
+// RegisterCallback(const OnFooCallback& cb) {
+// return callback_list_.Add(cb);
+// }
+//
+// private:
+// void NotifyFoo(const Foo& foo) {
+// callback_list_.Notify(foo);
+// }
+//
+// base::CallbackList<void(const Foo&)> callback_list_;
+//
+// DISALLOW_COPY_AND_ASSIGN(MyWidget);
+// };
+//
+//
+// class MyWidgetListener {
+// public:
+// MyWidgetListener::MyWidgetListener() {
+// foo_subscription_ = MyWidget::GetCurrent()->RegisterCallback(
+// base::Bind(&MyWidgetListener::OnFoo, this)));
+// }
+//
+// MyWidgetListener::~MyWidgetListener() {
+// // Subscription gets deleted automatically and will deregister
+// // the callback in the process.
+// }
+//
+// private:
+// void OnFoo(const Foo& foo) {
+// // Do something.
+// }
+//
+// scoped_ptr<base::CallbackList<void(const Foo&)>::Subscription>
+// foo_subscription_;
+//
+// DISALLOW_COPY_AND_ASSIGN(MyWidgetListener);
+// };
+
+namespace base {
+
+namespace internal {
+
+template <typename CallbackType>
+class CallbackListBase {
+ public:
+ class Subscription {
+ public:
+ Subscription(CallbackListBase<CallbackType>* list,
+ typename std::list<CallbackType>::iterator iter)
+ : list_(list),
+ iter_(iter) {
+ }
+
+ ~Subscription() {
+ if (list_->active_iterator_count_) {
+ iter_->Reset();
+ } else {
+ list_->callbacks_.erase(iter_);
+ if (!list_->removal_callback_.is_null())
+ list_->removal_callback_.Run();
+ }
+ }
+
+ private:
+ CallbackListBase<CallbackType>* list_;
+ typename std::list<CallbackType>::iterator iter_;
+
+ DISALLOW_COPY_AND_ASSIGN(Subscription);
+ };
+
+ // Add a callback to the list. The callback will remain registered until the
+ // returned Subscription is destroyed, which must occur before the
+ // CallbackList is destroyed.
+ scoped_ptr<Subscription> Add(const CallbackType& cb) WARN_UNUSED_RESULT {
+ DCHECK(!cb.is_null());
+ return scoped_ptr<Subscription>(
+ new Subscription(this, callbacks_.insert(callbacks_.end(), cb)));
+ }
+
+ // Sets a callback which will be run when a subscription list is changed.
+ void set_removal_callback(const Closure& callback) {
+ removal_callback_ = callback;
+ }
+
+ // Returns true if there are no subscriptions. This is only valid to call when
+ // not looping through the list.
+ bool empty() {
+ DCHECK_EQ(0, active_iterator_count_);
+ return callbacks_.empty();
+ }
+
+ protected:
+ // An iterator class that can be used to access the list of callbacks.
+ class Iterator {
+ public:
+ explicit Iterator(CallbackListBase<CallbackType>* list)
+ : list_(list),
+ list_iter_(list_->callbacks_.begin()) {
+ ++list_->active_iterator_count_;
+ }
+
+ Iterator(const Iterator& iter)
+ : list_(iter.list_),
+ list_iter_(iter.list_iter_) {
+ ++list_->active_iterator_count_;
+ }
+
+ ~Iterator() {
+ if (list_ && --list_->active_iterator_count_ == 0) {
+ list_->Compact();
+ }
+ }
+
+ CallbackType* GetNext() {
+ while ((list_iter_ != list_->callbacks_.end()) && list_iter_->is_null())
+ ++list_iter_;
+
+ CallbackType* cb = NULL;
+ if (list_iter_ != list_->callbacks_.end()) {
+ cb = &(*list_iter_);
+ ++list_iter_;
+ }
+ return cb;
+ }
+
+ private:
+ CallbackListBase<CallbackType>* list_;
+ typename std::list<CallbackType>::iterator list_iter_;
+ };
+
+ CallbackListBase() : active_iterator_count_(0) {}
+
+ ~CallbackListBase() {
+ DCHECK_EQ(0, active_iterator_count_);
+ DCHECK_EQ(0U, callbacks_.size());
+ }
+
+ // Returns an instance of a CallbackListBase::Iterator which can be used
+ // to run callbacks.
+ Iterator GetIterator() {
+ return Iterator(this);
+ }
+
+ // Compact the list: remove any entries which were NULLed out during
+ // iteration.
+ void Compact() {
+ typename std::list<CallbackType>::iterator it = callbacks_.begin();
+ bool updated = false;
+ while (it != callbacks_.end()) {
+ if ((*it).is_null()) {
+ updated = true;
+ it = callbacks_.erase(it);
+ } else {
+ ++it;
+ }
+
+ if (updated && !removal_callback_.is_null())
+ removal_callback_.Run();
+ }
+ }
+
+ private:
+ std::list<CallbackType> callbacks_;
+ int active_iterator_count_;
+ Closure removal_callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(CallbackListBase);
+};
+
+} // namespace internal
+
+template <typename Sig> class CallbackList;
+
+
+$range ARITY 0..MAX_ARITY
+$for ARITY [[
+$range ARG 1..ARITY
+
+$if ARITY == 0 [[
+template <>
+class CallbackList<void(void)>
+ : public internal::CallbackListBase<Callback<void(void)> > {
+]] $else [[
+template <$for ARG , [[typename A$(ARG)]]>
+class CallbackList<void($for ARG , [[A$(ARG)]])>
+ : public internal::CallbackListBase<Callback<void($for ARG , [[A$(ARG)]])> > {
+]]
+
+ public:
+$if ARITY == 0 [[
+
+ typedef Callback<void(void)> CallbackType;
+]] $else [[
+
+ typedef Callback<void($for ARG , [[A$(ARG)]])> CallbackType;
+]]
+
+
+ CallbackList() {}
+
+ void Notify($for ARG ,
+ [[typename internal::CallbackParamTraits<A$(ARG)>::ForwardType a$(ARG)]]) {
+$if ARITY == 0 [[
+
+ internal::CallbackListBase<CallbackType>::Iterator it =
+ this->GetIterator();
+]] $else [[
+
+ typename internal::CallbackListBase<CallbackType>::Iterator it =
+ this->GetIterator();
+]]
+
+ CallbackType* cb;
+ while ((cb = it.GetNext()) != NULL) {
+ cb->Run($for ARG , [[a$(ARG)]]);
+ }
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CallbackList);
+};
+
+
+]] $$ for ARITY
+} // namespace base
+
+#endif // BASE_CALLBACK_LIST_H_
diff --git a/base/debug/crash_logging_unittest.cc b/base/debug/crash_logging_unittest.cc
index 8c252f0..cb11f13 100644
--- a/base/debug/crash_logging_unittest.cc
+++ b/base/debug/crash_logging_unittest.cc
@@ -44,7 +44,7 @@
};
TEST_F(CrashLoggingTest, SetClearSingle) {
- const char* kTestKey = "test-key";
+ const char kTestKey[] = "test-key";
base::debug::CrashKey keys[] = { { kTestKey, 255 } };
base::debug::InitCrashKeys(keys, arraysize(keys), 255);
@@ -56,10 +56,10 @@
}
TEST_F(CrashLoggingTest, SetChunked) {
- const char* kTestKey = "chunky";
- const char* kChunk1 = "chunky-1";
- const char* kChunk2 = "chunky-2";
- const char* kChunk3 = "chunky-3";
+ const char kTestKey[] = "chunky";
+ const char kChunk1[] = "chunky-1";
+ const char kChunk2[] = "chunky-2";
+ const char kChunk3[] = "chunky-3";
base::debug::CrashKey keys[] = { { kTestKey, 15 } };
base::debug::InitCrashKeys(keys, arraysize(keys), 5);
@@ -104,7 +104,7 @@
}
TEST_F(CrashLoggingTest, ScopedCrashKey) {
- const char* kTestKey = "test-key";
+ const char kTestKey[] = "test-key";
base::debug::CrashKey keys[] = { { kTestKey, 255 } };
base::debug::InitCrashKeys(keys, arraysize(keys), 255);
diff --git a/base/debug/proc_maps_linux_unittest.cc b/base/debug/proc_maps_linux_unittest.cc
index 4be5a0f..d5d1b83 100644
--- a/base/debug/proc_maps_linux_unittest.cc
+++ b/base/debug/proc_maps_linux_unittest.cc
@@ -239,7 +239,7 @@
}
TEST(ProcMapsTest, MissingFields) {
- static const char* kTestCases[] = {
+ static const char* const kTestCases[] = {
"00400000\n", // Missing end + beyond.
"00400000-0040b000\n", // Missing perms + beyond.
"00400000-0040b000 r-xp\n", // Missing offset + beyond.
@@ -261,7 +261,7 @@
}
TEST(ProcMapsTest, InvalidInput) {
- static const char* kTestCases[] = {
+ static const char* const kTestCases[] = {
"thisisal-0040b000 rwxp 00000000 fc:00 794418 /bin/cat\n",
"0040000d-linvalid rwxp 00000000 fc:00 794418 /bin/cat\n",
"00400000-0040b000 inpu 00000000 fc:00 794418 /bin/cat\n",
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 @@
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 @@
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_android.cc b/base/debug/trace_event_android.cc
index 1e78b45..f08fffc 100644
--- a/base/debug/trace_event_android.cc
+++ b/base/debug/trace_event_android.cc
@@ -15,7 +15,7 @@
namespace {
int g_atrace_fd = -1;
-const char* kATraceMarkerFile = "/sys/kernel/debug/tracing/trace_marker";
+const char kATraceMarkerFile[] = "/sys/kernel/debug/tracing/trace_marker";
void WriteEvent(
char phase,
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 @@
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 @@
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 @@
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 @@
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 @@
return chunk->GetEventAt(handle.event_index);
}
- virtual const TraceBufferChunk* NextChunk() override {
+ const TraceBufferChunk* NextChunk() override {
if (chunks_.empty())
return NULL;
@@ -212,7 +209,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 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 @@
: public MessageLoop::DestructionObserver {
public:
ThreadLocalEventBuffer(TraceLog* trace_log);
- virtual ~ThreadLocalEventBuffer();
+ ~ThreadLocalEventBuffer() override;
TraceEvent* AddTraceEvent(TraceEventHandle* handle);
@@ -1066,7 +1059,7 @@
private:
// MessageLoop::DestructionObserver
- virtual void WillDestroyCurrentMessageLoop() override;
+ void WillDestroyCurrentMessageLoop() override;
void FlushWhileLocked();
diff --git a/base/debug/trace_event_impl.h b/base/debug/trace_event_impl.h
index bac74e3..79bdc97 100644
--- a/base/debug/trace_event_impl.h
+++ b/base/debug/trace_event_impl.h
@@ -179,7 +179,7 @@
// TraceBufferChunk is the basic unit of TraceBuffer.
class BASE_EXPORT TraceBufferChunk {
public:
- TraceBufferChunk(uint32 seq)
+ explicit TraceBufferChunk(uint32 seq)
: next_free_(0),
seq_(seq) {
}
@@ -281,7 +281,7 @@
// The default category filter, used when none is provided.
// Allows all categories through, except if they end in the suffix 'Debug' or
// 'Test'.
- static const char* kDefaultCategoryFilterString;
+ static const char kDefaultCategoryFilterString[];
// |filter_string| is a comma-delimited list of category wildcards.
// A category can have an optional '-' prefix to make it an excluded category.
@@ -380,13 +380,12 @@
};
struct BASE_EXPORT TraceOptions {
-
TraceOptions()
: record_mode(RECORD_UNTIL_FULL),
enable_sampling(false),
enable_systrace(false) {}
- TraceOptions(TraceRecordMode record_mode)
+ explicit TraceOptions(TraceRecordMode record_mode)
: record_mode(record_mode),
enable_sampling(false),
enable_systrace(false) {}
diff --git a/base/debug/trace_event_impl_constants.cc b/base/debug/trace_event_impl_constants.cc
index 24d7af7..8e01411 100644
--- a/base/debug/trace_event_impl_constants.cc
+++ b/base/debug/trace_event_impl_constants.cc
@@ -8,7 +8,7 @@
namespace debug {
// Enable everything but debug and test categories by default.
-const char* CategoryFilter::kDefaultCategoryFilterString = "-*Debug,-*Test";
+const char CategoryFilter::kDefaultCategoryFilterString[] = "-*Debug,-*Test";
// Constant used by TraceLog's internal implementation of trace_option.
const TraceLog::InternalTraceOptions
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 @@
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 @@
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 @@
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 @@
}
// 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 b2bf2ae..9cbefd8 100644
--- a/base/debug/trace_event_system_stats_monitor.cc
+++ b/base/debug/trace_event_system_stats_monitor.cc
@@ -31,12 +31,12 @@
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 @@
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 90be070..69b5743 100644
--- a/base/debug/trace_event_unittest.cc
+++ b/base/debug/trace_event_unittest.cc
@@ -252,7 +252,6 @@
}
void TraceEventTestFixture::DropTracedMetadataRecords() {
-
scoped_ptr<ListValue> old_trace_parsed(trace_parsed_.DeepCopy());
size_t old_trace_parsed_size = old_trace_parsed->GetSize();
trace_parsed_.Clear();
@@ -266,7 +265,7 @@
}
DictionaryValue* dict = static_cast<DictionaryValue*>(value);
std::string tmp;
- if(dict->GetString("ph", &tmp) && tmp == "M")
+ if (dict->GetString("ph", &tmp) && tmp == "M")
continue;
trace_parsed_.Append(value->DeepCopy());
@@ -377,7 +376,7 @@
return hits;
}
-const char* kControlCharacters = "\001\002\003\n\r";
+const char kControlCharacters[] = "\001\002\003\n\r";
void TraceWithAllMacroVariants(WaitableEvent* task_complete_event) {
{
@@ -478,7 +477,7 @@
TRACE_EVENT1(kControlCharacters, kControlCharacters,
kControlCharacters, kControlCharacters);
- } // Scope close causes TRACE_EVENT0 etc to send their END events.
+ } // Scope close causes TRACE_EVENT0 etc to send their END events.
if (task_complete_event)
task_complete_event->Signal();
@@ -996,11 +995,11 @@
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());
}
};
@@ -1029,9 +1028,9 @@
virtual ~SelfRemovingEnabledStateObserver() {}
// TraceLog::EnabledStateObserver overrides:
- virtual void OnTraceLogEnabled() override {}
+ void OnTraceLogEnabled() override {}
- virtual void OnTraceLogDisabled() override {
+ void OnTraceLogDisabled() override {
TraceLog::GetInstance()->RemoveEnabledStateObserver(this);
}
};
@@ -1300,12 +1299,12 @@
BeginTrace();
unsigned long long id = 0xfeedbeeffeedbeefull;
- TRACE_EVENT_ASYNC_BEGIN0( "cat", "name1", id);
- TRACE_EVENT_ASYNC_STEP_INTO0( "cat", "name1", id, "step1");
+ TRACE_EVENT_ASYNC_BEGIN0("cat", "name1", id);
+ TRACE_EVENT_ASYNC_STEP_INTO0("cat", "name1", id, "step1");
TRACE_EVENT_ASYNC_END0("cat", "name1", id);
- TRACE_EVENT_BEGIN0( "cat", "name2");
- TRACE_EVENT_ASYNC_BEGIN0( "cat", "name3", 0);
- TRACE_EVENT_ASYNC_STEP_PAST0( "cat", "name3", 0, "step2");
+ TRACE_EVENT_BEGIN0("cat", "name2");
+ TRACE_EVENT_ASYNC_BEGIN0("cat", "name3", 0);
+ TRACE_EVENT_ASYNC_STEP_PAST0("cat", "name3", 0, "step2");
EndTraceAndFlush();
@@ -1332,13 +1331,13 @@
TraceLog::GetInstance()->SetProcessID(100);
BeginTrace();
- TRACE_EVENT_ASYNC_BEGIN0( "cat", "name1", ptr);
- TRACE_EVENT_ASYNC_BEGIN0( "cat", "name2", ptr);
+ TRACE_EVENT_ASYNC_BEGIN0("cat", "name1", ptr);
+ TRACE_EVENT_ASYNC_BEGIN0("cat", "name2", ptr);
EndTraceAndFlush();
TraceLog::GetInstance()->SetProcessID(200);
BeginTrace();
- TRACE_EVENT_ASYNC_END0( "cat", "name1", ptr);
+ TRACE_EVENT_ASYNC_END0("cat", "name1", ptr);
EndTraceAndFlush();
DictionaryValue* async_begin = FindNamePhase("name1", "S");
@@ -1490,32 +1489,32 @@
TEST_F(TraceEventTestFixture, ThreadNames) {
// Create threads before we enable tracing to make sure
// that tracelog still captures them.
- const int num_threads = 4;
- const int num_events = 10;
- Thread* threads[num_threads];
- PlatformThreadId thread_ids[num_threads];
- for (int i = 0; i < num_threads; i++)
+ const int kNumThreads = 4;
+ const int kNumEvents = 10;
+ Thread* threads[kNumThreads];
+ PlatformThreadId thread_ids[kNumThreads];
+ for (int i = 0; i < kNumThreads; i++)
threads[i] = new Thread(StringPrintf("Thread %d", i));
// Enable tracing.
BeginTrace();
// Now run some trace code on these threads.
- WaitableEvent* task_complete_events[num_threads];
- for (int i = 0; i < num_threads; i++) {
+ WaitableEvent* task_complete_events[kNumThreads];
+ for (int i = 0; i < kNumThreads; i++) {
task_complete_events[i] = new WaitableEvent(false, false);
threads[i]->Start();
thread_ids[i] = threads[i]->thread_id();
threads[i]->message_loop()->PostTask(
FROM_HERE, base::Bind(&TraceManyInstantEvents,
- i, num_events, task_complete_events[i]));
+ i, kNumEvents, task_complete_events[i]));
}
- for (int i = 0; i < num_threads; i++) {
+ for (int i = 0; i < kNumThreads; i++) {
task_complete_events[i]->Wait();
}
// Shut things down.
- for (int i = 0; i < num_threads; i++) {
+ for (int i = 0; i < kNumThreads; i++) {
threads[i]->Stop();
delete threads[i];
delete task_complete_events[i];
@@ -1538,7 +1537,7 @@
EXPECT_TRUE(item->GetInteger("tid", &tmp_int));
// See if this thread name is one of the threads we just created
- for (int j = 0; j < num_threads; j++) {
+ for (int j = 0; j < kNumThreads; j++) {
if(static_cast<int>(thread_ids[j]) != tmp_int)
continue;
@@ -1919,12 +1918,12 @@
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);
};
@@ -2969,7 +2968,7 @@
}
TEST_F(TraceEventTestFixture, BadSyntheticDelayConfigurations) {
- const char* configs[] = {
+ const char* const configs[] = {
"",
"DELAY(",
"DELAY(;",
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 @@
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 @@
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 @@
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 @@
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/environment_unittest.cc b/base/environment_unittest.cc
index e8c1906..f0577a8 100644
--- a/base/environment_unittest.cc
+++ b/base/environment_unittest.cc
@@ -21,8 +21,8 @@
TEST_F(EnvironmentTest, GetVarReverse) {
scoped_ptr<Environment> env(Environment::Create());
- const char* kFooUpper = "FOO";
- const char* kFooLower = "foo";
+ const char kFooUpper[] = "FOO";
+ const char kFooLower[] = "foo";
// Set a variable in UPPER case.
EXPECT_TRUE(env->SetVar(kFooUpper, kFooLower));
@@ -35,7 +35,7 @@
EXPECT_TRUE(env->UnSetVar(kFooUpper));
- const char* kBar = "bar";
+ const char kBar[] = "bar";
// Now do the opposite, set the variable in the lower case.
EXPECT_TRUE(env->SetVar(kFooLower, kBar));
@@ -56,8 +56,8 @@
TEST_F(EnvironmentTest, SetVar) {
scoped_ptr<Environment> env(Environment::Create());
- const char* kFooUpper = "FOO";
- const char* kFooLower = "foo";
+ const char kFooUpper[] = "FOO";
+ const char kFooLower[] = "foo";
EXPECT_TRUE(env->SetVar(kFooUpper, kFooLower));
// Now verify that the environment has the new variable.
@@ -71,8 +71,8 @@
TEST_F(EnvironmentTest, UnSetVar) {
scoped_ptr<Environment> env(Environment::Create());
- const char* kFooUpper = "FOO";
- const char* kFooLower = "foo";
+ const char kFooUpper[] = "FOO";
+ const char kFooLower[] = "foo";
// First set some environment variable.
EXPECT_TRUE(env->SetVar(kFooUpper, kFooLower));
@@ -95,7 +95,7 @@
string16 e;
e = AlterEnvironment(empty, changes);
- EXPECT_TRUE(e[0] == 0);
+ EXPECT_EQ(0, e[0]);
changes[L"A"] = L"1";
e = AlterEnvironment(empty, changes);
diff --git a/base/file_descriptor_posix.h b/base/file_descriptor_posix.h
index c730be6..376ad39 100644
--- a/base/file_descriptor_posix.h
+++ b/base/file_descriptor_posix.h
@@ -6,6 +6,7 @@
#define BASE_FILE_DESCRIPTOR_POSIX_H_
#include "base/files/file.h"
+#include "base/files/scoped_file.h"
namespace base {
@@ -24,6 +25,7 @@
}
FileDescriptor(File file) : fd(file.TakePlatformFile()), auto_close(true) {}
+ explicit FileDescriptor(ScopedFD fd) : fd(fd.release()), auto_close(true) {}
bool operator==(const FileDescriptor& other) const {
return (fd == other.fd && auto_close == other.auto_close);
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 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.cc b/base/files/file_path.cc
index 11bf69d..bf37be6 100644
--- a/base/files/file_path.cc
+++ b/base/files/file_path.cc
@@ -35,8 +35,8 @@
namespace {
-const char* kCommonDoubleExtensionSuffixes[] = { "gz", "z", "bz2", "bz" };
-const char* kCommonDoubleExtensions[] = { "user.js" };
+const char* const kCommonDoubleExtensionSuffixes[] = { "gz", "z", "bz2", "bz" };
+const char* const kCommonDoubleExtensions[] = { "user.js" };
const FilePath::CharType kStringTerminator = FILE_PATH_LITERAL('\0');
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 @@
: 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 @@
: 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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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/file_util.cc b/base/files/file_util.cc
index 17b5969..e60dcd9 100644
--- a/base/files/file_util.cc
+++ b/base/files/file_util.cc
@@ -139,16 +139,17 @@
return false;
}
- char buf[1 << 16];
+ const size_t kBufferSize = 1 << 16;
+ scoped_ptr<char[]> buf(new char[kBufferSize]);
size_t len;
size_t size = 0;
bool read_status = true;
// Many files supplied in |path| have incorrect size (proc files etc).
// Hence, the file is read sequentially as opposed to a one-shot read.
- while ((len = fread(buf, 1, sizeof(buf), file)) > 0) {
+ while ((len = fread(buf.get(), 1, kBufferSize, file)) > 0) {
if (contents)
- contents->append(buf, std::min(len, max_size - size));
+ contents->append(buf.get(), std::min(len, max_size - size));
if ((max_size - size) < len) {
read_status = false;
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 @@
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/i18n/break_iterator_unittest.cc b/base/i18n/break_iterator_unittest.cc
index 8569135..220a996 100644
--- a/base/i18n/break_iterator_unittest.cc
+++ b/base/i18n/break_iterator_unittest.cc
@@ -89,7 +89,7 @@
TEST(BreakIteratorTest, BreakWide32) {
// U+1D49C MATHEMATICAL SCRIPT CAPITAL A
- const char* very_wide_char = "\xF0\x9D\x92\x9C";
+ const char very_wide_char[] = "\xF0\x9D\x92\x9C";
const string16 str(
UTF8ToUTF16(base::StringPrintf("%s a", very_wide_char)));
const string16 very_wide_word(str.substr(0, 2));
@@ -194,7 +194,7 @@
TEST(BreakIteratorTest, BreakSpaceWide32) {
// U+1D49C MATHEMATICAL SCRIPT CAPITAL A
- const char* very_wide_char = "\xF0\x9D\x92\x9C";
+ const char very_wide_char[] = "\xF0\x9D\x92\x9C";
const string16 str(
UTF8ToUTF16(base::StringPrintf("%s a", very_wide_char)));
const string16 very_wide_word(str.substr(0, 3));
@@ -292,7 +292,7 @@
TEST(BreakIteratorTest, BreakLineWide32) {
// U+1D49C MATHEMATICAL SCRIPT CAPITAL A
- const char* very_wide_char = "\xF0\x9D\x92\x9C";
+ const char very_wide_char[] = "\xF0\x9D\x92\x9C";
const string16 str(
UTF8ToUTF16(base::StringPrintf("%s\na", very_wide_char)));
const string16 very_wide_line(str.substr(0, 3));
@@ -345,7 +345,7 @@
const string16 long_string(ASCIIToUTF16("another,string"));
EXPECT_TRUE(iter.SetText(long_string.c_str(), long_string.size()));
EXPECT_TRUE(iter.Advance());
- EXPECT_TRUE(iter.Advance()); // Advance to ',' in |long_string|
+ EXPECT_TRUE(iter.Advance()); // Advance to ',' in |long_string|
// Check that the current position is out of bounds of the |initial_string|.
EXPECT_LT(initial_string.size(), iter.pos());
diff --git a/base/json/json_file_value_serializer.cc b/base/json/json_file_value_serializer.cc
index d7d54f2..d60f800 100644
--- a/base/json/json_file_value_serializer.cc
+++ b/base/json/json_file_value_serializer.cc
@@ -10,10 +10,10 @@
using base::FilePath;
-const char* JSONFileValueSerializer::kAccessDenied = "Access denied.";
-const char* JSONFileValueSerializer::kCannotReadFile = "Can't read file.";
-const char* JSONFileValueSerializer::kFileLocked = "File locked.";
-const char* JSONFileValueSerializer::kNoSuchFile = "File doesn't exist.";
+const char JSONFileValueSerializer::kAccessDenied[] = "Access denied.";
+const char JSONFileValueSerializer::kCannotReadFile[] = "Can't read file.";
+const char JSONFileValueSerializer::kFileLocked[] = "File locked.";
+const char JSONFileValueSerializer::kNoSuchFile[] = "File doesn't exist.";
bool JSONFileValueSerializer::Serialize(const base::Value& root) {
return SerializeInternal(root, false);
diff --git a/base/json/json_file_value_serializer.h b/base/json/json_file_value_serializer.h
index fc12b6b..f0f556c 100644
--- a/base/json/json_file_value_serializer.h
+++ b/base/json/json_file_value_serializer.h
@@ -22,7 +22,7 @@
: 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 @@
// 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 @@
// 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 {
@@ -58,10 +58,10 @@
};
// File-specific error messages that can be returned.
- static const char* kAccessDenied;
- static const char* kCannotReadFile;
- static const char* kFileLocked;
- static const char* kNoSuchFile;
+ static const char kAccessDenied[];
+ static const char kCannotReadFile[];
+ static const char kFileLocked[];
+ static const char kNoSuchFile[];
// Convert an error code into an error message. |error_code| is assumed to
// be a JsonFileError.
diff --git a/base/json/json_parser.cc b/base/json/json_parser.cc
index a74da5f..6a25bc7 100644
--- a/base/json/json_parser.cc
+++ b/base/json/json_parser.cc
@@ -37,7 +37,7 @@
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 @@
// 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 @@
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 @@
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 @@
}
// 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_;
@@ -901,7 +901,7 @@
Value* JSONParser::ConsumeLiteral() {
switch (*pos_) {
case 't': {
- const char* kTrueLiteral = "true";
+ const char kTrueLiteral[] = "true";
const int kTrueLen = static_cast<int>(strlen(kTrueLiteral));
if (!CanConsume(kTrueLen - 1) ||
!StringsAreEqual(pos_, kTrueLiteral, kTrueLen)) {
@@ -912,7 +912,7 @@
return new FundamentalValue(true);
}
case 'f': {
- const char* kFalseLiteral = "false";
+ const char kFalseLiteral[] = "false";
const int kFalseLen = static_cast<int>(strlen(kFalseLiteral));
if (!CanConsume(kFalseLen - 1) ||
!StringsAreEqual(pos_, kFalseLiteral, kFalseLen)) {
@@ -923,7 +923,7 @@
return new FundamentalValue(false);
}
case 'n': {
- const char* kNullLiteral = "null";
+ const char kNullLiteral[] = "null";
const int kNullLen = static_cast<int>(strlen(kNullLiteral));
if (!CanConsume(kNullLen - 1) ||
!StringsAreEqual(pos_, kNullLiteral, kNullLen)) {
diff --git a/base/json/json_reader.cc b/base/json/json_reader.cc
index cbf6c99..ad5a9d5 100644
--- a/base/json/json_reader.cc
+++ b/base/json/json_reader.cc
@@ -13,21 +13,21 @@
COMPILE_ASSERT(JSONReader::JSON_PARSE_ERROR_COUNT < 1000,
json_reader_error_out_of_bounds);
-const char* JSONReader::kInvalidEscape =
+const char JSONReader::kInvalidEscape[] =
"Invalid escape sequence.";
-const char* JSONReader::kSyntaxError =
+const char JSONReader::kSyntaxError[] =
"Syntax error.";
-const char* JSONReader::kUnexpectedToken =
+const char JSONReader::kUnexpectedToken[] =
"Unexpected token.";
-const char* JSONReader::kTrailingComma =
+const char JSONReader::kTrailingComma[] =
"Trailing comma not allowed.";
-const char* JSONReader::kTooMuchNesting =
+const char JSONReader::kTooMuchNesting[] =
"Too much nesting.";
-const char* JSONReader::kUnexpectedDataAfterRoot =
+const char JSONReader::kUnexpectedDataAfterRoot[] =
"Unexpected data after root element.";
-const char* JSONReader::kUnsupportedEncoding =
+const char JSONReader::kUnsupportedEncoding[] =
"Unsupported encoding. JSON must be UTF-8.";
-const char* JSONReader::kUnquotedDictionaryKey =
+const char JSONReader::kUnquotedDictionaryKey[] =
"Dictionary keys must be quoted.";
JSONReader::JSONReader()
diff --git a/base/json/json_reader.h b/base/json/json_reader.h
index 79129ce..fd053d4 100644
--- a/base/json/json_reader.h
+++ b/base/json/json_reader.h
@@ -75,14 +75,14 @@
};
// String versions of parse error codes.
- static const char* kInvalidEscape;
- static const char* kSyntaxError;
- static const char* kUnexpectedToken;
- static const char* kTrailingComma;
- static const char* kTooMuchNesting;
- static const char* kUnexpectedDataAfterRoot;
- static const char* kUnsupportedEncoding;
- static const char* kUnquotedDictionaryKey;
+ static const char kInvalidEscape[];
+ static const char kSyntaxError[];
+ static const char kUnexpectedToken[];
+ static const char kTrailingComma[];
+ static const char kTooMuchNesting[];
+ static const char kUnexpectedDataAfterRoot[];
+ static const char kUnsupportedEncoding[];
+ static const char kUnquotedDictionaryKey[];
// Constructs a reader with the default options, JSON_PARSE_RFC.
JSONReader();
diff --git a/base/json/json_reader_unittest.cc b/base/json/json_reader_unittest.cc
index 67070ff..a3ec4f7 100644
--- a/base/json/json_reader_unittest.cc
+++ b/base/json/json_reader_unittest.cc
@@ -505,7 +505,7 @@
EXPECT_EQ("\xf0\x9f\x92\xa9\xf0\x9f\x91\xac", str_val);
// Test invalid utf16 strings.
- const char* cases[] = {
+ const char* const cases[] = {
"\"\\u123\"", // Invalid scalar.
"\"\\ud83d\"", // Invalid scalar.
"\"\\u$%@!\"", // Invalid scalar.
@@ -627,7 +627,7 @@
// parser implementation against buffer overflow. Best run with DCHECKs so
// that the one in NextChar fires.
TEST(JSONReaderTest, InvalidSanity) {
- const char* invalid_json[] = {
+ const char* const invalid_json[] = {
"/* test *",
"{\"foo\"",
"{\"foo\":",
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 @@
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 @@
// 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 @@
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 @@
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 @@
dispatch_queue_t GetDispatchQueue() const;
protected:
- virtual ~LibDispatchTaskRunner();
+ ~LibDispatchTaskRunner() override;
private:
static void Finalizer(void* context);
diff --git a/base/mac/mac_util_unittest.mm b/base/mac/mac_util_unittest.mm
index 6a1acb3..3b23e53 100644
--- a/base/mac/mac_util_unittest.mm
+++ b/base/mac/mac_util_unittest.mm
@@ -64,7 +64,7 @@
EXPECT_TRUE(out.empty());
// Some more invalid inputs.
- const char* invalid_inputs[] = {
+ const char* const invalid_inputs[] = {
"/", "/foo", "foo", "/foo/bar.", "foo/bar.", "/foo/bar./bazquux",
"foo/bar./bazquux", "foo/.app", "//foo",
};
diff --git a/base/macros.h b/base/macros.h
index f89d7d1..b6240da 100644
--- a/base/macros.h
+++ b/base/macros.h
@@ -67,15 +67,6 @@
#define arraysize(array) (sizeof(ArraySizeHelper(array)))
-// DEPRECATED: Just use |arraysize()|, now that C++11 has removed the
-// limitations that forced the use of |ARRAYSIZE_UNSAFE()|.
-// TODO(viettrungluu): Convert all instances and delete. (The only uses are now
-// in Blink; the ifdef is to prevent it from reappearing in Chromium.)
-// crbug.com/423134
-#if defined(BLINK_PLATFORM) || defined(BLINK_PLATFORM_IMPLEMENTATION)
-#define ARRAYSIZE_UNSAFE(a) arraysize(a)
-#endif
-
// Use implicit_cast as a safe version of static_cast or const_cast
// for upcasting in the type hierarchy (i.e. casting a pointer to Foo
diff --git a/base/md5_unittest.cc b/base/md5_unittest.cc
index 3e7f2ad..8d817e9 100644
--- a/base/md5_unittest.cc
+++ b/base/md5_unittest.cc
@@ -33,7 +33,7 @@
TEST(MD5, MD5SumEmtpyData) {
MD5Digest digest;
- const char* data = "";
+ const char data[] = "";
MD5Sum(data, strlen(data), &digest);
@@ -50,7 +50,7 @@
TEST(MD5, MD5SumOneByteData) {
MD5Digest digest;
- const char* data = "a";
+ const char data[] = "a";
MD5Sum(data, strlen(data), &digest);
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 @@
public internal::DiscardableMemoryManagerAllocation {
public:
explicit DiscardableMemoryEmulated(size_t bytes);
- virtual ~DiscardableMemoryEmulated();
+ ~DiscardableMemoryEmulated() override;
static bool ReduceMemoryUsage();
@@ -31,14 +31,14 @@
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..4da13d3 100644
--- a/base/memory/discardable_memory_mach.h
+++ b/base/memory/discardable_memory_mach.h
@@ -18,21 +18,21 @@
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 @@
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 @@
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 @@
// 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
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 @@
}
// 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 @@
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 @@
// 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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..d63e810 100644
--- a/base/message_loop/message_pump_default.h
+++ b/base/message_loop/message_pump_default.h
@@ -15,13 +15,13 @@
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 @@
};
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 @@
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 @@
// 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 @@
: 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 @@
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 @@
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 @@
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 @@
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 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 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 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 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 @@
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 b474ddb..905cc22 100644
--- a/base/metrics/field_trial_unittest.cc
+++ b/base/metrics/field_trial_unittest.cc
@@ -44,12 +44,10 @@
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;
}
@@ -78,8 +76,8 @@
// Test registration, and also check that destructors are called for trials
// (and that Valgrind doesn't catch us leaking).
TEST_F(FieldTrialTest, Registration) {
- const char* name1 = "name 1 test";
- const char* name2 = "name 2 test";
+ const char name1[] = "name 1 test";
+ const char name2[] = "name 2 test";
EXPECT_FALSE(FieldTrialList::Find(name1));
EXPECT_FALSE(FieldTrialList::Find(name2));
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 @@
// 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 @@
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 @@
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 @@
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 @@
// 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 @@
BucketRanges* ranges);
// Overridden from Histogram:
- virtual HistogramType GetHistogramType() const override;
+ HistogramType GetHistogramType() const override;
protected:
LinearHistogram(const std::string& name,
@@ -529,15 +528,15 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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(
+ void InconsistencyDetected(HistogramBase::Inconsistency problem) override {
+ ASSERT_TRUE(false);
+ }
+
+ void UniqueInconsistencyDetected(
HistogramBase::Inconsistency problem) override {
ASSERT_TRUE(false);
}
- virtual 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 @@
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 @@
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 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 @@
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 @@
// 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 @@
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 @@
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 @@
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 @@
: SimpleThread(name),
id_(id) {}
- virtual void Run() override;
+ void Run() override;
private:
int id_;
diff --git a/base/nix/xdg_util_unittest.cc b/base/nix/xdg_util_unittest.cc
index 2fc9d4c..6d10d3e 100644
--- a/base/nix/xdg_util_unittest.cc
+++ b/base/nix/xdg_util_unittest.cc
@@ -25,10 +25,10 @@
MOCK_METHOD1(UnSetVar, bool(const char*));
};
-const char* kGnome = "gnome";
-const char* kKDE4 = "kde4";
-const char* kKDE = "kde";
-const char* kXFCE = "xfce";
+const char* const kGnome = "gnome";
+const char* const kKDE4 = "kde4";
+const char* const kKDE = "kde";
+const char* const kXFCE = "xfce";
} // namespace
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 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 @@
: 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 @@
: 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
: 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 @@
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 @@
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 @@
// 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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/overlay_user_pref_store_unittest.cc b/base/prefs/overlay_user_pref_store_unittest.cc
index 18e9a5c..66a7b3b 100644
--- a/base/prefs/overlay_user_pref_store_unittest.cc
+++ b/base/prefs/overlay_user_pref_store_unittest.cc
@@ -19,12 +19,12 @@
const char kBrowserWindowPlacement[] = "browser.window_placement";
const char kShowBookmarkBar[] = "bookmark_bar.show_on_all_tabs";
-const char* overlay_key = kBrowserWindowPlacement;
-const char* regular_key = kShowBookmarkBar;
+const char* const overlay_key = kBrowserWindowPlacement;
+const char* const regular_key = kShowBookmarkBar;
// With the removal of the kWebKitGlobalXXX prefs, we'll no longer have real
// prefs using the overlay pref store, so make up keys here.
-const char* mapped_overlay_key = "test.per_tab.javascript_enabled";
-const char* mapped_underlay_key = "test.per_profile.javascript_enabled";
+const char mapped_overlay_key[] = "test.per_tab.javascript_enabled";
+const char mapped_underlay_key[] = "test.per_profile.javascript_enabled";
} // namespace
diff --git a/base/prefs/persistent_pref_store.h b/base/prefs/persistent_pref_store.h
index 093ea8d..e70e2a6 100644
--- a/base/prefs/persistent_pref_store.h
+++ b/base/prefs/persistent_pref_store.h
@@ -68,7 +68,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 PrefStoreKeeper : public PrefStore::Observer {
public:
PrefStoreKeeper();
- virtual ~PrefStoreKeeper();
+ ~PrefStoreKeeper() override;
// Takes ownership of |pref_store|.
void Initialize(PrefValueStore* store,
@@ -161,8 +161,8 @@
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 @@
: 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
}
protected:
- virtual ~SingleThreadTaskRunner() {}
+ ~SingleThreadTaskRunner() override {}
};
} // namespace base
diff --git a/base/strings/string_util_unittest.cc b/base/strings/string_util_unittest.cc
index a3e8992..f29baac 100644
--- a/base/strings/string_util_unittest.cc
+++ b/base/strings/string_util_unittest.cc
@@ -461,7 +461,7 @@
}
TEST(StringUtilTest, ConvertASCII) {
- static const char* char_cases[] = {
+ static const char* const char_cases[] = {
"Google Video",
"Hello, world\n",
"0123ABCDwxyz \a\b\t\r\n!+,.~"
@@ -566,7 +566,7 @@
{99LL*1024*1024*1024, "99.0 GB"},
{105LL*1024*1024*1024, "105 GB"},
{105LL*1024*1024*1024 + 500LL*1024*1024, "105 GB"},
- {~(1LL<<63), "8192 PB"},
+ {~(1LL << 63), "8192 PB"},
{99*1024 + 103, "99.1 kB"},
{1024*1024 + 103, "1.0 MB"},
@@ -1153,7 +1153,7 @@
}
TEST(StringUtilTest, RemoveChars) {
- const char* kRemoveChars = "-/+*";
+ const char kRemoveChars[] = "-/+*";
std::string input = "A-+bc/d!*";
EXPECT_TRUE(RemoveChars(input, kRemoveChars, &input));
EXPECT_EQ("Abcd!", input);
diff --git a/base/strings/stringprintf_unittest.cc b/base/strings/stringprintf_unittest.cc
index a1bf2da..4935b55 100644
--- a/base/strings/stringprintf_unittest.cc
+++ b/base/strings/stringprintf_unittest.cc
@@ -106,7 +106,7 @@
src[i] = 'A';
src[1025] = 0;
- const char* fmt = "%sB%sB%sB%sB%sB%sB%s";
+ const char fmt[] = "%sB%sB%sB%sB%sB%sB%s";
std::string out;
SStringPrintf(&out, fmt, src, src, src, src, src, src, src);
@@ -132,14 +132,15 @@
// Test the boundary condition for the size of the string_util's
// internal buffer.
TEST(StringPrintfTest, GrowBoundary) {
- const int string_util_buf_len = 1024;
+ const int kStringUtilBufLen = 1024;
// Our buffer should be one larger than the size of StringAppendVT's stack
// buffer.
- const int buf_len = string_util_buf_len + 1;
- char src[buf_len + 1]; // Need extra one for NULL-terminator.
- for (int i = 0; i < buf_len; ++i)
+ // And need extra one for NULL-terminator.
+ const int kBufLen = kStringUtilBufLen + 1 + 1;
+ char src[kBufLen];
+ for (int i = 0; i < kBufLen - 1; ++i)
src[i] = 'a';
- src[buf_len] = 0;
+ src[kBufLen - 1] = 0;
std::string out;
SStringPrintf(&out, "%s", src);
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 @@
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 @@
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 @@
// 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 @@
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 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 @@
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 @@
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 @@
}
}
- 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 @@
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 @@
// 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 @@
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 @@
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 @@
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 @@
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 @@
}
// 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/sys_info_chromeos.cc b/base/sys_info_chromeos.cc
index d3a1b2c..ef5f1fe 100644
--- a/base/sys_info_chromeos.cc
+++ b/base/sys_info_chromeos.cc
@@ -21,7 +21,7 @@
namespace {
-const char* kLinuxStandardBaseVersionKeys[] = {
+const char* const kLinuxStandardBaseVersionKeys[] = {
"CHROMEOS_RELEASE_VERSION",
"GOOGLE_RELEASE",
"DISTRIB_RELEASE",
diff --git a/base/sys_info_unittest.cc b/base/sys_info_unittest.cc
index bfd8224..29409ee 100644
--- a/base/sys_info_unittest.cc
+++ b/base/sys_info_unittest.cc
@@ -71,7 +71,7 @@
int32 os_major_version = -1;
int32 os_minor_version = -1;
int32 os_bugfix_version = -1;
- const char* kLsbRelease =
+ const char kLsbRelease[] =
"FOO=1234123.34.5\n"
"CHROMEOS_RELEASE_VERSION=1.2.3.4\n";
base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time());
@@ -87,7 +87,7 @@
int32 os_major_version = -1;
int32 os_minor_version = -1;
int32 os_bugfix_version = -1;
- const char* kLsbRelease =
+ const char kLsbRelease[] =
"CHROMEOS_RELEASE_VERSION=1.2.3.4\n"
"FOO=1234123.34.5\n";
base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time());
@@ -103,7 +103,7 @@
int32 os_major_version = -1;
int32 os_minor_version = -1;
int32 os_bugfix_version = -1;
- const char* kLsbRelease = "FOO=1234123.34.5\n";
+ const char kLsbRelease[] = "FOO=1234123.34.5\n";
base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time());
base::SysInfo::OperatingSystemVersionNumbers(&os_major_version,
&os_minor_version,
@@ -114,7 +114,7 @@
}
TEST_F(SysInfoTest, GoogleChromeOSLsbReleaseTime) {
- const char* kLsbRelease = "CHROMEOS_RELEASE_VERSION=1.2.3.4";
+ const char kLsbRelease[] = "CHROMEOS_RELEASE_VERSION=1.2.3.4";
// Use a fake time that can be safely displayed as a string.
const base::Time lsb_release_time(base::Time::FromDoubleT(12345.6));
base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, lsb_release_time);
@@ -127,19 +127,19 @@
base::SysInfo::SetChromeOSVersionInfoForTest("", base::Time());
EXPECT_FALSE(base::SysInfo::IsRunningOnChromeOS());
- const char* kLsbRelease1 =
+ const char kLsbRelease1[] =
"CHROMEOS_RELEASE_NAME=Non Chrome OS\n"
"CHROMEOS_RELEASE_VERSION=1.2.3.4\n";
base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease1, base::Time());
EXPECT_FALSE(base::SysInfo::IsRunningOnChromeOS());
- const char* kLsbRelease2 =
+ const char kLsbRelease2[] =
"CHROMEOS_RELEASE_NAME=Chrome OS\n"
"CHROMEOS_RELEASE_VERSION=1.2.3.4\n";
base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease2, base::Time());
EXPECT_TRUE(base::SysInfo::IsRunningOnChromeOS());
- const char* kLsbRelease3 =
+ const char kLsbRelease3[] =
"CHROMEOS_RELEASE_NAME=Chromium OS\n";
base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease3, base::Time());
EXPECT_TRUE(base::SysInfo::IsRunningOnChromeOS());
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 @@
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/expectation_unittest.cc b/base/test/expectations/expectation_unittest.cc
index 8a7af71..c0f55a1 100644
--- a/base/test/expectations/expectation_unittest.cc
+++ b/base/test/expectations/expectation_unittest.cc
@@ -71,7 +71,7 @@
}
TEST(TestExpectationsFunctionsTest, IsValidPlatform) {
- const char* kValidPlatforms[] = {
+ const char* const kValidPlatforms[] = {
"Win",
"Win-XP",
"Win-Vista",
@@ -89,7 +89,7 @@
"Android",
};
- const char* kInvalidPlatforms[] = {
+ const char* const kInvalidPlatforms[] = {
"Solaris",
"Plan9",
};
diff --git a/base/test/expectations/parser_unittest.cc b/base/test/expectations/parser_unittest.cc
index a456458..074d634 100644
--- a/base/test/expectations/parser_unittest.cc
+++ b/base/test/expectations/parser_unittest.cc
@@ -15,16 +15,16 @@
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);
}
@@ -161,7 +161,7 @@
}
TEST_F(TestExpectationParserTest, SyntaxErrors) {
- const char* kErrors[] = {
+ const char* const kErrors[] = {
"Foo [ dfasd",
"Foo [Linux] # This is an illegal comment",
"Foo [Linux] Bar # Another illegal comment.",
@@ -184,7 +184,7 @@
}
TEST_F(TestExpectationParserTest, DataErrors) {
- const char* kOneError[] = {
+ const char* const kOneError[] = {
"http://crbug.com/1234 [MagicBrowzR] BadModifier = Timeout",
"________ [Linux] BadResult = WhatNow",
"http://wkb.ug/1234 [Debug Release Win-7] MultipleConfigs = Skip",
@@ -196,7 +196,7 @@
data_errors_.clear();
}
- const char* kTwoErrors[] = {
+ const char* const kTwoErrors[] = {
". [Mac-TurningIntoiOS] BadModifierVariant.BadResult = Foobar",
"1234 [ Debug Release OS/2 ] MultipleConfigs.BadModifier = Pass",
};
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 @@
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 @@
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 @@
use_job_objects_(use_job_objects) {
}
- virtual ~UnitTestLauncherDelegate() {
+ ~UnitTestLauncherDelegate() override {
DCHECK(thread_checker_.CalledOnValidThread());
}
@@ -118,16 +118,16 @@
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 @@
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 @@
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 @@
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 @@
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 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
void RunUntilIdle();
protected:
- virtual ~TestSimpleTaskRunner();
+ ~TestSimpleTaskRunner() override;
std::deque<TestPendingTask> pending_tasks_;
ThreadChecker thread_checker_;
diff --git a/base/test/trace_event_analyzer_unittest.cc b/base/test/trace_event_analyzer_unittest.cc
index 5604508..0edeb14 100644
--- a/base/test/trace_event_analyzer_unittest.cc
+++ b/base/test/trace_event_analyzer_unittest.cc
@@ -86,7 +86,7 @@
int int_num = 2;
double double_num = 3.5;
- const char* str = "the string";
+ const char str[] = "the string";
TraceEvent event;
event.arg_numbers["false"] = 0.0;
@@ -508,7 +508,7 @@
TEST_F(TraceEventAnalyzerTest, MergeAssociatedEventArgs) {
ManualSetUp();
- const char* arg_string = "arg_string";
+ const char arg_string[] = "arg_string";
BeginTracing();
{
TRACE_EVENT_BEGIN0("cat1", "name1");
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
// 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 @@
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 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 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 @@
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 @@
// 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 @@
#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 @@
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 @@
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 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 @@
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 @@
explicit QueueUser(NonThreadSafeQueue& queue)
: queue_(queue) {}
- virtual void Run() override {
+ void Run() override {
queue_.push(0);
queue_.pop();
}
@@ -209,7 +207,7 @@
explicit QueueUser(NonThreadSafeQueue& queue)
: queue_(queue) {}
- virtual void Run() override {
+ void Run() override {
queue_.push(0);
queue_.pop();
}
@@ -270,7 +268,7 @@
: queue_(queue),
lock_(lock) {}
- virtual void Run() override {
+ void Run() override {
{
base::AutoLock auto_lock(lock_);
queue_.push(0);
@@ -344,7 +342,7 @@
: 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_id_name_manager_unittest.cc b/base/threading/thread_id_name_manager_unittest.cc
index 3777301..b5953d5 100644
--- a/base/threading/thread_id_name_manager_unittest.cc
+++ b/base/threading/thread_id_name_manager_unittest.cc
@@ -13,8 +13,8 @@
namespace {
-static const char* kAThread = "a thread";
-static const char* kBThread = "b thread";
+const char kAThread[] = "a thread";
+const char kBThread[] = "b thread";
TEST_F(ThreadIdNameManagerTest, AddThreads) {
base::ThreadIdNameManager* manager = base::ThreadIdNameManager::GetInstance();
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 @@
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 @@
: tlp_(tlp),
done_(done) {
}
- virtual ~ThreadLocalTesterBase() {}
+ ~ThreadLocalTesterBase() override {}
protected:
TLPType* tlp_;
@@ -33,11 +33,11 @@
: 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 @@
: 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 @@
return threads_[count % threads_.size()];
}
- virtual void PingPong(int hops) override {
+ void PingPong(int hops) override {
if (!hops) {
FinishMeasurement();
return;
@@ -149,16 +149,14 @@
// 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 @@
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 @@
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 @@
}
// 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.cc b/base/threading/watchdog.cc
index 82c1875..769119e 100644
--- a/base/threading/watchdog.cc
+++ b/base/threading/watchdog.cc
@@ -153,7 +153,7 @@
watchdog_->state_ = DISARMED; // Only alarm at most once.
TimeTicks last_alarm_time = TimeTicks::Now();
{
- AutoUnlock lock(watchdog_->lock_);
+ AutoUnlock unlock(watchdog_->lock_);
watchdog_->Alarm(); // Set a break point here to debug on alarms.
}
TimeDelta last_alarm_delay = TimeTicks::Now() - last_alarm_time;
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 @@
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 @@
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 @@
}
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 @@
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 @@
: 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 @@
// 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 @@
// 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 @@
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 @@
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 @@
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 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 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 @@
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 @@
// 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 @@
// |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 @@
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 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 @@
};
// 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 @@
typedef ValueVector::const_iterator const_iterator;
ListValue();
- virtual ~ListValue();
+ ~ListValue() override;
// Clears the contents of this ListValue
void Clear();
@@ -476,10 +475,10 @@
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 @@
*deletion_flag_ = false;
}
- virtual ~DeletionTestValue() {
- *deletion_flag_ = true;
- }
+ ~DeletionTestValue() override { *deletion_flag_ = true; }
private:
bool* deletion_flag_;
diff --git a/base/win/win_util.cc b/base/win/win_util.cc
index 69e14e4..a53f30a 100644
--- a/base/win/win_util.cc
+++ b/base/win/win_util.cc
@@ -5,6 +5,7 @@
#include "base/win/win_util.h"
#include <aclapi.h>
+#include <cfgmgr32.h>
#include <lm.h>
#include <powrprof.h>
#include <shellapi.h>
@@ -14,6 +15,7 @@
#include <propkey.h>
#include <propvarutil.h>
#include <sddl.h>
+#include <setupapi.h>
#include <signal.h>
#include <stdlib.h>
@@ -53,6 +55,63 @@
L"Software\\Classes\\CLSID\\{054AAE20-4BEA-4347-8A35-64A533254A9D}"
L"\\LocalServer32";
+// Returns true if a physical keyboard is detected on Windows 8 and up.
+// Uses the Setup APIs to enumerate the attached keyboards and returns true
+// if the keyboard count is more than 1. While this will work in most cases
+// it won't work if there are devices which expose keyboard interfaces which
+// are attached to the machine.
+bool IsKeyboardPresentOnSlate() {
+ // This function is only supported for Windows 8 and up.
+ DCHECK(base::win::GetVersion() >= base::win::VERSION_WIN8);
+
+ // This function should be only invoked for machines with touch screens.
+ if ((GetSystemMetrics(SM_DIGITIZER) & NID_INTEGRATED_TOUCH)
+ != NID_INTEGRATED_TOUCH) {
+ return true;
+ }
+
+ const GUID KEYBOARD_CLASS_GUID =
+ { 0x4D36E96B, 0xE325, 0x11CE,
+ { 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18 } };
+
+ // Query for all the keyboard devices.
+ HDEVINFO device_info =
+ SetupDiGetClassDevs(&KEYBOARD_CLASS_GUID, NULL, NULL, DIGCF_PRESENT);
+ if (device_info == INVALID_HANDLE_VALUE)
+ return false;
+
+ // Enumerate all keyboards and look for ACPI\PNP and HID\VID devices. If
+ // the count is more than 1 we assume that a keyboard is present. This is
+ // under the assumption that there will always be one keyboard device.
+ int keyboard_count = 0;
+ for (DWORD i = 0;; ++i) {
+ SP_DEVINFO_DATA device_info_data = { 0 };
+ device_info_data.cbSize = sizeof(device_info_data);
+ if (!SetupDiEnumDeviceInfo(device_info, i, &device_info_data))
+ break;
+ // Get the device ID.
+ wchar_t device_id[MAX_DEVICE_ID_LEN];
+ CONFIGRET status = CM_Get_Device_ID(device_info_data.DevInst,
+ device_id,
+ MAX_DEVICE_ID_LEN,
+ 0);
+ if (status == CR_SUCCESS) {
+ // To reduce the scope of the hack we only look for PNP and HID
+ // keyboards.
+ if (StartsWith(L"ACPI\\PNP", device_id, false) ||
+ StartsWith(L"HID\\VID", device_id, false)) {
+ keyboard_count++;
+ }
+ }
+ }
+ // On a Windows machine, the API's always report 1 keyboard at least
+ // regardless of whether the machine has a keyboard attached or not.
+ // The heuristic we are using is to check the count and return true
+ // if the API's report more than one keyboard. Please note that this
+ // will break for non keyboard devices which expose a keyboard PDO.
+ return keyboard_count > 1;
+}
+
} // namespace
namespace base {
@@ -252,6 +311,9 @@
if (base::win::GetVersion() < base::win::VERSION_WIN8)
return false;
+ if (IsKeyboardPresentOnSlate())
+ return false;
+
static base::LazyInstance<string16>::Leaky osk_path =
LAZY_INSTANCE_INITIALIZER;