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 // Protobuf Messages over IPC | 5 // Protobuf Messages over IPC |
6 // | 6 // |
7 // Protobuf messages are registered with IPC_PROTOBUF_MESSAGE_TRAITS_BEGIN() and | 7 // Protobuf messages are registered with IPC_PROTOBUF_MESSAGE_TRAITS_BEGIN() and |
8 // friends in much the same way as other externally-defined structs (see | 8 // friends in much the same way as other externally-defined structs (see |
9 // ipc/ipc_message_macros.h). These macros also cause only registration of the | 9 // ipc/ipc_message_macros.h). These macros also cause only registration of the |
10 // protobuf message type IPC with message generation. Within matching calls to | 10 // protobuf message type IPC with message generation. Within matching calls to |
(...skipping 19 matching lines...) Expand all Loading... |
30 #define CHROME_COMMON_SAFE_BROWSING_IPC_PROTOBUF_MESSAGE_MACROS_H_ | 30 #define CHROME_COMMON_SAFE_BROWSING_IPC_PROTOBUF_MESSAGE_MACROS_H_ |
31 | 31 |
32 #include <string> | 32 #include <string> |
33 | 33 |
34 #define IPC_PROTOBUF_MESSAGE_TRAITS_BEGIN(message_name) \ | 34 #define IPC_PROTOBUF_MESSAGE_TRAITS_BEGIN(message_name) \ |
35 namespace IPC { \ | 35 namespace IPC { \ |
36 template <> \ | 36 template <> \ |
37 struct IPC_MESSAGE_EXPORT ParamTraits<message_name> { \ | 37 struct IPC_MESSAGE_EXPORT ParamTraits<message_name> { \ |
38 typedef message_name param_type; \ | 38 typedef message_name param_type; \ |
39 static void Write(Message* m, const param_type& p); \ | 39 static void Write(Message* m, const param_type& p); \ |
40 static bool Read(const Message* m, PickleIterator* iter, param_type* p); \ | 40 static bool Read(const Message* m, base::PickleIterator* iter, \ |
| 41 param_type* p); \ |
41 static void Log(const param_type& p, std::string* l); \ | 42 static void Log(const param_type& p, std::string* l); \ |
42 \ | 43 \ |
43 private: \ | 44 private: \ |
44 template <class P> \ | 45 template <class P> \ |
45 static bool ReadParamF(const Message* m, \ | 46 static bool ReadParamF(const Message* m, \ |
46 PickleIterator* iter, \ | 47 base::PickleIterator* iter, \ |
47 param_type* p, \ | 48 param_type* p, \ |
48 void (param_type::*setter_function)(P)); \ | 49 void (param_type::*setter_function)(P)); \ |
49 }; \ | 50 }; \ |
50 } // namespace IPC | 51 } // namespace IPC |
51 | 52 |
52 #define IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_FUNDAMENTAL_MEMBER(name) | 53 #define IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_FUNDAMENTAL_MEMBER(name) |
53 #define IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(name) | 54 #define IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(name) |
54 #define IPC_PROTOBUF_MESSAGE_TRAITS_REPEATED_COMPLEX_MEMBER(name) | 55 #define IPC_PROTOBUF_MESSAGE_TRAITS_REPEATED_COMPLEX_MEMBER(name) |
55 #define IPC_PROTOBUF_MESSAGE_TRAITS_END() | 56 #define IPC_PROTOBUF_MESSAGE_TRAITS_END() |
56 | 57 |
57 #endif // CHROME_COMMON_SAFE_BROWSING_IPC_PROTOBUF_MESSAGE_MACROS_H_ | 58 #endif // CHROME_COMMON_SAFE_BROWSING_IPC_PROTOBUF_MESSAGE_MACROS_H_ |
OLD | NEW |