OLD | NEW |
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 "content/public/common/common_param_traits.h" | 5 #include "content/public/common/common_param_traits.h" |
6 | 6 |
7 #include "content/public/common/content_constants.h" | 7 #include "content/public/common/content_constants.h" |
8 #include "content/public/common/referrer.h" | 8 #include "content/public/common/referrer.h" |
9 #include "net/base/host_port_pair.h" | 9 #include "net/base/host_port_pair.h" |
10 #include "net/base/upload_data.h" | 10 #include "net/base/upload_data.h" |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 if (!ReadParam(m, iter, &address) || !ReadParam(m, iter, &port)) | 396 if (!ReadParam(m, iter, &address) || !ReadParam(m, iter, &port)) |
397 return false; | 397 return false; |
398 *p = net::IPEndPoint(address, port); | 398 *p = net::IPEndPoint(address, port); |
399 return true; | 399 return true; |
400 } | 400 } |
401 | 401 |
402 void ParamTraits<net::IPEndPoint>::Log(const param_type& p, std::string* l) { | 402 void ParamTraits<net::IPEndPoint>::Log(const param_type& p, std::string* l) { |
403 LogParam("IPEndPoint:" + p.ToString(), l); | 403 LogParam("IPEndPoint:" + p.ToString(), l); |
404 } | 404 } |
405 | 405 |
406 void ParamTraits<base::PlatformFileInfo>::Write( | |
407 Message* m, const param_type& p) { | |
408 WriteParam(m, p.size); | |
409 WriteParam(m, p.is_directory); | |
410 WriteParam(m, p.last_modified.ToDoubleT()); | |
411 WriteParam(m, p.last_accessed.ToDoubleT()); | |
412 WriteParam(m, p.creation_time.ToDoubleT()); | |
413 } | |
414 | |
415 bool ParamTraits<base::PlatformFileInfo>::Read( | |
416 const Message* m, PickleIterator* iter, param_type* p) { | |
417 double last_modified; | |
418 double last_accessed; | |
419 double creation_time; | |
420 bool result = | |
421 ReadParam(m, iter, &p->size) && | |
422 ReadParam(m, iter, &p->is_directory) && | |
423 ReadParam(m, iter, &last_modified) && | |
424 ReadParam(m, iter, &last_accessed) && | |
425 ReadParam(m, iter, &creation_time); | |
426 if (result) { | |
427 p->last_modified = base::Time::FromDoubleT(last_modified); | |
428 p->last_accessed = base::Time::FromDoubleT(last_accessed); | |
429 p->creation_time = base::Time::FromDoubleT(creation_time); | |
430 } | |
431 return result; | |
432 } | |
433 | |
434 void ParamTraits<base::PlatformFileInfo>::Log( | |
435 const param_type& p, std::string* l) { | |
436 l->append("("); | |
437 LogParam(p.size, l); | |
438 l->append(","); | |
439 LogParam(p.is_directory, l); | |
440 l->append(","); | |
441 LogParam(p.last_modified.ToDoubleT(), l); | |
442 l->append(","); | |
443 LogParam(p.last_accessed.ToDoubleT(), l); | |
444 l->append(","); | |
445 LogParam(p.creation_time.ToDoubleT(), l); | |
446 l->append(")"); | |
447 } | |
448 | |
449 void ParamTraits<content::Referrer>::Write( | 406 void ParamTraits<content::Referrer>::Write( |
450 Message* m, const param_type& p) { | 407 Message* m, const param_type& p) { |
451 WriteParam(m, p.url); | 408 WriteParam(m, p.url); |
452 WriteParam(m, p.policy); | 409 WriteParam(m, p.policy); |
453 } | 410 } |
454 | 411 |
455 bool ParamTraits<content::Referrer>::Read( | 412 bool ParamTraits<content::Referrer>::Read( |
456 const Message* m, PickleIterator* iter, param_type* r) { | 413 const Message* m, PickleIterator* iter, param_type* r) { |
457 return ReadParam(m, iter, &r->url) && ReadParam(m, iter, &r->policy); | 414 return ReadParam(m, iter, &r->url) && ReadParam(m, iter, &r->policy); |
458 } | 415 } |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 const SkBitmap_Data* bmp_data = | 547 const SkBitmap_Data* bmp_data = |
591 reinterpret_cast<const SkBitmap_Data*>(fixed_data); | 548 reinterpret_cast<const SkBitmap_Data*>(fixed_data); |
592 return bmp_data->InitSkBitmapFromData(r, variable_data, variable_data_size); | 549 return bmp_data->InitSkBitmapFromData(r, variable_data, variable_data_size); |
593 } | 550 } |
594 | 551 |
595 void ParamTraits<SkBitmap>::Log(const SkBitmap& p, std::string* l) { | 552 void ParamTraits<SkBitmap>::Log(const SkBitmap& p, std::string* l) { |
596 l->append("<SkBitmap>"); | 553 l->append("<SkBitmap>"); |
597 } | 554 } |
598 | 555 |
599 } // namespace IPC | 556 } // namespace IPC |
OLD | NEW |