Skip to content

Commit 93feb3c

Browse files
dtapuskachromeos-ci-prod
authored andcommitted
[mojo] Force blink headers to only be included in blink
Since blink headers import internal classes WTF::Vector/String/HashMap these files really should be only imported inside blink. Ensure that the INSIDE_BLINK or BLINK_MOJO_IMPL is true in the header include. Change-Id: Ib554ea263847886821200d646e73c17dcc696f60 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5962696 Reviewed-by: Daniel Cheng <dcheng@chromium.org> Commit-Queue: Dave Tapuska <dtapuska@chromium.org> Cr-Commit-Position: refs/heads/main@{#1375246} CrOS-Libchrome-Original-Commit: 83b7fc2ecb7341531fdd346a905618f6fab06d12
1 parent 99afd7d commit 93feb3c

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@
8181
#include "{{export_header}}"
8282
{%- endif %}
8383

84+
{%- if for_blink %}
85+
#if !BLINK_MOJO_IMPL && !INSIDE_BLINK
86+
#error "File must only be imported inside blink"
87+
#endif
88+
{%- endif %}
89+
8490
{% if enable_kythe_annotations -%}
8591
#ifdef KYTHE_IS_RUNNING
8692
#pragma kythe_inline_metadata "Metadata comment"

mojo/public/tools/bindings/mojom.gni

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,6 +1366,9 @@ template("mojom") {
13661366
"base/component_export.h",
13671367
]
13681368
}
1369+
if (defined(variant) && variant == "blink") {
1370+
export_defines += [ "BLINK_MOJO_IMPL=1" ]
1371+
}
13691372

13701373
generator_cpp_output_suffixes = []
13711374
variant_dash_suffix = ""

0 commit comments

Comments
 (0)