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

Unified Diff: base/json/json_parser.cc

Issue 2539363004: Make base::Value::TYPE a scoped enum. (Closed)
Patch Set: Rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « android_webview/browser/aw_browser_policy_connector.cc ('k') | base/json/json_parser_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/json/json_parser.cc
diff --git a/base/json/json_parser.cc b/base/json/json_parser.cc
index cd427da9ea2537fa86c103452d72505731ab6129..1850a1a3f66e2dc4814235c75d3b8190bef794f9 100644
--- a/base/json/json_parser.cc
+++ b/base/json/json_parser.cc
@@ -39,7 +39,7 @@ class DictionaryHiddenRootValue : public DictionaryValue {
DictionaryHiddenRootValue(std::unique_ptr<std::string> json,
std::unique_ptr<Value> root)
: json_(std::move(json)) {
- DCHECK(root->IsType(Value::TYPE_DICTIONARY));
+ DCHECK(root->IsType(Value::Type::DICTIONARY));
DictionaryValue::Swap(static_cast<DictionaryValue*>(root.get()));
}
@@ -91,7 +91,7 @@ class ListHiddenRootValue : public ListValue {
ListHiddenRootValue(std::unique_ptr<std::string> json,
std::unique_ptr<Value> root)
: json_(std::move(json)) {
- DCHECK(root->IsType(Value::TYPE_LIST));
+ DCHECK(root->IsType(Value::Type::LIST));
ListValue::Swap(static_cast<ListValue*>(root.get()));
}
@@ -140,7 +140,7 @@ class ListHiddenRootValue : public ListValue {
class JSONStringValue : public Value {
public:
explicit JSONStringValue(StringPiece piece)
- : Value(TYPE_STRING), string_piece_(piece) {}
+ : Value(Type::STRING), string_piece_(piece) {}
// Overridden from Value:
bool GetAsString(std::string* out_value) const override {
@@ -154,8 +154,8 @@ class JSONStringValue : public Value {
Value* DeepCopy() const override { return new StringValue(string_piece_); }
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_;
+ return other->IsType(Type::STRING) && other->GetAsString(&other_string) &&
+ StringPiece(other_string) == string_piece_;
}
private:
@@ -255,15 +255,15 @@ std::unique_ptr<Value> JSONParser::Parse(StringPiece input) {
// Dictionaries and lists can contain JSONStringValues, so wrap them in a
// hidden root.
if (!(options_ & JSON_DETACHABLE_CHILDREN)) {
- if (root->IsType(Value::TYPE_DICTIONARY)) {
+ if (root->IsType(Value::Type::DICTIONARY)) {
return MakeUnique<DictionaryHiddenRootValue>(std::move(input_copy),
std::move(root));
}
- if (root->IsType(Value::TYPE_LIST)) {
+ if (root->IsType(Value::Type::LIST)) {
return MakeUnique<ListHiddenRootValue>(std::move(input_copy),
std::move(root));
}
- if (root->IsType(Value::TYPE_STRING)) {
+ if (root->IsType(Value::Type::STRING)) {
// A string type could be a JSONStringValue, but because there's no
// corresponding HiddenRootValue, the memory will be lost. Deep copy to
// preserve it.
« no previous file with comments | « android_webview/browser/aw_browser_policy_connector.cc ('k') | base/json/json_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698