Index: base/values.h |
diff --git a/base/values.h b/base/values.h |
index 8caf8350a8bfc76b00b96044213b55912466031f..cf00f869435462abe17fb6a5f703c7dd22bdd34a 100644 |
--- a/base/values.h |
+++ b/base/values.h |
@@ -91,6 +91,7 @@ class BASE_EXPORT Value { |
virtual bool GetAsDouble(double* out_value) const; |
virtual bool GetAsString(std::string* out_value) const; |
virtual bool GetAsString(string16* out_value) const; |
+ virtual bool GetAsStringValue(const StringValue** out_value) const; |
brettw
2014/01/28 03:00:24
This new name seems good but it doesn't follow the
|
virtual bool GetAsList(ListValue** out_value); |
virtual bool GetAsList(const ListValue** out_value) const; |
virtual bool GetAsDictionary(DictionaryValue** out_value); |
@@ -152,16 +153,22 @@ class BASE_EXPORT StringValue : public Value { |
// Initializes a StringValue with a string16. |
explicit StringValue(const string16& in_value); |
+ // Creates a string value that takes ownership of a string. |
+ explicit StringValue(scoped_ptr<std::string> in_value); |
+ |
virtual ~StringValue(); |
// Overridden from Value: |
virtual bool GetAsString(std::string* out_value) const OVERRIDE; |
virtual bool GetAsString(string16* out_value) const OVERRIDE; |
+ virtual bool GetAsStringValue(const StringValue** out_value) const OVERRIDE; |
virtual StringValue* DeepCopy() const OVERRIDE; |
virtual bool Equals(const Value* other) const OVERRIDE; |
+ const std::string& value() const { return *value_; } |
+ |
private: |
- std::string value_; |
+ scoped_ptr<std::string> value_; |
brettw
2014/01/28 03:00:24
I assume you did this to avoid the extra copy when
Evan Stade
2014/01/28 18:37:36
yes
Evan Stade
2014/01/28 18:43:35
Actually, it looks like StringPiece can't return a
Evan Stade
2014/01/28 18:48:45
Well, even in lieu of that other optimization, I s
|
}; |
class BASE_EXPORT BinaryValue: public Value { |