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

Unified Diff: ipc/ipc_message_utils.cc

Issue 1866633002: Make IPC::ParamTraits<>GetSize work with base::Value as a result of JSON parsing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months 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 | ipc/ipc_message_utils_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_message_utils.cc
diff --git a/ipc/ipc_message_utils.cc b/ipc/ipc_message_utils.cc
index 2420bdb1f1aac600b9937e025b364358c6b9702d..9edc3bbd4cd513eb92783ff8d12738c3c49aedf1 100644
--- a/ipc/ipc_message_utils.cc
+++ b/ipc/ipc_message_utils.cc
@@ -96,8 +96,15 @@ void GetValueSize(base::PickleSizer* sizer,
case base::Value::TYPE_STRING: {
const base::StringValue* result;
value->GetAsString(&result);
- DCHECK(result);
- GetParamSize(sizer, result->GetString());
+ if (value->GetAsString(&result)) {
+ DCHECK(result);
+ GetParamSize(sizer, result->GetString());
+ } else {
+ std::string str;
+ bool as_string_result = value->GetAsString(&str);
+ DCHECK(as_string_result);
+ GetParamSize(sizer, str);
+ }
break;
}
case base::Value::TYPE_BINARY: {
« no previous file with comments | « no previous file | ipc/ipc_message_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698