From e8a8e30b25782048a766f9d8ac9133406a013f47 Mon Sep 17 00:00:00 2001 From: Alex Vakulenko Date: Thu, 14 Aug 2014 12:56:21 -0700 Subject: [PATCH] metrics: Replace 'OVERRIDE' with 'override' and fix linter Replace OVERRIDE macro with native C++ 'override' keyword. Also fixed the style issue of using both 'override' and 'virtual' on member function overrides. Only one is required and cpplint complains if both are specified now. And since gobi-chromo-plugin is the only project that uses libmetrics and is not C++11 yet, enabled C++11 features in its makefile to allow for the 'override' keywords to compile in the included metrics/metrics_library.h header. BUG=None TEST=USE="cellular buffet" ./build_packages Change-Id: I28dace6dc4bcb07386632eaed890ce41564e8144 Reviewed-on: https://chromium-review.googlesource.com/212494 Reviewed-by: Ben Chan Commit-Queue: Alex Vakulenko Tested-by: Alex Vakulenko --- metrics/metrics_library.h | 10 ++++------ metrics/persistent_integer_test.cc | 4 ++-- metrics/uploader/curl_sender.h | 3 +-- metrics/uploader/mock/mock_system_profile_setter.h | 2 +- metrics/uploader/mock/sender_mock.h | 2 +- metrics/uploader/system_profile_cache.h | 2 +- metrics/uploader/upload_service.h | 8 ++++---- 7 files changed, 14 insertions(+), 17 deletions(-) diff --git a/metrics/metrics_library.h b/metrics/metrics_library.h index 9e4be89b2..97b2b72e2 100644 --- a/metrics/metrics_library.h +++ b/metrics/metrics_library.h @@ -34,7 +34,7 @@ class MetricsLibrary : public MetricsLibraryInterface { virtual ~MetricsLibrary(); // Initializes the library. - virtual void Init() OVERRIDE; + void Init() override; // Returns whether or not the machine is running in guest mode. bool IsGuestMode(); @@ -76,15 +76,13 @@ class MetricsLibrary : public MetricsLibraryInterface { // histogram is proportional to the number of buckets. Therefore, it // is strongly recommended to keep this number low (e.g., 50 is // normal, while 100 is high). - virtual bool SendEnumToUMA(const std::string& name, - int sample, - int max) OVERRIDE; + bool SendEnumToUMA(const std::string& name, int sample, int max) override; // Sends sparse histogram sample to Chrome for transport to UMA. Returns // true on success. // // |sample| is the 32-bit integer value to be recorded. - virtual bool SendSparseToUMA(const std::string& name, int sample) OVERRIDE; + bool SendSparseToUMA(const std::string& name, int sample) override; // Sends a user action to Chrome for transport to UMA and returns true on // success. This method results in the equivalent of an asynchronous @@ -96,7 +94,7 @@ class MetricsLibrary : public MetricsLibraryInterface { // chrome/browser/chromeos/external_metrics.cc. // // |action| is the user-generated event (e.g., "MuteKeyPressed"). - virtual bool SendUserActionToUMA(const std::string& action) OVERRIDE; + bool SendUserActionToUMA(const std::string& action) override; // Sends a signal to UMA that a crash of the given |crash_kind| // has occurred. Used by UMA to generate stability statistics. diff --git a/metrics/persistent_integer_test.cc b/metrics/persistent_integer_test.cc index 7d9e21c4a..097ec7da6 100644 --- a/metrics/persistent_integer_test.cc +++ b/metrics/persistent_integer_test.cc @@ -16,12 +16,12 @@ const char kBackingFilePattern[] = "*.pibakf"; using chromeos_metrics::PersistentInteger; class PersistentIntegerTest : public testing::Test { - virtual void SetUp() OVERRIDE { + void SetUp() override { // Set testing mode. chromeos_metrics::PersistentInteger::SetTestingMode(true); } - virtual void TearDown() OVERRIDE { + void TearDown() override { // Remove backing files. The convention is that they all end in ".pibakf". base::FileEnumerator f_enum(base::FilePath("."), false, diff --git a/metrics/uploader/curl_sender.h b/metrics/uploader/curl_sender.h index 011360139..fc5b0f481 100644 --- a/metrics/uploader/curl_sender.h +++ b/metrics/uploader/curl_sender.h @@ -17,8 +17,7 @@ class CurlSender : public Sender { // Sends |content| whose SHA1 hash is |hash| to server_url with a synchronous // POST request to server_url. - virtual bool Send(const std::string& content, - const std::string& hash) OVERRIDE; + bool Send(const std::string& content, const std::string& hash) override; // Static callback required by curl to retrieve the response data. // diff --git a/metrics/uploader/mock/mock_system_profile_setter.h b/metrics/uploader/mock/mock_system_profile_setter.h index 0614eb913..c6e8f0d1e 100644 --- a/metrics/uploader/mock/mock_system_profile_setter.h +++ b/metrics/uploader/mock/mock_system_profile_setter.h @@ -14,7 +14,7 @@ class ChromeUserMetricsExtension; // Mock profile setter used for testing. class MockSystemProfileSetter : public SystemProfileSetter { public: - void Populate(metrics::ChromeUserMetricsExtension* profile_proto) OVERRIDE {} + void Populate(metrics::ChromeUserMetricsExtension* profile_proto) override {} }; #endif // METRICS_UPLOADER_MOCK_MOCK_SYSTEM_PROFILE_SETTER_H_ diff --git a/metrics/uploader/mock/sender_mock.h b/metrics/uploader/mock/sender_mock.h index f6f19b9a2..4845f9dc5 100644 --- a/metrics/uploader/mock/sender_mock.h +++ b/metrics/uploader/mock/sender_mock.h @@ -15,7 +15,7 @@ class SenderMock : public Sender { public: SenderMock(); - bool Send(const std::string& content, const std::string& hash) OVERRIDE; + bool Send(const std::string& content, const std::string& hash) override; void Reset(); bool is_good_proto() { return is_good_proto_; } diff --git a/metrics/uploader/system_profile_cache.h b/metrics/uploader/system_profile_cache.h index 28391798f..03e92fca5 100644 --- a/metrics/uploader/system_profile_cache.h +++ b/metrics/uploader/system_profile_cache.h @@ -39,7 +39,7 @@ class SystemProfileCache : public SystemProfileSetter { SystemProfileCache(); // Populates the ProfileSystem protobuf with system information. - void Populate(metrics::ChromeUserMetricsExtension* profile_proto) OVERRIDE; + void Populate(metrics::ChromeUserMetricsExtension* profile_proto) override; // Converts a string representation of the channel (|channel|-channel) to a // SystemProfileProto_Channel diff --git a/metrics/uploader/upload_service.h b/metrics/uploader/upload_service.h index 7c1748869..ed5ab8526 100644 --- a/metrics/uploader/upload_service.h +++ b/metrics/uploader/upload_service.h @@ -74,10 +74,10 @@ class UploadService : public base::HistogramFlattener { // Implements inconsistency detection to match HistogramFlattener's // interface. void InconsistencyDetected( - base::HistogramBase::Inconsistency problem) OVERRIDE {} + base::HistogramBase::Inconsistency problem) override {} void UniqueInconsistencyDetected( - base::HistogramBase::Inconsistency problem) OVERRIDE {} - void InconsistencyDetectedInLoggedCount(int amount) OVERRIDE {} + base::HistogramBase::Inconsistency problem) override {} + void InconsistencyDetectedInLoggedCount(int amount) override {} private: friend class UploadServiceTest; @@ -117,7 +117,7 @@ class UploadService : public base::HistogramFlattener { // Callback for HistogramSnapshotManager to store the histograms. void RecordDelta(const base::HistogramBase& histogram, - const base::HistogramSamples& snapshot) OVERRIDE; + const base::HistogramSamples& snapshot) override; // Compiles all the samples received into a single protobuf and adds all // system information.