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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 if (ret) | 280 if (ret) |
281 *r = base::TimeDelta::FromMicroseconds(value); | 281 *r = base::TimeDelta::FromMicroseconds(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.InMicroseconds(), l); |
288 } | 288 } |
289 | 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, void** iter, |
| 295 param_type* r) { |
| 296 int64 value; |
| 297 if (!ParamTraits<int64>::Read(m, iter, &value)) |
| 298 return false; |
| 299 *r = base::TimeTicks::FromInternalValue(value); |
| 300 return true; |
| 301 } |
| 302 |
| 303 void ParamTraits<base::TimeTicks>::Log(const param_type& p, std::string* l) { |
| 304 ParamTraits<int64>::Log(p.ToInternalValue(), l); |
| 305 } |
| 306 |
290 void ParamTraits<DictionaryValue>::Write(Message* m, const param_type& p) { | 307 void ParamTraits<DictionaryValue>::Write(Message* m, const param_type& p) { |
291 WriteValue(m, &p, 0); | 308 WriteValue(m, &p, 0); |
292 } | 309 } |
293 | 310 |
294 bool ParamTraits<DictionaryValue>::Read( | 311 bool ParamTraits<DictionaryValue>::Read( |
295 const Message* m, void** iter, param_type* r) { | 312 const Message* m, void** iter, param_type* r) { |
296 int type; | 313 int type; |
297 if (!ReadParam(m, iter, &type) || type != Value::TYPE_DICTIONARY) | 314 if (!ReadParam(m, iter, &type) || type != Value::TYPE_DICTIONARY) |
298 return false; | 315 return false; |
299 | 316 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 ReadParam(m, iter, &r->flags) && | 486 ReadParam(m, iter, &r->flags) && |
470 ReadParam(m, iter, &r->sent) && | 487 ReadParam(m, iter, &r->sent) && |
471 ReadParam(m, iter, &r->receive) && | 488 ReadParam(m, iter, &r->receive) && |
472 ReadParam(m, iter, &r->dispatch) && | 489 ReadParam(m, iter, &r->dispatch) && |
473 ReadParam(m, iter, &r->params); | 490 ReadParam(m, iter, &r->params); |
474 r->type = static_cast<uint16>(type); | 491 r->type = static_cast<uint16>(type); |
475 return result; | 492 return result; |
476 } | 493 } |
477 | 494 |
478 } // namespace IPC | 495 } // namespace IPC |
OLD | NEW |