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

Side by Side Diff: ipc/ipc_message_utils.cc

Issue 2689673002: Inline base::BinaryValue into base::Value (Closed)
Patch Set: Rebase Created 3 years, 10 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 | « extensions/renderer/argument_spec_unittest.cc ('k') | media/base/video_frame_metadata.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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 GetParamSize(sizer, result->GetString()); 103 GetParamSize(sizer, result->GetString());
104 } else { 104 } else {
105 std::string str; 105 std::string str;
106 bool as_string_result = value->GetAsString(&str); 106 bool as_string_result = value->GetAsString(&str);
107 DCHECK(as_string_result); 107 DCHECK(as_string_result);
108 GetParamSize(sizer, str); 108 GetParamSize(sizer, str);
109 } 109 }
110 break; 110 break;
111 } 111 }
112 case base::Value::Type::BINARY: { 112 case base::Value::Type::BINARY: {
113 const base::BinaryValue* binary = 113 sizer->AddData(static_cast<int>(value->GetSize()));
114 static_cast<const base::BinaryValue*>(value);
115 sizer->AddData(static_cast<int>(binary->GetSize()));
116 break; 114 break;
117 } 115 }
118 case base::Value::Type::DICTIONARY: { 116 case base::Value::Type::DICTIONARY: {
119 sizer->AddInt(); 117 sizer->AddInt();
120 const base::DictionaryValue* dict = 118 const base::DictionaryValue* dict =
121 static_cast<const base::DictionaryValue*>(value); 119 static_cast<const base::DictionaryValue*>(value);
122 for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); 120 for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd();
123 it.Advance()) { 121 it.Advance()) {
124 GetParamSize(sizer, it.key()); 122 GetParamSize(sizer, it.key());
125 GetValueSize(sizer, &it.value(), recursion + 1); 123 GetValueSize(sizer, &it.value(), recursion + 1);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 break; 171 break;
174 } 172 }
175 case base::Value::Type::STRING: { 173 case base::Value::Type::STRING: {
176 std::string val; 174 std::string val;
177 result = value->GetAsString(&val); 175 result = value->GetAsString(&val);
178 DCHECK(result); 176 DCHECK(result);
179 WriteParam(m, val); 177 WriteParam(m, val);
180 break; 178 break;
181 } 179 }
182 case base::Value::Type::BINARY: { 180 case base::Value::Type::BINARY: {
183 const base::BinaryValue* binary = 181 m->WriteData(value->GetBuffer(), static_cast<int>(value->GetSize()));
184 static_cast<const base::BinaryValue*>(value);
185 m->WriteData(binary->GetBuffer(), static_cast<int>(binary->GetSize()));
186 break; 182 break;
187 } 183 }
188 case base::Value::Type::DICTIONARY: { 184 case base::Value::Type::DICTIONARY: {
189 const base::DictionaryValue* dict = 185 const base::DictionaryValue* dict =
190 static_cast<const base::DictionaryValue*>(value); 186 static_cast<const base::DictionaryValue*>(value);
191 187
192 WriteParam(m, static_cast<int>(dict->size())); 188 WriteParam(m, static_cast<int>(dict->size()));
193 189
194 for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); 190 for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd();
195 it.Advance()) { 191 it.Advance()) {
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 return result; 1229 return result;
1234 } 1230 }
1235 1231
1236 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { 1232 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) {
1237 l->append("<MSG>"); 1233 l->append("<MSG>");
1238 } 1234 }
1239 1235
1240 #endif // OS_WIN 1236 #endif // OS_WIN
1241 1237
1242 } // namespace IPC 1238 } // namespace IPC
OLDNEW
« no previous file with comments | « extensions/renderer/argument_spec_unittest.cc ('k') | media/base/video_frame_metadata.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698