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

Side by Side Diff: mojo/public/cpp/bindings/tests/pickled_struct_chromium.cc

Issue 1526533002: [mojo] Add pickling support for native-only structs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bindings-4-bool-deserialize
Patch Set: merge Created 5 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "mojo/public/cpp/bindings/tests/pickled_struct_chromium.h"
6
7 #include "base/pickle.h"
8
9 namespace mojo {
10 namespace test {
11
12 PickledStructChromium::PickledStructChromium() {}
13
14 PickledStructChromium::PickledStructChromium(int foo, int bar)
15 : foo_(foo), bar_(bar) {
16 }
17
18 PickledStructChromium::~PickledStructChromium() {}
19
20 } // namespace test
21 } // namespace mojo
22
23 namespace IPC {
24
25 void ParamTraits<mojo::test::PickledStructChromium>::Write(
26 base::Pickle* m,
27 const param_type& p) {
28 m->WriteInt(p.foo());
29 m->WriteInt(p.bar());
30 }
31
32 bool ParamTraits<mojo::test::PickledStructChromium>::Read(
33 const base::Pickle* m,
34 base::PickleIterator* iter,
35 param_type* p) {
36 int foo, bar;
37 if (!iter->ReadInt(&foo) || !iter->ReadInt(&bar))
38 return false;
39
40 p->set_foo(foo);
41 p->set_bar(bar);
42 return true;
43 }
44
45 } // namespace IPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698