diff options
author | sammc <sammc@chromium.org> | 2016-03-23 11:51:58 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-23 18:54:52 +0000 |
commit | a1107b7873a0b930ff197da68c3eaacd751839d5 (patch) | |
tree | c9c4b1348228fc1a4f86b73249d4ad031f91c20c /mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.cc | |
parent | 243c3522db99d0a7d7174fc91ae0f0591eedd062 (diff) | |
download | chromium_src-a1107b7873a0b930ff197da68c3eaacd751839d5.zip chromium_src-a1107b7873a0b930ff197da68c3eaacd751839d5.tar.gz chromium_src-a1107b7873a0b930ff197da68c3eaacd751839d5.tar.bz2 |
Mojo bindings: Fix typemap includes.
Previously, a header defining a StructTraits specialization could not
include its corresponding generated mojom header, due to the mojom
header including the StructTraits header. This required a brittle set of
forward declarations to correctly avoid this; in practice, this mostly
led to StructTraits that were nominally for a particular variant, but
included the generated mojom header from the default variant.
This CL fixes the issue by splitting typemap headers into
public_headers, which define the native type and are included by the
generated mojom header, and headers which define the StructTraits
specialization for the native type and are only included by the
generated mojom source file, allowing the StructTraits header to include
the generated mojom header.
BUG=596202
CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_optional_gpu_tests_rel
Review URL: https://codereview.chromium.org/1821073002
Cr-Commit-Position: refs/heads/master@{#382893}
Diffstat (limited to 'mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.cc')
-rw-r--r-- | mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.cc b/mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.cc new file mode 100644 index 0000000..f58ce84 --- /dev/null +++ b/mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.cc @@ -0,0 +1,21 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.h" +#include "mojo/public/interfaces/bindings/tests/struct_with_traits.mojom.h" + +namespace mojo { + +// static +bool StructTraits<test::StructWithTraits, test::StructWithTraitsImpl>::Read( + test::StructWithTraits_Reader r, + test::StructWithTraitsImpl* out) { + out->set_bool(r.f_bool()); + out->set_uint32(r.f_uint32()); + out->set_uint64(r.f_uint64()); + out->set_string(r.f_string().as_string()); + return true; +} + +} // namespace mojo |