Chromium Code Reviews| OLD | NEW | 
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/common/cast_messages.h" | 5 #include "chrome/common/cast_messages.h" | 
| 6 | 6 | 
| 7 namespace IPC { | 7 namespace IPC { | 
| 8 | 8 | 
| 9 void ParamTraits<media::cast::RtpTimeTicks>::GetSize(base::PickleSizer* s, | |
| 10 const param_type& p) { | |
| 11 ParamTraits<uint64_t>::GetSize(s, p.SerializeForIPC()); | |
| 
 
dcheng
2016/05/13 03:23:10
Nit: does GetParamSize() work here?
 
 | |
| 12 } | |
| 13 | |
| 9 void ParamTraits<media::cast::RtpTimeTicks>::Write(base::Pickle* m, | 14 void ParamTraits<media::cast::RtpTimeTicks>::Write(base::Pickle* m, | 
| 10 const param_type& p) { | 15 const param_type& p) { | 
| 11 ParamTraits<uint64_t>::Write(m, p.SerializeForIPC()); | 16 ParamTraits<uint64_t>::Write(m, p.SerializeForIPC()); | 
| 12 } | 17 } | 
| 13 | 18 | 
| 14 bool ParamTraits<media::cast::RtpTimeTicks>::Read(const base::Pickle* m, | 19 bool ParamTraits<media::cast::RtpTimeTicks>::Read(const base::Pickle* m, | 
| 15 base::PickleIterator* iter, | 20 base::PickleIterator* iter, | 
| 16 param_type* r) { | 21 param_type* r) { | 
| 17 uint64_t serialized = UINT64_C(0); | 22 uint64_t serialized = UINT64_C(0); | 
| 18 if (ParamTraits<uint64_t>::Read(m, iter, &serialized)) { | 23 if (ParamTraits<uint64_t>::Read(m, iter, &serialized)) { | 
| 19 *r = param_type::DeserializeForIPC(serialized); | 24 *r = param_type::DeserializeForIPC(serialized); | 
| 20 return true; | 25 return true; | 
| 21 } | 26 } | 
| 22 return false; | 27 return false; | 
| 23 } | 28 } | 
| 24 | 29 | 
| 25 void ParamTraits<media::cast::RtpTimeTicks>::Log(const param_type& p, | 30 void ParamTraits<media::cast::RtpTimeTicks>::Log(const param_type& p, | 
| 26 std::string* l) { | 31 std::string* l) { | 
| 27 std::ostringstream oss; | 32 std::ostringstream oss; | 
| 28 oss << p; | 33 oss << p; | 
| 29 l->append(oss.str()); | 34 l->append(oss.str()); | 
| 30 } | 35 } | 
| 31 | 36 | 
| 37 void ParamTraits<media::cast::FrameId>::GetSize(base::PickleSizer* s, | |
| 38 const param_type& p) { | |
| 39 ParamTraits<uint64_t>::GetSize(s, p.SerializeForIPC()); | |
| 40 } | |
| 41 | |
| 32 void ParamTraits<media::cast::FrameId>::Write(base::Pickle* m, | 42 void ParamTraits<media::cast::FrameId>::Write(base::Pickle* m, | 
| 33 const param_type& p) { | 43 const param_type& p) { | 
| 34 ParamTraits<uint64_t>::Write(m, p.SerializeForIPC()); | 44 ParamTraits<uint64_t>::Write(m, p.SerializeForIPC()); | 
| 35 } | 45 } | 
| 36 | 46 | 
| 37 bool ParamTraits<media::cast::FrameId>::Read(const base::Pickle* m, | 47 bool ParamTraits<media::cast::FrameId>::Read(const base::Pickle* m, | 
| 38 base::PickleIterator* iter, | 48 base::PickleIterator* iter, | 
| 39 param_type* r) { | 49 param_type* r) { | 
| 40 uint64_t serialized = UINT64_C(0); | 50 uint64_t serialized = UINT64_C(0); | 
| 41 if (ParamTraits<uint64_t>::Read(m, iter, &serialized)) { | 51 if (ParamTraits<uint64_t>::Read(m, iter, &serialized)) { | 
| 42 *r = param_type::DeserializeForIPC(serialized); | 52 *r = param_type::DeserializeForIPC(serialized); | 
| 43 return true; | 53 return true; | 
| 44 } | 54 } | 
| 45 return false; | 55 return false; | 
| 46 } | 56 } | 
| 47 | 57 | 
| 48 void ParamTraits<media::cast::FrameId>::Log(const param_type& p, | 58 void ParamTraits<media::cast::FrameId>::Log(const param_type& p, | 
| 49 std::string* l) { | 59 std::string* l) { | 
| 50 std::ostringstream oss; | 60 std::ostringstream oss; | 
| 51 oss << p; | 61 oss << p; | 
| 52 l->append(oss.str()); | 62 l->append(oss.str()); | 
| 53 } | 63 } | 
| 54 | 64 | 
| 55 } // namespace IPC | 65 } // namespace IPC | 
| OLD | NEW |