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 /url | |
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 'url')
-rw-r--r-- | url/mojo/BUILD.gn | 15 | ||||
-rw-r--r-- | url/mojo/gurl.typemap | 5 | ||||
-rw-r--r-- | url/mojo/origin.typemap | 5 | ||||
-rw-r--r-- | url/url.gyp | 37 |
4 files changed, 12 insertions, 50 deletions
diff --git a/url/mojo/BUILD.gn b/url/mojo/BUILD.gn index 965bb0e..8a93f29 100644 --- a/url/mojo/BUILD.gn +++ b/url/mojo/BUILD.gn @@ -4,24 +4,12 @@ import("//mojo/public/tools/bindings/mojom.gni") -mojom("url_mojom") { - sources = [ - "origin.mojom", - "url.mojom", - ] -} - mojom("url_mojom_gurl") { sources = [ "url.mojom", ] - variant = "chromium" typemaps = [ "gurl.typemap" ] - - public_deps = [ - ":url_mojom", - ] } mojom("url_mojom_origin") { @@ -29,11 +17,10 @@ mojom("url_mojom_origin") { "origin.mojom", ] - variant = "chromium" typemaps = [ "origin.typemap" ] public_deps = [ - ":url_mojom", + ":url_mojom_gurl", ] } diff --git a/url/mojo/gurl.typemap b/url/mojo/gurl.typemap index 93840c5..ddd755b 100644 --- a/url/mojo/gurl.typemap +++ b/url/mojo/gurl.typemap @@ -6,7 +6,10 @@ "c++": { "url.mojom.Url": { "typename": "GURL", - "headers": [ + "public_headers": [ + "url/gurl.h" + ], + "traits_headers": [ "url/mojo/url_gurl_struct_traits.h" ] } diff --git a/url/mojo/origin.typemap b/url/mojo/origin.typemap index d5e49c3..e785ae4 100644 --- a/url/mojo/origin.typemap +++ b/url/mojo/origin.typemap @@ -6,7 +6,10 @@ "c++": { "url.mojom.Origin": { "typename": "url::Origin", - "headers": [ + "public_headers": [ + "url/origin.h" + ], + "traits_headers": [ "url/mojo/origin_struct_traits.h" ] } diff --git a/url/url.gyp b/url/url.gyp index 08bb9ca..9ab87e1 100644 --- a/url/url.gyp +++ b/url/url.gyp @@ -72,46 +72,16 @@ 'target_name': 'url_interfaces_mojom', 'type': 'none', 'variables': { - 'mojom_files': [ - 'mojo/origin.mojom', - 'mojo/url.mojom', - ], - }, - 'includes': [ '../mojo/mojom_bindings_generator_explicit.gypi' ], - }, - { - 'target_name': 'url_mojom_chromium', - 'type': 'none', - 'variables': { - 'mojom_variant': 'chromium', - 'mojom_extra_generator_args': [ - '--typemap', '<(DEPTH)/url/mojo/gurl.typemap', - ], - 'mojom_files': [ - 'mojo/url.mojom', - ], - }, - 'includes': [ '../mojo/mojom_bindings_generator_explicit.gypi' ], - 'dependencies': [ - 'url_interfaces_mojom', - ], - }, - { - 'target_name': 'origin_mojom_chromium', - 'type': 'none', - 'variables': { - 'mojom_variant': 'chromium', 'mojom_extra_generator_args': [ '--typemap', '<(DEPTH)/url/mojo/origin.typemap', + '--typemap', '<(DEPTH)/url/mojo/gurl.typemap', ], 'mojom_files': [ 'mojo/origin.mojom', + 'mojo/url.mojom', ], }, 'includes': [ '../mojo/mojom_bindings_generator_explicit.gypi' ], - 'dependencies': [ - 'url_interfaces_mojom', - ], }, { 'target_name': 'url_mojom', @@ -139,8 +109,7 @@ 'includes': [ '../mojo/mojom_bindings_generator_explicit.gypi' ], 'dependencies': [ '../mojo/mojo_public.gyp:mojo_cpp_bindings', - 'origin_mojom_chromium', - 'url_mojom_chromium', + 'url_interfaces_mojom', ], }, { |