Use base::Value through mojo in blink platform/ |
|||
Issue description
We recently notice that if we have the following mojo interface
interface A {
F(mojo.common.mojom.Value value);
}
We can't call F by passing std::unique_ptr<base::Value> because the generated code for blink accepts blink::ValuePtr.
We tried 2 solutions but both didn't work for us.
1. We copied values.typemap to blink platform/mojo as Values.typemap, and adds it into blink_typemaps.gni, but this results in undefined reference in debug build;
2. We made mojom("common_custom_types") to mojom_component("common_custom_types"), and created a new values_typemap.gni for values.typemap only, and add this gni file to blink_bindings_configuration.gni. But this solution will cause multiple defintions.
Any idea?
,
Jul 10 2017
IIUC, in this case, we could solve the problem by:
- build values_struct_straits.{cc,h} into a component, say, values_component,
- have two typemaps registered for the chromium/webkit variants.
- make values_component a public_deps in these two typemaps.
I would like to avoid having one more kind of typemap config if possible.
Existing example in our code base:
https://cs.chromium.org/chromium/src/ui/gfx/geometry/mojo/geometry.typemap?q=file:typemap+geometry&sq=package:chromium&dr=C&l=5
https://cs.chromium.org/chromium/src/third_party/WebKit/Source/platform/mojo/Geometry.typemap?q=file:typemap+geometry&sq=package:chromium&dr=C&l=5
,
Jul 10 2017
Thanks, I uploaded a patch to fix this. https://chromium-review.googlesource.com/c/565337/
,
Jul 12 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/623921bf99007b51cd9652a9adff459da54f9519 commit 623921bf99007b51cd9652a9adff459da54f9519 Author: Peiyong Lin <lpy@chromium.org> Date: Wed Jul 12 04:18:55 2017 [mojo] Fixed mojo.common.mojom.Value builds inside Blink platform. This patch moves values_struct_traits into a separate target to be shared by the chromium and blink variant, and adds values.typemap to blink's typemap config. BUG= 740288 Change-Id: Iae1bf24dd90ca16af6f7b3e0d3e83d255ae41b16 Reviewed-on: https://chromium-review.googlesource.com/565337 Commit-Queue: lpy <lpy@chromium.org> Reviewed-by: Mike West <mkwst@chromium.org> Reviewed-by: Yuzhu Shen <yzshen@chromium.org> Cr-Commit-Position: refs/heads/master@{#485852} [modify] https://crrev.com/623921bf99007b51cd9652a9adff459da54f9519/mojo/common/BUILD.gn [modify] https://crrev.com/623921bf99007b51cd9652a9adff459da54f9519/mojo/common/values.typemap [modify] https://crrev.com/623921bf99007b51cd9652a9adff459da54f9519/mojo/common/values_struct_traits.h [modify] https://crrev.com/623921bf99007b51cd9652a9adff459da54f9519/third_party/WebKit/Source/platform/mojo/blink_typemaps.gni
,
Jul 12 2017
This should be fixed. |
|||
►
Sign in to add a comment |
|||
Comment 1 by roc...@chromium.org
, Jul 8 2017