New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 742512 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Consuming Blink mojoms from outside //content and Blink is weird

Project Member Reported by dcheng@chromium.org, Jul 13 2017

Issue description

I've seen two recent instances where a mojom outside //content wanted to use the regular variant of Blink mojoms:
- https://chromium-review.googlesource.com/c/534133/
- https://chromium-review.googlesource.com/c/566764/

The problem is that depending on the mojom target itself doesn't work: it leads to fairly obscure compile errors. The root cause is that //third_party/WebKit/public:mojo_bindings can only be consumed from //content, as (my understanding is) it has private, unexported content dependencies.

The solution for now has been to create a separate mojo bindings target for these interfaces, but it's a bit odd to slice the targets along whether or not they'll be used outside //content.
 

Comment 1 by yzshen@chromium.org, Jul 14 2017

//third_party/WebKit/public:mojo_bindings has definitions like:

  export_class_attribute = "CONTENT_EXPORT"
  export_define = "CONTENT_IMPLEMENTATION=1"
  export_header = "content/common/content_export.h"

That will insert CONTENT_EXPORT into the generated bindings code. It also has CONTENT_IMPLEMENTATION=1 so the result only makes sense to be used inside content.

I also saw this comment:
"""  # The chromium variant must be linked with content and use the same export
  # settings in component build because of the WebBluetoothDeviceId typemap
  # inside content.
"""

It makes sense to me to move those mojoms doesn't require content-only typemaps into a new target. What could we do otherwise? :) Interfaces using content-only types are supposed to be consumed by content only.





Cc: -roc...@chromium.org rockot@google.com
Triage. Updating this to clarify what the bug actually is.

AFAICT this is only a problem because for a Blink-defined mojom, we often link the non-Blink variant into the content/common component (as described in comment #1) and export its symbols from there. And AFAICT there are only two reasons we do that:

1. A typemap has a dependency which belongs to content/common, and it's hard to factor out; or
2. A developer unnecessarily followed this pattern because other mojoms were doing it

It seems to me that the solution is to have more granular bindings targets, and to migrate their typemap dependencies into isolated components, so this is a problem not with mojo bindings in general but with having massive component targets. It also seems like something that needs to be addressed on a per-mojom basis, rather than something to be solved by/within Mojo per se.

Status: Available (was: Untriaged)

Sign in to add a comment