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

Side by Side Diff: ipc/ipc_message_utils.cc

Issue 2841623003: Remove base::Value::Get{Buffer,Size} (Closed)
Patch Set: std::vector::assign instead of std::vector::operator= Created 3 years, 7 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/browser/api/socket/socket_api.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 sizer->AddData(static_cast<int>(value->GetSize())); 113 sizer->AddData(static_cast<int>(value->GetBlob().size()));
114 break; 114 break;
115 } 115 }
116 case base::Value::Type::DICTIONARY: { 116 case base::Value::Type::DICTIONARY: {
117 sizer->AddInt(); 117 sizer->AddInt();
118 const base::DictionaryValue* dict = 118 const base::DictionaryValue* dict =
119 static_cast<const base::DictionaryValue*>(value); 119 static_cast<const base::DictionaryValue*>(value);
120 for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); 120 for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd();
121 it.Advance()) { 121 it.Advance()) {
122 GetParamSize(sizer, it.key()); 122 GetParamSize(sizer, it.key());
123 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
171 break; 171 break;
172 } 172 }
173 case base::Value::Type::STRING: { 173 case base::Value::Type::STRING: {
174 std::string val; 174 std::string val;
175 result = value->GetAsString(&val); 175 result = value->GetAsString(&val);
176 DCHECK(result); 176 DCHECK(result);
177 WriteParam(m, val); 177 WriteParam(m, val);
178 break; 178 break;
179 } 179 }
180 case base::Value::Type::BINARY: { 180 case base::Value::Type::BINARY: {
181 m->WriteData(value->GetBuffer(), static_cast<int>(value->GetSize())); 181 m->WriteData(value->GetBlob().data(),
182 static_cast<int>(value->GetBlob().size()));
182 break; 183 break;
183 } 184 }
184 case base::Value::Type::DICTIONARY: { 185 case base::Value::Type::DICTIONARY: {
185 const base::DictionaryValue* dict = 186 const base::DictionaryValue* dict =
186 static_cast<const base::DictionaryValue*>(value); 187 static_cast<const base::DictionaryValue*>(value);
187 188
188 WriteParam(m, static_cast<int>(dict->size())); 189 WriteParam(m, static_cast<int>(dict->size()));
189 190
190 for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); 191 for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd();
191 it.Advance()) { 192 it.Advance()) {
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 return result; 1230 return result;
1230 } 1231 }
1231 1232
1232 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { 1233 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) {
1233 l->append("<MSG>"); 1234 l->append("<MSG>");
1234 } 1235 }
1235 1236
1236 #endif // OS_WIN 1237 #endif // OS_WIN
1237 1238
1238 } // namespace IPC 1239 } // namespace IPC
OLDNEW
« no previous file with comments | « extensions/browser/api/socket/socket_api.cc ('k') | media/base/video_frame_metadata.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698