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

Side by Side Diff: mojo/public/cpp/bindings/tests/pickled_struct_blink.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_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
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_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/native_serialization.h ('k') | mojo/public/cpp/bindings/tests/pickled_struct_blink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698