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

Side by Side Diff: mojo/public/cpp/bindings/tests/pickled_struct_chromium.h

Issue 1655333002: Add message sizing to basic IPC traits and struct macros. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@with-pickles
Patch Set: include ArrayHeader in size (oops!) and ensure the buffer doesn't relocate Created 4 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
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 MOJO_PUBLIC_CPP_BINDINGS_TESTS_PICKLED_STRUCT_CHROMIUM_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_TESTS_PICKLED_STRUCT_CHROMIUM_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_TESTS_PICKLED_STRUCT_CHROMIUM_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_TESTS_PICKLED_STRUCT_CHROMIUM_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "ipc/ipc_param_traits.h" 13 #include "ipc/ipc_param_traits.h"
14 14
15 namespace base { 15 namespace base {
16 class Pickle; 16 class Pickle;
17 class PickleIterator; 17 class PickleIterator;
18 class PickleSizer;
18 } 19 }
19 20
20 namespace mojo { 21 namespace mojo {
21 namespace test { 22 namespace test {
22 23
23 // An implementation of a hypothetical PickledStruct type specifically for 24 // An implementation of a hypothetical PickledStruct type specifically for
24 // consumers in the greater Chromium tree. 25 // consumers in the greater Chromium tree.
25 class PickledStructChromium { 26 class PickledStructChromium {
26 public: 27 public:
27 PickledStructChromium(); 28 PickledStructChromium();
(...skipping 20 matching lines...) Expand all
48 49
49 } // namespace test 50 } // namespace test
50 } // namespace mojo 51 } // namespace mojo
51 52
52 namespace IPC { 53 namespace IPC {
53 54
54 template <> 55 template <>
55 struct ParamTraits<mojo::test::PickledStructChromium> { 56 struct ParamTraits<mojo::test::PickledStructChromium> {
56 using param_type = mojo::test::PickledStructChromium; 57 using param_type = mojo::test::PickledStructChromium;
57 58
58 static size_t GetSize(const param_type& p) { return 8; } 59 static void GetSize(base::PickleSizer* sizer, const param_type& p);
59 static void Write(base::Pickle* m, const param_type& p); 60 static void Write(base::Pickle* m, const param_type& p);
60 static bool Read(const base::Pickle* m, 61 static bool Read(const base::Pickle* m,
61 base::PickleIterator* iter, 62 base::PickleIterator* iter,
62 param_type* r); 63 param_type* r);
63 static void Log(const param_type& p, std::string* l) {} 64 static void Log(const param_type& p, std::string* l) {}
64 }; 65 };
65 66
66 } // namespace IPC 67 } // namespace IPC
67 68
68 #endif // MOJO_PUBLIC_CPP_BINDINGS_TESTS_PICKLED_STRUCT_CHROMIUM_H_ 69 #endif // MOJO_PUBLIC_CPP_BINDINGS_TESTS_PICKLED_STRUCT_CHROMIUM_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/tests/pickled_struct_blink.cc ('k') | mojo/public/cpp/bindings/tests/pickled_struct_chromium.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698