| 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_TYPES_BLINK_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_TESTS_PICKLED_TYPES_BLINK_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_TESTS_PICKLED_TYPES_BLINK_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_TESTS_PICKLED_TYPES_BLINK_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 DCHECK_GE(foo, 0); | 44 DCHECK_GE(foo, 0); |
| 45 foo_ = foo; | 45 foo_ = foo; |
| 46 } | 46 } |
| 47 | 47 |
| 48 int bar() const { return bar_; } | 48 int bar() const { return bar_; } |
| 49 void set_bar(int bar) { | 49 void set_bar(int bar) { |
| 50 DCHECK_GE(bar, 0); | 50 DCHECK_GE(bar, 0); |
| 51 bar_ = bar; | 51 bar_ = bar; |
| 52 } | 52 } |
| 53 | 53 |
| 54 // The |baz| field should never be serialized. |
| 55 int baz() const { return baz_; } |
| 56 void set_baz(int baz) { baz_ = baz; } |
| 57 |
| 54 private: | 58 private: |
| 55 int foo_ = 0; | 59 int foo_ = 0; |
| 56 int bar_ = 0; | 60 int bar_ = 0; |
| 61 int baz_ = 0; |
| 57 | 62 |
| 58 DISALLOW_COPY_AND_ASSIGN(PickledStructBlink); | 63 DISALLOW_COPY_AND_ASSIGN(PickledStructBlink); |
| 59 }; | 64 }; |
| 60 | 65 |
| 61 } // namespace test | 66 } // namespace test |
| 62 } // namespace mojo | 67 } // namespace mojo |
| 63 | 68 |
| 64 namespace IPC { | 69 namespace IPC { |
| 65 | 70 |
| 66 template <> | 71 template <> |
| 67 struct ParamTraits<mojo::test::PickledStructBlink> { | 72 struct ParamTraits<mojo::test::PickledStructBlink> { |
| 68 using param_type = mojo::test::PickledStructBlink; | 73 using param_type = mojo::test::PickledStructBlink; |
| 69 | 74 |
| 70 static void GetSize(base::PickleSizer* sizer, const param_type& p); | 75 static void GetSize(base::PickleSizer* sizer, const param_type& p); |
| 71 static void Write(base::Pickle* m, const param_type& p); | 76 static void Write(base::Pickle* m, const param_type& p); |
| 72 static bool Read(const base::Pickle* m, | 77 static bool Read(const base::Pickle* m, |
| 73 base::PickleIterator* iter, | 78 base::PickleIterator* iter, |
| 74 param_type* r); | 79 param_type* r); |
| 75 static void Log(const param_type& p, std::string* l) {} | 80 static void Log(const param_type& p, std::string* l) {} |
| 76 }; | 81 }; |
| 77 | 82 |
| 78 } // namespace IPC | 83 } // namespace IPC |
| 79 | 84 |
| 80 IPC_ENUM_TRAITS_MAX_VALUE(mojo::test::PickledEnumBlink, | 85 IPC_ENUM_TRAITS_MAX_VALUE(mojo::test::PickledEnumBlink, |
| 81 mojo::test::PickledEnumBlink::VALUE_1) | 86 mojo::test::PickledEnumBlink::VALUE_1) |
| 82 | 87 |
| 83 #endif // MOJO_PUBLIC_CPP_BINDINGS_TESTS_PICKLED_TYPES_BLINK_H_ | 88 #endif // MOJO_PUBLIC_CPP_BINDINGS_TESTS_PICKLED_TYPES_BLINK_H_ |
| OLD | NEW |