OLD | NEW |
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_BLINK_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_TESTS_PICKLED_STRUCT_BLINK_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_TESTS_PICKLED_STRUCT_BLINK_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_TESTS_PICKLED_STRUCT_BLINK_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "ipc/ipc_param_traits.h" | 14 #include "ipc/ipc_param_traits.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class Pickle; | 17 class Pickle; |
18 class PickleIterator; | 18 class PickleIterator; |
| 19 class PickleSizer; |
19 } | 20 } |
20 | 21 |
21 namespace mojo { | 22 namespace mojo { |
22 namespace test { | 23 namespace test { |
23 | 24 |
24 // An implementation of a hypothetical PickledStruct type specifically for | 25 // An implementation of a hypothetical PickledStruct type specifically for |
25 // consumers in Blink. | 26 // consumers in Blink. |
26 // | 27 // |
27 // To make things slightly more interesting, this variation of the type doesn't | 28 // To make things slightly more interesting, this variation of the type doesn't |
28 // support negative values. It'll DCHECK if you try to construct it with any, | 29 // support negative values. It'll DCHECK if you try to construct it with any, |
(...skipping 25 matching lines...) Expand all Loading... |
54 | 55 |
55 } // namespace test | 56 } // namespace test |
56 } // namespace mojo | 57 } // namespace mojo |
57 | 58 |
58 namespace IPC { | 59 namespace IPC { |
59 | 60 |
60 template <> | 61 template <> |
61 struct ParamTraits<mojo::test::PickledStructBlink> { | 62 struct ParamTraits<mojo::test::PickledStructBlink> { |
62 using param_type = mojo::test::PickledStructBlink; | 63 using param_type = mojo::test::PickledStructBlink; |
63 | 64 |
64 static size_t GetSize(const param_type& p) { return 8; } | 65 static void GetSize(base::PickleSizer* sizer, const param_type& p); |
65 static void Write(base::Pickle* m, const param_type& p); | 66 static void Write(base::Pickle* m, const param_type& p); |
66 static bool Read(const base::Pickle* m, | 67 static bool Read(const base::Pickle* m, |
67 base::PickleIterator* iter, | 68 base::PickleIterator* iter, |
68 param_type* r); | 69 param_type* r); |
69 static void Log(const param_type& p, std::string* l) {} | 70 static void Log(const param_type& p, std::string* l) {} |
70 }; | 71 }; |
71 | 72 |
72 } // namespace IPC | 73 } // namespace IPC |
73 | 74 |
74 #endif // MOJO_PUBLIC_CPP_BINDINGS_TESTS_PICKLED_STRUCT_BLINK_H_ | 75 #endif // MOJO_PUBLIC_CPP_BINDINGS_TESTS_PICKLED_STRUCT_BLINK_H_ |
OLD | NEW |