Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: ipc/ipc_message_utils.h

Issue 3119035: FBTF: Move individual XXXMsg_Params structs to a new file. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Fix comment Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ipc/ipc.gypi ('k') | ipc/ipc_param_traits.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 #include <map> 12 #include <map>
13 #include <set> 13 #include <set>
14 14
15 #include "base/format_macros.h" 15 #include "base/format_macros.h"
16 #include "base/string16.h" 16 #include "base/string16.h"
17 #include "base/string_util.h" 17 #include "base/string_util.h"
18 #include "base/tuple.h" 18 #include "base/tuple.h"
19 #include "ipc/ipc_param_traits.h"
19 #include "ipc/ipc_sync_message.h" 20 #include "ipc/ipc_sync_message.h"
20 21
21 #if defined(COMPILER_GCC) 22 #if defined(COMPILER_GCC)
22 // GCC "helpfully" tries to inline template methods in release mode. Except we 23 // GCC "helpfully" tries to inline template methods in release mode. Except we
23 // want the majority of the template junk being expanded once in the 24 // want the majority of the template junk being expanded once in the
24 // implementation file (and only provide the definitions in 25 // implementation file (and only provide the definitions in
25 // ipc_message_utils_impl.h in those files) and exported, instead of expanded 26 // ipc_message_utils_impl.h in those files) and exported, instead of expanded
26 // at every call site. Special note: GCC happily accepts the attribute before 27 // at every call site. Special note: GCC happily accepts the attribute before
27 // the method declaration, but only acts on it if it is after. 28 // the method declaration, but only acts on it if it is after.
28 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40500 29 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40500
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 } 126 }
126 } 127 }
127 private: 128 private:
128 const Message& msg_; 129 const Message& msg_;
129 mutable void* iter_; 130 mutable void* iter_;
130 }; 131 };
131 132
132 //----------------------------------------------------------------------------- 133 //-----------------------------------------------------------------------------
133 // ParamTraits specializations, etc. 134 // ParamTraits specializations, etc.
134 135
135 template <class P> struct ParamTraits {
136 };
137
138 template <class P>
139 struct SimilarTypeTraits {
140 typedef P Type;
141 };
142
143 template <class P> 136 template <class P>
144 static inline void WriteParam(Message* m, const P& p) { 137 static inline void WriteParam(Message* m, const P& p) {
145 typedef typename SimilarTypeTraits<P>::Type Type; 138 typedef typename SimilarTypeTraits<P>::Type Type;
146 ParamTraits<Type>::Write(m, static_cast<const Type& >(p)); 139 ParamTraits<Type>::Write(m, static_cast<const Type& >(p));
147 } 140 }
148 141
149 template <class P> 142 template <class P>
150 static inline bool WARN_UNUSED_RESULT ReadParam(const Message* m, void** iter, 143 static inline bool WARN_UNUSED_RESULT ReadParam(const Message* m, void** iter,
151 P* p) { 144 P* p) {
152 typedef typename SimilarTypeTraits<P>::Type Type; 145 typedef typename SimilarTypeTraits<P>::Type Type;
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 ReplyParam p(a, b, c, d, e); 1223 ReplyParam p(a, b, c, d, e);
1231 WriteParam(reply, p); 1224 WriteParam(reply, p);
1232 } 1225 }
1233 }; 1226 };
1234 1227
1235 //----------------------------------------------------------------------------- 1228 //-----------------------------------------------------------------------------
1236 1229
1237 } // namespace IPC 1230 } // namespace IPC
1238 1231
1239 #endif // IPC_IPC_MESSAGE_UTILS_H_ 1232 #endif // IPC_IPC_MESSAGE_UTILS_H_
OLDNEW
« no previous file with comments | « ipc/ipc.gypi ('k') | ipc/ipc_param_traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698