diff options
author | dcheng <dcheng@chromium.org> | 2014-10-21 03:54:51 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-21 10:55:12 +0000 |
commit | 5648818ef9d5ef5fda79cd5dde2e42567af07785 (patch) | |
tree | c7a0e1c173409ad3a70736413504d6ba3c2b0422 /base/json | |
parent | 08038795458017a039565cfa158f0c379f91a007 (diff) | |
download | chromium_src-5648818ef9d5ef5fda79cd5dde2e42567af07785.zip chromium_src-5648818ef9d5ef5fda79cd5dde2e42567af07785.tar.gz chromium_src-5648818ef9d5ef5fda79cd5dde2e42567af07785.tar.bz2 |
Standardize usage of virtual/override/final in base/
BUG=417463
TBR=danakj@chromium.org
Review URL: https://codereview.chromium.org/668783004
Cr-Commit-Position: refs/heads/master@{#300447}
Diffstat (limited to 'base/json')
-rw-r--r-- | base/json/json_file_value_serializer.h | 8 | ||||
-rw-r--r-- | base/json/json_parser.cc | 18 | ||||
-rw-r--r-- | base/json/json_string_value_serializer.h | 8 |
3 files changed, 17 insertions, 17 deletions
diff --git a/base/json/json_file_value_serializer.h b/base/json/json_file_value_serializer.h index 642729f..f0f556c 100644 --- a/base/json/json_file_value_serializer.h +++ b/base/json/json_file_value_serializer.h @@ -22,7 +22,7 @@ class BASE_EXPORT JSONFileValueSerializer : public base::ValueSerializer { : json_file_path_(json_file_path), allow_trailing_comma_(false) {} - virtual ~JSONFileValueSerializer() {} + ~JSONFileValueSerializer() override {} // DO NOT USE except in unit tests to verify the file was written properly. // We should never serialize directly to a file since this will block the @@ -32,7 +32,7 @@ class BASE_EXPORT JSONFileValueSerializer : public base::ValueSerializer { // Attempt to serialize the data structure represented by Value into // JSON. If the return value is true, the result will have been written // into the file whose name was passed into the constructor. - virtual bool Serialize(const base::Value& root) override; + bool Serialize(const base::Value& root) override; // Equivalent to Serialize(root) except binary values are omitted from the // output. @@ -45,8 +45,8 @@ class BASE_EXPORT JSONFileValueSerializer : public base::ValueSerializer { // If |error_message| is non-null, it will be filled in with a formatted // error message including the location of the error if appropriate. // The caller takes ownership of the returned value. - virtual base::Value* Deserialize(int* error_code, - std::string* error_message) override; + base::Value* Deserialize(int* error_code, + std::string* error_message) override; // This enum is designed to safely overlap with JSONReader::JsonParseError. enum JsonFileError { diff --git a/base/json/json_parser.cc b/base/json/json_parser.cc index 5e59a46..6a25bc7 100644 --- a/base/json/json_parser.cc +++ b/base/json/json_parser.cc @@ -37,7 +37,7 @@ class DictionaryHiddenRootValue : public base::DictionaryValue { DictionaryValue::Swap(static_cast<DictionaryValue*>(root)); } - virtual void Swap(DictionaryValue* other) override { + void Swap(DictionaryValue* other) override { DVLOG(1) << "Swap()ing a DictionaryValue inefficiently."; // First deep copy to convert JSONStringValue to std::string and swap that @@ -55,8 +55,8 @@ class DictionaryHiddenRootValue : public base::DictionaryValue { // Not overriding DictionaryValue::Remove because it just calls through to // the method below. - virtual bool RemoveWithoutPathExpansion(const std::string& key, - scoped_ptr<Value>* out) override { + bool RemoveWithoutPathExpansion(const std::string& key, + scoped_ptr<Value>* out) override { // If the caller won't take ownership of the removed value, just call up. if (!out) return DictionaryValue::RemoveWithoutPathExpansion(key, out); @@ -87,7 +87,7 @@ class ListHiddenRootValue : public base::ListValue { ListValue::Swap(static_cast<ListValue*>(root)); } - virtual void Swap(ListValue* other) override { + void Swap(ListValue* other) override { DVLOG(1) << "Swap()ing a ListValue inefficiently."; // First deep copy to convert JSONStringValue to std::string and swap that @@ -102,7 +102,7 @@ class ListHiddenRootValue : public base::ListValue { ListValue::Swap(copy.get()); } - virtual bool Remove(size_t index, scoped_ptr<Value>* out) override { + bool Remove(size_t index, scoped_ptr<Value>* out) override { // If the caller won't take ownership of the removed value, just call up. if (!out) return ListValue::Remove(index, out); @@ -137,18 +137,18 @@ class JSONStringValue : public base::Value { } // Overridden from base::Value: - virtual bool GetAsString(std::string* out_value) const override { + bool GetAsString(std::string* out_value) const override { string_piece_.CopyToString(out_value); return true; } - virtual bool GetAsString(string16* out_value) const override { + bool GetAsString(string16* out_value) const override { *out_value = UTF8ToUTF16(string_piece_); return true; } - virtual Value* DeepCopy() const override { + Value* DeepCopy() const override { return new StringValue(string_piece_.as_string()); } - virtual bool Equals(const Value* other) const override { + bool Equals(const Value* other) const override { std::string other_string; return other->IsType(TYPE_STRING) && other->GetAsString(&other_string) && StringPiece(other_string) == string_piece_; diff --git a/base/json/json_string_value_serializer.h b/base/json/json_string_value_serializer.h index 7fc5c6e..6435051 100644 --- a/base/json/json_string_value_serializer.h +++ b/base/json/json_string_value_serializer.h @@ -33,12 +33,12 @@ class BASE_EXPORT JSONStringValueSerializer : public base::ValueSerializer { allow_trailing_comma_(false) { } - virtual ~JSONStringValueSerializer(); + ~JSONStringValueSerializer() override; // Attempt to serialize the data structure represented by Value into // JSON. If the return value is true, the result will have been written // into the string passed into the constructor. - virtual bool Serialize(const base::Value& root) override; + bool Serialize(const base::Value& root) override; // Equivalent to Serialize(root) except binary values are omitted from the // output. @@ -51,8 +51,8 @@ class BASE_EXPORT JSONStringValueSerializer : public base::ValueSerializer { // If |error_message| is non-null, it will be filled in with a formatted // error message including the location of the error if appropriate. // The caller takes ownership of the returned value. - virtual base::Value* Deserialize(int* error_code, - std::string* error_message) override; + base::Value* Deserialize(int* error_code, + std::string* error_message) override; void set_pretty_print(bool new_value) { pretty_print_ = new_value; } bool pretty_print() { return pretty_print_; } |