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

Side by Side Diff: mojo/public/cpp/bindings/tests/shared_rect_traits.h

Issue 2259283003: Mojo C++ bindings: share DataView class between chromium and blink variants. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@92_change_traits_param
Patch Set: . Created 4 years, 4 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
(Empty)
1 // Copyright 2016 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 #ifndef MOJO_PUBLIC_CPP_BINDINGS_TESTS_SHARED_RECT_TRAITS_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_TESTS_SHARED_RECT_TRAITS_H_
7
8 #include "mojo/public/cpp/bindings/struct_traits.h"
9 #include "mojo/public/cpp/bindings/tests/shared_rect.h"
10 #include "mojo/public/interfaces/bindings/tests/rect.mojom-shared.h"
11
12 namespace mojo {
13
14 template <>
15 struct StructTraits<test::SharedTypemappedRectDataView, test::SharedRect> {
16 static int x(const test::SharedRect& r) { return r.x(); }
17 static int y(const test::SharedRect& r) { return r.y(); }
18 static int width(const test::SharedRect& r) { return r.width(); }
19 static int height(const test::SharedRect& r) { return r.height(); }
20
21 static bool Read(test::SharedTypemappedRectDataView r,
22 test::SharedRect* out) {
23 out->set_x(r.x());
24 out->set_y(r.y());
25 out->set_width(r.width());
26 out->set_height(r.height());
27 return true;
28 }
29 };
30
31 } // namespace mojo
32
33 #endif // MOJO_PUBLIC_CPP_BINDINGS_TESTS_SHARED_RECT_TRAITS_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/tests/shared_rect.h ('k') | mojo/public/cpp/bindings/tests/struct_traits_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698