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

Side by Side Diff: ipc/ipc_message_utils.cc

Issue 1418743006: ipc: Add ParamTraits<signed char> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Change ordering Created 5 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 unified diff | Download patch
« no previous file with comments | « ipc/ipc_message_utils.h ('k') | no next file » | 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 "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/nullable_string16.h" 10 #include "base/strings/nullable_string16.h"
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 dispatch(0) { 267 dispatch(0) {
268 } 268 }
269 269
270 LogData::~LogData() { 270 LogData::~LogData() {
271 } 271 }
272 272
273 void ParamTraits<bool>::Log(const param_type& p, std::string* l) { 273 void ParamTraits<bool>::Log(const param_type& p, std::string* l) {
274 l->append(p ? "true" : "false"); 274 l->append(p ? "true" : "false");
275 } 275 }
276 276
277 void ParamTraits<signed char>::Write(Message* m, const param_type& p) {
278 m->WriteBytes(&p, sizeof(param_type));
279 }
280
281 bool ParamTraits<signed char>::Read(const Message* m,
282 base::PickleIterator* iter,
283 param_type* r) {
284 const char* data;
285 if (!iter->ReadBytes(&data, sizeof(param_type)))
286 return false;
287 memcpy(r, data, sizeof(param_type));
288 return true;
289 }
290
291 void ParamTraits<signed char>::Log(const param_type& p, std::string* l) {
292 l->append(base::IntToString(p));
293 }
294
277 void ParamTraits<unsigned char>::Write(Message* m, const param_type& p) { 295 void ParamTraits<unsigned char>::Write(Message* m, const param_type& p) {
278 m->WriteBytes(&p, sizeof(param_type)); 296 m->WriteBytes(&p, sizeof(param_type));
279 } 297 }
280 298
281 bool ParamTraits<unsigned char>::Read(const Message* m, 299 bool ParamTraits<unsigned char>::Read(const Message* m,
282 base::PickleIterator* iter, 300 base::PickleIterator* iter,
283 param_type* r) { 301 param_type* r) {
284 const char* data; 302 const char* data;
285 if (!iter->ReadBytes(&data, sizeof(param_type))) 303 if (!iter->ReadBytes(&data, sizeof(param_type)))
286 return false; 304 return false;
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 return result; 1057 return result;
1040 } 1058 }
1041 1059
1042 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { 1060 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) {
1043 l->append("<MSG>"); 1061 l->append("<MSG>");
1044 } 1062 }
1045 1063
1046 #endif // OS_WIN 1064 #endif // OS_WIN
1047 1065
1048 } // namespace IPC 1066 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_message_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698