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

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

Issue 1977643002: Generate param traits size methods for IPC files in chrome/ (and traits it depends on). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 7 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_PARAM_TRAITS_H_ 5 #ifndef CHROME_COMMON_SAFE_BROWSING_PROTOBUF_MESSAGE_PARAM_TRAITS_H_
6 #define CHROME_COMMON_SAFE_BROWSING_PROTOBUF_MESSAGE_PARAM_TRAITS_H_ 6 #define CHROME_COMMON_SAFE_BROWSING_PROTOBUF_MESSAGE_PARAM_TRAITS_H_
7 7
8 #include <limits.h> 8 #include <limits.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/pickle.h" 12 #include "base/pickle.h"
13 #include "ipc/ipc_message.h" 13 #include "ipc/ipc_message.h"
14 #include "ipc/ipc_param_traits.h" 14 #include "ipc/ipc_param_traits.h"
15 #include "third_party/protobuf/src/google/protobuf/repeated_field.h" 15 #include "third_party/protobuf/src/google/protobuf/repeated_field.h"
16 16
17 namespace IPC { 17 namespace IPC {
18 18
19 template <class Element> 19 template <class Element>
20 struct ParamTraits<google::protobuf::RepeatedPtrField<Element>> { 20 struct ParamTraits<google::protobuf::RepeatedPtrField<Element>> {
21 typedef google::protobuf::RepeatedPtrField<Element> param_type; 21 typedef google::protobuf::RepeatedPtrField<Element> param_type;
22 22
23 static void GetSize(base::PickleSizer* s, const param_type& p) {
24 GetParamSize(s, p.size());
25 for (const auto& element : p)
26 GetParamSize(s, element);
27 }
28
23 static void Write(base::Pickle* m, const param_type& p) { 29 static void Write(base::Pickle* m, const param_type& p) {
24 WriteParam(m, p.size()); 30 WriteParam(m, p.size());
25 for (const auto& element : p) 31 for (const auto& element : p)
26 WriteParam(m, element); 32 WriteParam(m, element);
27 } 33 }
28 34
29 static bool Read(const base::Pickle* m, 35 static bool Read(const base::Pickle* m,
30 base::PickleIterator* iter, 36 base::PickleIterator* iter,
31 param_type* p) { 37 param_type* p) {
32 int size; 38 int size;
(...skipping 18 matching lines...) Expand all
51 else 57 else
52 logged_first = true; 58 logged_first = true;
53 LogParam(element, l); 59 LogParam(element, l);
54 } 60 }
55 } 61 }
56 }; 62 };
57 63
58 } // namespace IPC 64 } // namespace IPC
59 65
60 #endif // CHROME_COMMON_SAFE_BROWSING_PROTOBUF_MESSAGE_PARAM_TRAITS_H_ 66 #endif // CHROME_COMMON_SAFE_BROWSING_PROTOBUF_MESSAGE_PARAM_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698