| Index: base/values.cc
|
| diff --git a/base/values.cc b/base/values.cc
|
| index 7a364bd8ff0f14402dac1ff80b5f6b72b656a9d2..12271df03b6cbe2c7d4ecdc5a7b7db071eb55224 100644
|
| --- a/base/values.cc
|
| +++ b/base/values.cc
|
| @@ -57,6 +57,14 @@ Value* CopyWithoutEmptyChildren(Value* node) {
|
| }
|
| }
|
|
|
| +class Null : public Value {
|
| + public:
|
| + Null() : Value(TYPE_NULL) {}
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(Null);
|
| +};
|
| +
|
| } // namespace
|
|
|
| namespace base {
|
| @@ -67,11 +75,6 @@ Value::~Value() {
|
| }
|
|
|
| // static
|
| -Value* Value::CreateNullValue() {
|
| - return new Value(TYPE_NULL);
|
| -}
|
| -
|
| -// static
|
| FundamentalValue* Value::CreateBooleanValue(bool in_value) {
|
| return new FundamentalValue(in_value);
|
| }
|
| @@ -128,7 +131,7 @@ Value* Value::DeepCopy() const {
|
| // This method should only be getting called for null Values--all subclasses
|
| // need to provide their own implementation;.
|
| DCHECK(IsType(TYPE_NULL));
|
| - return CreateNullValue();
|
| + return NullValue();
|
| }
|
|
|
| bool Value::Equals(const Value* other) const {
|
| @@ -148,7 +151,21 @@ bool Value::Equals(const Value* a, const Value* b) {
|
| Value::Value(Type type) : type_(type) {
|
| }
|
|
|
| -///////////////////// FundamentalValue ////////////////////
|
| +// Helper functions ------------------------------------------------------------
|
| +
|
| +Value* NullValue() {
|
| + return new Null();
|
| +}
|
| +
|
| +FundamentalValue* TrueValue() {
|
| + return new FundamentalValue(true);
|
| +}
|
| +
|
| +FundamentalValue* FalseValue() {
|
| + return new FundamentalValue(false);
|
| +}
|
| +
|
| +// FundamentalValue ------------------------------------------------------------
|
|
|
| FundamentalValue::FundamentalValue(bool in_value)
|
| : Value(TYPE_BOOLEAN), boolean_value_(in_value) {
|
| @@ -225,7 +242,7 @@ bool FundamentalValue::Equals(const Value* other) const {
|
| }
|
| }
|
|
|
| -///////////////////// StringValue ////////////////////
|
| +// StringValue -----------------------------------------------------------------
|
|
|
| StringValue::StringValue(const std::string& in_value)
|
| : Value(TYPE_STRING),
|
| @@ -264,7 +281,7 @@ bool StringValue::Equals(const Value* other) const {
|
| return GetAsString(&lhs) && other->GetAsString(&rhs) && lhs == rhs;
|
| }
|
|
|
| -///////////////////// BinaryValue ////////////////////
|
| +// BinaryValue -----------------------------------------------------------------
|
|
|
| BinaryValue::~BinaryValue() {
|
| DCHECK(buffer_);
|
| @@ -311,7 +328,7 @@ BinaryValue::BinaryValue(char* buffer, size_t size)
|
| DCHECK(buffer_);
|
| }
|
|
|
| -///////////////////// DictionaryValue ////////////////////
|
| +// DictionaryValue -------------------------------------------------------------
|
|
|
| DictionaryValue::DictionaryValue()
|
| : Value(TYPE_DICTIONARY) {
|
| @@ -687,7 +704,7 @@ bool DictionaryValue::Equals(const Value* other) const {
|
| return true;
|
| }
|
|
|
| -///////////////////// ListValue ////////////////////
|
| +// ListValue -------------------------------------------------------------------
|
|
|
| ListValue::ListValue() : Value(TYPE_LIST) {
|
| }
|
| @@ -709,7 +726,7 @@ bool ListValue::Set(size_t index, Value* in_value) {
|
| if (index >= list_.size()) {
|
| // Pad out any intermediate indexes with null settings
|
| while (index > list_.size())
|
| - Append(CreateNullValue());
|
| + Append(NullValue());
|
| Append(in_value);
|
| } else {
|
| DCHECK(list_[index] != in_value);
|
| @@ -899,7 +916,4 @@ bool ListValue::Equals(const Value* other) const {
|
| return true;
|
| }
|
|
|
| -ValueSerializer::~ValueSerializer() {
|
| -}
|
| -
|
| } // namespace base
|
|
|