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

Unified Diff: base/json/json_value_serializer.h

Issue 8505033: Allow JSONWriter and JSONValueSerializer to omit binary values when instructed to do so. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove extra virtual. Created 9 years, 1 month 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 | « no previous file | base/json/json_value_serializer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/json/json_value_serializer.h
diff --git a/base/json/json_value_serializer.h b/base/json/json_value_serializer.h
index 650008ec235aab6d356098b7c8c5bde0c1f7b224..aa84677163de404e1396c3e359e5f93507d447bb 100644
--- a/base/json/json_value_serializer.h
+++ b/base/json/json_value_serializer.h
@@ -36,10 +36,16 @@ class BASE_EXPORT JSONStringValueSerializer : public base::ValueSerializer {
virtual ~JSONStringValueSerializer();
+ // Equivalent to calling Serialize(root, false).
willchan no longer on Chromium 2011/11/10 23:46:29 Comments are off.
Eric Dingle 2011/11/14 19:03:56 Done.
+ virtual bool Serialize(const Value& root) 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 Value& root);
+ // into the string passed into the constructor. |omit_binary_values| is
+ // used to indicate how the serializer should behave when encountering a
+ // binary value.
+ bool SerializeWithOptionalBinaryValues(const Value& root,
willchan no longer on Chromium 2011/11/10 23:46:29 There's no reason to use this except when we want
Eric Dingle 2011/11/14 19:03:56 Done.
+ bool omit_binary_values);
// Attempt to deserialize the data structure encoded in the string passed
// in to the constructor into a structure of Value objects. If the return
@@ -48,7 +54,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 Value* Deserialize(int* error_code, std::string* error_message);
+ virtual 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_; }
@@ -78,6 +85,9 @@ class BASE_EXPORT JSONFileValueSerializer : public base::ValueSerializer {
virtual ~JSONFileValueSerializer() {}
+ // Equivalent to calling Serialize(root, false).
willchan no longer on Chromium 2011/11/10 23:46:29 Comments are off.
Eric Dingle 2011/11/14 19:03:56 Done.
+ virtual bool Serialize(const Value& root) 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
// thread. Instead, serialize to a string and write to the file you want on
@@ -86,7 +96,8 @@ 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 Value& root);
+ bool SerializeWithOptionalBinaryValues(const Value& root,
+ bool omit_binary_values);
// Attempt to deserialize the data structure encoded in the file passed
// in to the constructor into a structure of Value objects. If the return
@@ -95,7 +106,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 Value* Deserialize(int* error_code, std::string* error_message);
+ virtual Value* Deserialize(int* error_code, std::string* error_message)
+ OVERRIDE;
// This enum is designed to safely overlap with JSONReader::JsonParseError.
enum JsonFileError {
« no previous file with comments | « no previous file | base/json/json_value_serializer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698