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 "ipc/ipc_message_utils.h" | 5 #include "ipc/ipc_message_utils.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/json/json_writer.h" | 11 #include "base/json/json_writer.h" |
12 #include "base/nonce.h" | |
12 #include "base/strings/nullable_string16.h" | 13 #include "base/strings/nullable_string16.h" |
13 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
15 #include "base/time/time.h" | 16 #include "base/time/time.h" |
16 #include "base/values.h" | 17 #include "base/values.h" |
17 #include "build/build_config.h" | 18 #include "build/build_config.h" |
18 #include "ipc/ipc_channel_handle.h" | 19 #include "ipc/ipc_channel_handle.h" |
19 #include "ipc/ipc_message_attachment.h" | 20 #include "ipc/ipc_message_attachment.h" |
20 #include "ipc/ipc_message_attachment_set.h" | 21 #include "ipc/ipc_message_attachment_set.h" |
21 #include "ipc/ipc_mojo_param_traits.h" | 22 #include "ipc/ipc_mojo_param_traits.h" |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
991 if (ret) | 992 if (ret) |
992 *r = base::TimeTicks::FromInternalValue(value); | 993 *r = base::TimeTicks::FromInternalValue(value); |
993 | 994 |
994 return ret; | 995 return ret; |
995 } | 996 } |
996 | 997 |
997 void ParamTraits<base::TimeTicks>::Log(const param_type& p, std::string* l) { | 998 void ParamTraits<base::TimeTicks>::Log(const param_type& p, std::string* l) { |
998 ParamTraits<int64_t>::Log(p.ToInternalValue(), l); | 999 ParamTraits<int64_t>::Log(p.ToInternalValue(), l); |
999 } | 1000 } |
1000 | 1001 |
1002 void ParamTraits<base::Nonce>::GetSize(base::PickleSizer* sizer, | |
1003 const param_type& p) { | |
1004 sizer->AddBytes(2 * sizeof(uint64_t)); | |
1005 } | |
1006 | |
1007 void ParamTraits<base::Nonce>::Write(base::Pickle* m, const param_type& p) { | |
1008 ParamTraits<int64_t>::Write(m, p.high()); | |
Fady Samuel
2016/09/13 20:28:44
uint64_t?
tguilbert
2016/09/13 21:11:44
Oops! You are right, TY. Done.
| |
1009 ParamTraits<int64_t>::Write(m, p.low()); | |
1010 } | |
1011 | |
1012 bool ParamTraits<base::Nonce>::Read(const base::Pickle* m, | |
1013 base::PickleIterator* iter, | |
1014 param_type* r) { | |
1015 int64_t high; | |
1016 int64_t low; | |
1017 if (!ParamTraits<int64_t>::Read(m, iter, &high) || | |
Fady Samuel
2016/09/13 20:28:44
Shouldn't this be uint64_t?
tguilbert
2016/09/13 21:11:44
Done.
| |
1018 !ParamTraits<int64_t>::Read(m, iter, &low)) | |
1019 return false; | |
1020 | |
1021 *r = base::Nonce::Deserialize(high, low); | |
1022 return true; | |
1023 } | |
1024 | |
1025 void ParamTraits<base::Nonce>::Log(const param_type& p, std::string* l) { | |
1026 l->append(p.ToString()); | |
1027 } | |
1028 | |
1001 void ParamTraits<IPC::ChannelHandle>::GetSize(base::PickleSizer* sizer, | 1029 void ParamTraits<IPC::ChannelHandle>::GetSize(base::PickleSizer* sizer, |
1002 const param_type& p) { | 1030 const param_type& p) { |
1003 GetParamSize(sizer, p.name); | 1031 GetParamSize(sizer, p.name); |
1004 #if defined(OS_POSIX) | 1032 #if defined(OS_POSIX) |
1005 GetParamSize(sizer, p.socket); | 1033 GetParamSize(sizer, p.socket); |
1006 #endif | 1034 #endif |
1007 GetParamSize(sizer, p.mojo_handle); | 1035 GetParamSize(sizer, p.mojo_handle); |
1008 } | 1036 } |
1009 | 1037 |
1010 void ParamTraits<IPC::ChannelHandle>::Write(base::Pickle* m, | 1038 void ParamTraits<IPC::ChannelHandle>::Write(base::Pickle* m, |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1211 return result; | 1239 return result; |
1212 } | 1240 } |
1213 | 1241 |
1214 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { | 1242 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { |
1215 l->append("<MSG>"); | 1243 l->append("<MSG>"); |
1216 } | 1244 } |
1217 | 1245 |
1218 #endif // OS_WIN | 1246 #endif // OS_WIN |
1219 | 1247 |
1220 } // namespace IPC | 1248 } // namespace IPC |
OLD | NEW |