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 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 class Time; | 54 class Time; |
55 class TimeDelta; | 55 class TimeDelta; |
56 class TimeTicks; | 56 class TimeTicks; |
57 struct FileDescriptor; | 57 struct FileDescriptor; |
58 } | 58 } |
59 | 59 |
60 namespace IPC { | 60 namespace IPC { |
61 | 61 |
62 struct ChannelHandle; | 62 struct ChannelHandle; |
63 | 63 |
64 //----------------------------------------------------------------------------- | |
65 // An iterator class for reading the fields contained within a Message. | |
66 class IPC_EXPORT MessageIterator { | |
67 public: | |
68 explicit MessageIterator(const Message& m); | |
69 | |
70 int NextInt() const; | |
71 const std::string NextString() const; | |
72 | |
73 private: | |
74 mutable PickleIterator iter_; | |
75 }; | |
76 | |
77 // ----------------------------------------------------------------------------- | 64 // ----------------------------------------------------------------------------- |
78 // How we send IPC message logs across channels. | 65 // How we send IPC message logs across channels. |
79 struct IPC_EXPORT LogData { | 66 struct IPC_EXPORT LogData { |
80 LogData(); | 67 LogData(); |
81 ~LogData(); | 68 ~LogData(); |
82 | 69 |
83 std::string channel; | 70 std::string channel; |
84 int32 routing_id; | 71 int32 routing_id; |
85 uint32 type; // "User-defined" message type, from ipc_message.h. | 72 uint32 type; // "User-defined" message type, from ipc_message.h. |
86 std::string flags; | 73 std::string flags; |
87 int64 sent; // Time that the message was sent (i.e. at Send()). | 74 int64 sent; // Time that the message was sent (i.e. at Send()). |
88 int64 receive; // Time before it was dispatched (i.e. before calling | 75 int64 receive; // Time before it was dispatched (i.e. before calling |
89 // OnMessageReceived). | 76 // OnMessageReceived). |
90 int64 dispatch; // Time after it was dispatched (i.e. after calling | 77 int64 dispatch; // Time after it was dispatched (i.e. after calling |
91 // OnMessageReceived). | 78 // OnMessageReceived). |
92 std::string message_name; | 79 std::string message_name; |
93 std::string params; | 80 std::string params; |
94 }; | 81 }; |
95 | 82 |
| 83 //----------------------------------------------------------------------------- |
96 | 84 |
97 //----------------------------------------------------------------------------- | |
98 // A dummy struct to place first just to allow leading commas for all | 85 // A dummy struct to place first just to allow leading commas for all |
99 // members in the macro-generated constructor initializer lists. | 86 // members in the macro-generated constructor initializer lists. |
100 struct NoParams { | 87 struct NoParams { |
101 }; | 88 }; |
102 | 89 |
103 template <class P> | 90 template <class P> |
104 static inline void WriteParam(Message* m, const P& p) { | 91 static inline void WriteParam(Message* m, const P& p) { |
105 typedef typename SimilarTypeTraits<P>::Type Type; | 92 typedef typename SimilarTypeTraits<P>::Type Type; |
106 ParamTraits<Type>::Write(m, static_cast<const Type& >(p)); | 93 ParamTraits<Type>::Write(m, static_cast<const Type& >(p)); |
107 } | 94 } |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 template<typename TA, typename TB, typename TC, typename TD, typename TE> | 860 template<typename TA, typename TB, typename TC, typename TD, typename TE> |
874 static void WriteReplyParams(Message* reply, TA a, TB b, TC c, TD d, TE e) { | 861 static void WriteReplyParams(Message* reply, TA a, TB b, TC c, TD d, TE e) { |
875 ReplyParam p(a, b, c, d, e); | 862 ReplyParam p(a, b, c, d, e); |
876 WriteParam(reply, p); | 863 WriteParam(reply, p); |
877 } | 864 } |
878 }; | 865 }; |
879 | 866 |
880 } // namespace IPC | 867 } // namespace IPC |
881 | 868 |
882 #endif // IPC_IPC_MESSAGE_UTILS_H_ | 869 #endif // IPC_IPC_MESSAGE_UTILS_H_ |
OLD | NEW |