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

Side by Side Diff: ipc/ipc_param_traits_log_macros.h

Issue 6410007: Make the implementation .cc files go away, instead have the authors give us a... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef IPC_IPC_PARAM_TRAITS_LOG_MACROS_H_
6 #define IPC_IPC_PARAM_TRAITS_LOG_MACROS_H_
7
8 #include <string>
9
10 // Enable IPC include guard convention multiple-inclusion semantics.
11 #undef IPC_MESSAGE_REINCLUDE
12 #define IPC_MESSAGE_REINCLUDE 1
13
14 // Null out all the macros that need nulling.
15 #include "ipc/ipc_message_null_macros.h"
16
17 // STRUCT declarations cause corresponding STRUCT_TRAITS declarations to occur.
18 #undef IPC_STRUCT_BEGIN
19 #undef IPC_STRUCT_MEMBER
20 #undef IPC_STRUCT_END
21 #define IPC_STRUCT_BEGIN(struct_name) IPC_STRUCT_TRAITS_BEGIN(struct_name)
22 #define IPC_STRUCT_MEMBER(type, name) IPC_STRUCT_TRAITS_MEMBER(name)
23 #define IPC_STRUCT_END(struct_name) IPC_STRUCT_TRAITS_END(struct_name)
24
25 // ENUM declarations cause corresponding ENUM_TRAITS declartions to occur.
26 #undef IPC_ENUM_BEGIN
27 #undef IPC_ENUM_VALUE
28 #undef IPC_ENUM_VALUE
29 #undef IPC_ENUM_END
30 #define IPC_ENUM_BEGIN(enum_name) IPC_ENUM_TRAITS_BEGIN(enum_name)
31 #define IPC_ENUM_VALUE(enum_name) IPC_ENUM_TRAITS_VALUE(enum_name)
32 #define IPC_ENUM_END(enum_name) IPC_ENUM_TRAITS_END(enum_name)
jam 2011/02/07 20:17:01 ditto: can we avoid listing the struct twice in IP
33
34 // Set up so next include will generate log methods.
35 #undef IPC_STRUCT_TRAITS_BEGIN
36 #undef IPC_STRUCT_TRAITS_MEMBER
37 #undef IPC_STRUCT_TRAITS_END
38 #define IPC_STRUCT_TRAITS_BEGIN(struct_name) \
39 void ParamTraits<struct_name>::Log(const param_type& p, std::string* l) { \
40 bool needs_comma = false; \
41 l->append("(");
42 #define IPC_STRUCT_TRAITS_MEMBER(name) \
43 if (needs_comma) \
44 l->append(", "); \
45 LogParam(p.name, l); \
46 needs_comma = true;
47 #define IPC_STRUCT_TRAITS_END(struct_name) l->append(")"); }
48
49 #undef IPC_ENUM_TRAITS_BEGIN
50 #undef IPC_ENUM_TRAITS_VALUE
51 #undef IPC_ENUM_TRAITS_END
52 #define IPC_ENUM_TRAITS_BEGIN(enum_name) \
53 void ParamTraits<enum_name>::Log(const param_type& p, std::string* l) { \
54 std::string state; \
55 switch (p) {
56 #define IPC_ENUM_TRAITS_VALUE(name) \
57 case name: \
58 state = #name; \
59 break;
60 #define IPC_ENUM_TRAITS_END(enum_name) \
61 default: \
62 state = "INVALID " #enum_name; \
63 break; \
64 } \
65 LogParam(state, l); \
66 }
67
68 #endif // IPC_IPC_PARAM_TRAITS_LOG_MACROS_H_
69
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698