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> |
(...skipping 14 matching lines...) Expand all Loading... |
25 // An implementation of a hypothetical PickledStruct type specifically for | 25 // An implementation of a hypothetical PickledStruct type specifically for |
26 // consumers in Blink. | 26 // consumers in Blink. |
27 // | 27 // |
28 // 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 |
29 // 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, |
30 // and it will fail deserialization if negative values are decoded. | 30 // and it will fail deserialization if negative values are decoded. |
31 class PickledStructBlink { | 31 class PickledStructBlink { |
32 public: | 32 public: |
33 PickledStructBlink(); | 33 PickledStructBlink(); |
34 PickledStructBlink(int foo, int bar); | 34 PickledStructBlink(int foo, int bar); |
35 PickledStructBlink(PickledStructBlink&& other) = default; | 35 PickledStructBlink(PickledStructBlink&& other); |
36 ~PickledStructBlink(); | 36 ~PickledStructBlink(); |
37 | 37 |
38 PickledStructBlink& operator=(PickledStructBlink&& other) = default; | 38 PickledStructBlink& operator=(PickledStructBlink&& other) = default; |
39 | 39 |
40 int foo() const { return foo_; } | 40 int foo() const { return foo_; } |
41 void set_foo(int foo) { | 41 void set_foo(int foo) { |
42 DCHECK_GE(foo, 0); | 42 DCHECK_GE(foo, 0); |
43 foo_ = foo; | 43 foo_ = foo; |
44 } | 44 } |
45 | 45 |
(...skipping 23 matching lines...) Expand all Loading... |
69 static void Write(base::Pickle* m, const param_type& p); | 69 static void Write(base::Pickle* m, const param_type& p); |
70 static bool Read(const base::Pickle* m, | 70 static bool Read(const base::Pickle* m, |
71 base::PickleIterator* iter, | 71 base::PickleIterator* iter, |
72 param_type* r); | 72 param_type* r); |
73 static void Log(const param_type& p, std::string* l) {} | 73 static void Log(const param_type& p, std::string* l) {} |
74 }; | 74 }; |
75 | 75 |
76 } // namespace IPC | 76 } // namespace IPC |
77 | 77 |
78 #endif // MOJO_PUBLIC_CPP_BINDINGS_TESTS_PICKLED_STRUCT_BLINK_H_ | 78 #endif // MOJO_PUBLIC_CPP_BINDINGS_TESTS_PICKLED_STRUCT_BLINK_H_ |
OLD | NEW |