| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/nullable_string16.h" | 9 #include "base/nullable_string16.h" |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 } | 226 } |
| 227 | 227 |
| 228 void ParamTraits<long long>::Log(const param_type& p, std::string* l) { | 228 void ParamTraits<long long>::Log(const param_type& p, std::string* l) { |
| 229 l->append(base::Int64ToString(static_cast<int64>(p))); | 229 l->append(base::Int64ToString(static_cast<int64>(p))); |
| 230 } | 230 } |
| 231 | 231 |
| 232 void ParamTraits<unsigned long long>::Log(const param_type& p, std::string* l) { | 232 void ParamTraits<unsigned long long>::Log(const param_type& p, std::string* l) { |
| 233 l->append(base::Uint64ToString(p)); | 233 l->append(base::Uint64ToString(p)); |
| 234 } | 234 } |
| 235 | 235 |
| 236 void ParamTraits<unsigned short>::Write(Message* m, const param_type& p) { |
| 237 m->WriteBytes(&p, sizeof(param_type)); |
| 238 } |
| 239 |
| 240 bool ParamTraits<unsigned short>::Read(const Message* m, void** iter, |
| 241 param_type* r) { |
| 242 const char* data; |
| 243 if (!m->ReadBytes(iter, &data, sizeof(param_type))) |
| 244 return false; |
| 245 memcpy(r, data, sizeof(param_type)); |
| 246 return true; |
| 247 } |
| 248 |
| 249 void ParamTraits<unsigned short>::Log(const param_type& p, std::string* l) { |
| 250 l->append(base::UintToString(p)); |
| 251 } |
| 252 |
| 236 void ParamTraits<base::Time>::Write(Message* m, const param_type& p) { | 253 void ParamTraits<base::Time>::Write(Message* m, const param_type& p) { |
| 237 ParamTraits<int64>::Write(m, p.ToInternalValue()); | 254 ParamTraits<int64>::Write(m, p.ToInternalValue()); |
| 238 } | 255 } |
| 239 | 256 |
| 240 bool ParamTraits<base::Time>::Read(const Message* m, void** iter, | 257 bool ParamTraits<base::Time>::Read(const Message* m, void** iter, |
| 241 param_type* r) { | 258 param_type* r) { |
| 242 int64 value; | 259 int64 value; |
| 243 if (!ParamTraits<int64>::Read(m, iter, &value)) | 260 if (!ParamTraits<int64>::Read(m, iter, &value)) |
| 244 return false; | 261 return false; |
| 245 *r = base::Time::FromInternalValue(value); | 262 *r = base::Time::FromInternalValue(value); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 ReadParam(m, iter, &r->flags) && | 463 ReadParam(m, iter, &r->flags) && |
| 447 ReadParam(m, iter, &r->sent) && | 464 ReadParam(m, iter, &r->sent) && |
| 448 ReadParam(m, iter, &r->receive) && | 465 ReadParam(m, iter, &r->receive) && |
| 449 ReadParam(m, iter, &r->dispatch) && | 466 ReadParam(m, iter, &r->dispatch) && |
| 450 ReadParam(m, iter, &r->params); | 467 ReadParam(m, iter, &r->params); |
| 451 r->type = static_cast<uint16>(type); | 468 r->type = static_cast<uint16>(type); |
| 452 return result; | 469 return result; |
| 453 } | 470 } |
| 454 | 471 |
| 455 } // namespace IPC | 472 } // namespace IPC |
| OLD | NEW |