| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/nullable_string16.h" | 10 #include "base/nullable_string16.h" |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 return false; | 262 return false; |
| 263 *r = base::Time::FromInternalValue(value); | 263 *r = base::Time::FromInternalValue(value); |
| 264 return true; | 264 return true; |
| 265 } | 265 } |
| 266 | 266 |
| 267 void ParamTraits<base::Time>::Log(const param_type& p, std::string* l) { | 267 void ParamTraits<base::Time>::Log(const param_type& p, std::string* l) { |
| 268 ParamTraits<int64>::Log(p.ToInternalValue(), l); | 268 ParamTraits<int64>::Log(p.ToInternalValue(), l); |
| 269 } | 269 } |
| 270 | 270 |
| 271 void ParamTraits<base::TimeDelta> ::Write(Message* m, const param_type& p) { | 271 void ParamTraits<base::TimeDelta> ::Write(Message* m, const param_type& p) { |
| 272 ParamTraits<int64> ::Write(m, p.InMicroseconds()); | 272 ParamTraits<int64> ::Write(m, p.ToInternalValue()); |
| 273 } | 273 } |
| 274 | 274 |
| 275 bool ParamTraits<base::TimeDelta> ::Read(const Message* m, | 275 bool ParamTraits<base::TimeDelta> ::Read(const Message* m, |
| 276 void** iter, | 276 void** iter, |
| 277 param_type* r) { | 277 param_type* r) { |
| 278 int64 value; | 278 int64 value; |
| 279 bool ret = ParamTraits<int64> ::Read(m, iter, &value); | 279 bool ret = ParamTraits<int64> ::Read(m, iter, &value); |
| 280 if (ret) | 280 if (ret) |
| 281 *r = base::TimeDelta::FromMicroseconds(value); | 281 *r = base::TimeDelta::FromInternalValue(value); |
| 282 | 282 |
| 283 return ret; | 283 return ret; |
| 284 } | 284 } |
| 285 | 285 |
| 286 void ParamTraits<base::TimeDelta> ::Log(const param_type& p, std::string* l) { | 286 void ParamTraits<base::TimeDelta> ::Log(const param_type& p, std::string* l) { |
| 287 ParamTraits<int64> ::Log(p.InMicroseconds(), l); | 287 ParamTraits<int64> ::Log(p.ToInternalValue(), l); |
| 288 } |
| 289 |
| 290 void ParamTraits<base::TimeTicks> ::Write(Message* m, const param_type& p) { |
| 291 ParamTraits<int64> ::Write(m, p.ToInternalValue()); |
| 292 } |
| 293 |
| 294 bool ParamTraits<base::TimeTicks> ::Read(const Message* m, |
| 295 void** iter, |
| 296 param_type* r) { |
| 297 int64 value; |
| 298 bool ret = ParamTraits<int64> ::Read(m, iter, &value); |
| 299 if (ret) |
| 300 *r = base::TimeTicks::FromInternalValue(value); |
| 301 |
| 302 return ret; |
| 303 } |
| 304 |
| 305 void ParamTraits<base::TimeTicks> ::Log(const param_type& p, std::string* l) { |
| 306 ParamTraits<int64> ::Log(p.ToInternalValue(), l); |
| 288 } | 307 } |
| 289 | 308 |
| 290 void ParamTraits<DictionaryValue>::Write(Message* m, const param_type& p) { | 309 void ParamTraits<DictionaryValue>::Write(Message* m, const param_type& p) { |
| 291 WriteValue(m, &p, 0); | 310 WriteValue(m, &p, 0); |
| 292 } | 311 } |
| 293 | 312 |
| 294 bool ParamTraits<DictionaryValue>::Read( | 313 bool ParamTraits<DictionaryValue>::Read( |
| 295 const Message* m, void** iter, param_type* r) { | 314 const Message* m, void** iter, param_type* r) { |
| 296 int type; | 315 int type; |
| 297 if (!ReadParam(m, iter, &type) || type != Value::TYPE_DICTIONARY) | 316 if (!ReadParam(m, iter, &type) || type != Value::TYPE_DICTIONARY) |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 ReadParam(m, iter, &r->flags) && | 488 ReadParam(m, iter, &r->flags) && |
| 470 ReadParam(m, iter, &r->sent) && | 489 ReadParam(m, iter, &r->sent) && |
| 471 ReadParam(m, iter, &r->receive) && | 490 ReadParam(m, iter, &r->receive) && |
| 472 ReadParam(m, iter, &r->dispatch) && | 491 ReadParam(m, iter, &r->dispatch) && |
| 473 ReadParam(m, iter, &r->params); | 492 ReadParam(m, iter, &r->params); |
| 474 r->type = static_cast<uint16>(type); | 493 r->type = static_cast<uint16>(type); |
| 475 return result; | 494 return result; |
| 476 } | 495 } |
| 477 | 496 |
| 478 } // namespace IPC | 497 } // namespace IPC |
| OLD | NEW |