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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | ipc/ipc_message_utils_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ipc/ipc_message_utils.h" 5 #include "ipc/ipc_message_utils.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 break; 89 break;
90 case base::Value::TYPE_INTEGER: 90 case base::Value::TYPE_INTEGER:
91 sizer->AddInt(); 91 sizer->AddInt();
92 break; 92 break;
93 case base::Value::TYPE_DOUBLE: 93 case base::Value::TYPE_DOUBLE:
94 sizer->AddDouble(); 94 sizer->AddDouble();
95 break; 95 break;
96 case base::Value::TYPE_STRING: { 96 case base::Value::TYPE_STRING: {
97 const base::StringValue* result; 97 const base::StringValue* result;
98 value->GetAsString(&result); 98 value->GetAsString(&result);
99 DCHECK(result); 99 if (value->GetAsString(&result)) {
100 GetParamSize(sizer, result->GetString()); 100 DCHECK(result);
101 GetParamSize(sizer, result->GetString());
102 } else {
103 std::string str;
104 bool as_string_result = value->GetAsString(&str);
105 DCHECK(as_string_result);
106 GetParamSize(sizer, str);
107 }
101 break; 108 break;
102 } 109 }
103 case base::Value::TYPE_BINARY: { 110 case base::Value::TYPE_BINARY: {
104 const base::BinaryValue* binary = 111 const base::BinaryValue* binary =
105 static_cast<const base::BinaryValue*>(value); 112 static_cast<const base::BinaryValue*>(value);
106 sizer->AddData(static_cast<int>(binary->GetSize())); 113 sizer->AddData(static_cast<int>(binary->GetSize()));
107 break; 114 break;
108 } 115 }
109 case base::Value::TYPE_DICTIONARY: { 116 case base::Value::TYPE_DICTIONARY: {
110 sizer->AddInt(); 117 sizer->AddInt();
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 return result; 1225 return result;
1219 } 1226 }
1220 1227
1221 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { 1228 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) {
1222 l->append("<MSG>"); 1229 l->append("<MSG>");
1223 } 1230 }
1224 1231
1225 #endif // OS_WIN 1232 #endif // OS_WIN
1226 1233
1227 } // namespace IPC 1234 } // namespace IPC
OLDNEW
« 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