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 #ifndef IPC_IPC_MESSAGE_UTILS_H_ | 5 #ifndef IPC_IPC_MESSAGE_UTILS_H_ |
6 #define IPC_IPC_MESSAGE_UTILS_H_ | 6 #define IPC_IPC_MESSAGE_UTILS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
11 #include <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/format_macros.h" | 15 #include "base/format_macros.h" |
| 16 #include "base/platform_file.h" |
16 #include "base/string16.h" | 17 #include "base/string16.h" |
17 #include "base/stringprintf.h" | 18 #include "base/stringprintf.h" |
18 #include "base/string_util.h" | 19 #include "base/string_util.h" |
19 #include "base/tuple.h" | 20 #include "base/tuple.h" |
20 #include "ipc/ipc_param_traits.h" | 21 #include "ipc/ipc_param_traits.h" |
21 #include "ipc/ipc_sync_message.h" | 22 #include "ipc/ipc_sync_message.h" |
22 | 23 |
23 #if defined(COMPILER_GCC) | 24 #if defined(COMPILER_GCC) |
24 // GCC "helpfully" tries to inline template methods in release mode. Except we | 25 // GCC "helpfully" tries to inline template methods in release mode. Except we |
25 // want the majority of the template junk being expanded once in the | 26 // want the majority of the template junk being expanded once in the |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 } | 329 } |
329 memcpy(r, data, sizeof(param_type)); | 330 memcpy(r, data, sizeof(param_type)); |
330 return true; | 331 return true; |
331 } | 332 } |
332 static void Log(const param_type& p, std::string* l) { | 333 static void Log(const param_type& p, std::string* l) { |
333 l->append(StringPrintf("%e", p)); | 334 l->append(StringPrintf("%e", p)); |
334 } | 335 } |
335 }; | 336 }; |
336 | 337 |
337 template <> | 338 template <> |
| 339 struct IPC_EXPORT ParamTraits<base::PlatformFileInfo> { |
| 340 typedef base::PlatformFileInfo param_type; |
| 341 static void Write(Message* m, const param_type& p); |
| 342 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 343 static void Log(const param_type& p, std::string* l); |
| 344 }; |
| 345 |
| 346 template <> |
| 347 struct SimilarTypeTraits<base::PlatformFileError> { |
| 348 typedef int Type; |
| 349 }; |
| 350 |
| 351 template <> |
338 struct IPC_EXPORT ParamTraits<base::Time> { | 352 struct IPC_EXPORT ParamTraits<base::Time> { |
339 typedef base::Time param_type; | 353 typedef base::Time param_type; |
340 static void Write(Message* m, const param_type& p); | 354 static void Write(Message* m, const param_type& p); |
341 static bool Read(const Message* m, PickleIterator* iter, param_type* r); | 355 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
342 static void Log(const param_type& p, std::string* l); | 356 static void Log(const param_type& p, std::string* l); |
343 }; | 357 }; |
344 | 358 |
345 template <> | 359 template <> |
346 struct IPC_EXPORT ParamTraits<base::TimeDelta> { | 360 struct IPC_EXPORT ParamTraits<base::TimeDelta> { |
347 typedef base::TimeDelta param_type; | 361 typedef base::TimeDelta param_type; |
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 ReplyParam p(a, b, c, d, e); | 1182 ReplyParam p(a, b, c, d, e); |
1169 WriteParam(reply, p); | 1183 WriteParam(reply, p); |
1170 } | 1184 } |
1171 }; | 1185 }; |
1172 | 1186 |
1173 //----------------------------------------------------------------------------- | 1187 //----------------------------------------------------------------------------- |
1174 | 1188 |
1175 } // namespace IPC | 1189 } // namespace IPC |
1176 | 1190 |
1177 #endif // IPC_IPC_MESSAGE_UTILS_H_ | 1191 #endif // IPC_IPC_MESSAGE_UTILS_H_ |
OLD | NEW |