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

Side by Side Diff: chrome/common/safe_browsing/protobuf_message_read_macros.h

Issue 1149113006: Move Pickle to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
OLDNEW
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 #ifndef CHROME_COMMON_SAFE_BROWSING_PROTOBUF_MESSAGE_READ_MACROS_H_ 5 #ifndef CHROME_COMMON_SAFE_BROWSING_PROTOBUF_MESSAGE_READ_MACROS_H_
6 #define CHROME_COMMON_SAFE_BROWSING_PROTOBUF_MESSAGE_READ_MACROS_H_ 6 #define CHROME_COMMON_SAFE_BROWSING_PROTOBUF_MESSAGE_READ_MACROS_H_
7 7
8 // Null out all the macros that need nulling. 8 // Null out all the macros that need nulling.
9 #include "chrome/common/safe_browsing/ipc_protobuf_message_null_macros.h" 9 #include "chrome/common/safe_browsing/ipc_protobuf_message_null_macros.h"
10 10
11 // Set up so next include will generate read methods. 11 // Set up so next include will generate read methods.
12 #undef IPC_PROTOBUF_MESSAGE_TRAITS_BEGIN 12 #undef IPC_PROTOBUF_MESSAGE_TRAITS_BEGIN
13 #undef IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_FUNDAMENTAL_MEMBER 13 #undef IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_FUNDAMENTAL_MEMBER
14 #undef IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER 14 #undef IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER
15 #undef IPC_PROTOBUF_MESSAGE_TRAITS_REPEATED_COMPLEX_MEMBER 15 #undef IPC_PROTOBUF_MESSAGE_TRAITS_REPEATED_COMPLEX_MEMBER
16 #undef IPC_PROTOBUF_MESSAGE_TRAITS_END 16 #undef IPC_PROTOBUF_MESSAGE_TRAITS_END
17 17
18 #define IPC_PROTOBUF_MESSAGE_TRAITS_BEGIN(message_name) \ 18 #define IPC_PROTOBUF_MESSAGE_TRAITS_BEGIN(message_name) \
19 template <class P> \ 19 template <class P> \
20 bool ParamTraits<message_name>::ReadParamF( \ 20 bool ParamTraits<message_name>::ReadParamF( \
21 const Message* m, PickleIterator* iter, param_type* p, \ 21 const Message* m, base::PickleIterator* iter, param_type* p, \
22 void (param_type::*setter_function)(P)) { \ 22 void (param_type::*setter_function)(P)) { \
23 P value; \ 23 P value; \
24 if (!ReadParam(m, iter, &value)) \ 24 if (!ReadParam(m, iter, &value)) \
25 return false; \ 25 return false; \
26 (p->*setter_function)(value); \ 26 (p->*setter_function)(value); \
27 return true; \ 27 return true; \
28 } \ 28 } \
29 bool ParamTraits<message_name>::Read(const Message* m, PickleIterator* iter, \ 29 bool ParamTraits<message_name>::Read(const Message* m, \
30 base::PickleIterator* iter, \
30 param_type* p) { 31 param_type* p) {
32
31 #define IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_FUNDAMENTAL_MEMBER(name) \ 33 #define IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_FUNDAMENTAL_MEMBER(name) \
32 { \ 34 { \
33 bool is_present; \ 35 bool is_present; \
34 if (!iter->ReadBool(&is_present)) \ 36 if (!iter->ReadBool(&is_present)) \
35 return false; \ 37 return false; \
36 if (!is_present) \ 38 if (!is_present) \
37 p->clear_##name(); \ 39 p->clear_##name(); \
38 else if (!ReadParamF(m, iter, p, &param_type::set_##name)) \ 40 else if (!ReadParamF(m, iter, p, &param_type::set_##name)) \
39 return false; \ 41 return false; \
40 } 42 }
43
41 #define IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(name) \ 44 #define IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(name) \
42 { \ 45 { \
43 bool is_present; \ 46 bool is_present; \
44 if (!iter->ReadBool(&is_present)) \ 47 if (!iter->ReadBool(&is_present)) \
45 return false; \ 48 return false; \
46 if (!is_present) \ 49 if (!is_present) \
47 p->clear_##name(); \ 50 p->clear_##name(); \
48 else if (!ReadParam(m, iter, p->mutable_##name())) \ 51 else if (!ReadParam(m, iter, p->mutable_##name())) \
49 return false; \ 52 return false; \
50 } 53 }
54
51 #define IPC_PROTOBUF_MESSAGE_TRAITS_REPEATED_COMPLEX_MEMBER(name) \ 55 #define IPC_PROTOBUF_MESSAGE_TRAITS_REPEATED_COMPLEX_MEMBER(name) \
52 if (!ReadParam(m, iter, p->mutable_##name())) \ 56 if (!ReadParam(m, iter, p->mutable_##name())) \
53 return false; 57 return false;
58
54 #define IPC_PROTOBUF_MESSAGE_TRAITS_END() \ 59 #define IPC_PROTOBUF_MESSAGE_TRAITS_END() \
55 return true; \ 60 return true; \
56 } 61 }
57 62
58 #endif // CHROME_COMMON_SAFE_BROWSING_PROTOBUF_MESSAGE_READ_MACROS_H_ 63 #endif // CHROME_COMMON_SAFE_BROWSING_PROTOBUF_MESSAGE_READ_MACROS_H_
OLDNEW
« no previous file with comments | « chrome/common/safe_browsing/protobuf_message_param_traits.h ('k') | chromecast/common/media/cma_param_traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698