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

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

Issue 2012693002: Generate a templated Clone method for all mojo structs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 #include "mojo/public/cpp/bindings/tests/pickled_struct_blink.h" 5 #include "mojo/public/cpp/bindings/tests/pickled_struct_blink.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/pickle.h" 8 #include "base/pickle.h"
9 9
10 namespace mojo { 10 namespace mojo {
11 namespace test { 11 namespace test {
12 12
13 PickledStructBlink::PickledStructBlink() {} 13 PickledStructBlink::PickledStructBlink() {}
14 14
15 PickledStructBlink::PickledStructBlink(int foo, int bar) 15 PickledStructBlink::PickledStructBlink(int foo, int bar)
16 : foo_(foo), bar_(bar) { 16 : foo_(foo), bar_(bar) {
17 DCHECK_GE(foo_, 0); 17 DCHECK_GE(foo_, 0);
18 DCHECK_GE(bar_, 0); 18 DCHECK_GE(bar_, 0);
19 } 19 }
20 20
21 PickledStructBlink::PickledStructBlink(PickledStructBlink&& other) = default;
22
21 PickledStructBlink::~PickledStructBlink() {} 23 PickledStructBlink::~PickledStructBlink() {}
22 24
23 } // namespace test 25 } // namespace test
24 } // namespace mojo 26 } // namespace mojo
25 27
26 namespace IPC { 28 namespace IPC {
27 29
28 void ParamTraits<mojo::test::PickledStructBlink>::GetSize( 30 void ParamTraits<mojo::test::PickledStructBlink>::GetSize(
29 base::PickleSizer* sizer, 31 base::PickleSizer* sizer,
30 const param_type& p) { 32 const param_type& p) {
(...skipping 14 matching lines...) Expand all
45 int foo, bar; 47 int foo, bar;
46 if (!iter->ReadInt(&foo) || !iter->ReadInt(&bar) || foo < 0 || bar < 0) 48 if (!iter->ReadInt(&foo) || !iter->ReadInt(&bar) || foo < 0 || bar < 0)
47 return false; 49 return false;
48 50
49 p->set_foo(foo); 51 p->set_foo(foo);
50 p->set_bar(bar); 52 p->set_bar(bar);
51 return true; 53 return true;
52 } 54 }
53 55
54 } // namespace IPC 56 } // namespace IPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698