| 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_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 Loading... |
| 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_ |
| OLD | NEW |