How to find the implementation of mojo interface?

255 views
Skip to first unread message

Rafael

unread,
May 1, 2022, 12:28:17 AM5/1/22
to chromium-mojo
Hi everyone,

I run into a challenge when I try to figure out the section "Find the implementations of the interfaces" in mojoLPM. In this section, it said that I can find the implementation of code_cache.mojom easily by just searching "public blink::mojom::CodeCacheHost" in code search engine. However, after I tried it, I found that a large number of results came out. Another challenge was that GN would not tell you the file name of the implementation filename. How does everyone find out the implementation file of mojo interface efficiently (assume that mojom file provided)? Thanks in advance.


-Rafael

Daniel Cheng

unread,
May 1, 2022, 11:45:16 PM5/1/22
to Rafael, chromium-mojo
Filter out the generated files: the generated proxy classes for forwarding method calls over IPC also inherit from the generated C++ interface. https://source.chromium.org/search?q=%22public%20blink::mojom::CodeCacheHost%22%20-f:gen&sq=&ss=chromium as an example.

That being said, the most reliable way is to usually click on the interface name in the .mojom file, make sure generated and test files are excluded, then click on a random method and see where "Overridden by" leads to. https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/public/mojom/loader/code_cache.mojom;drc=6fa3b54df432518a2966cfab92bed34ba95c6363;bpv=1;bpt=1;l=24?gsn=DidGenerateCacheableMetadata&gs=kythe%3A%2F%2Fchromium.googlesource.com%2Fchromium%2Fsrc%3Flang%3Dmojom%23blink.mojom.CodeCacheHost.DidGenerateCacheableMetadata is an example.'

If you know how one side is binding the interface, you can also look in the corresponding registry on the other side (BrowserIntefaceBroker, et cetera) to try to find where the incoming request is bound, but that can be a bit tricky at times due to the number of ways it's possible to extend the Mojo interface registries.

(In theory, clicking on the interface name should give the same information, but it looks like the class hierarchy information isn't being cross-referenced from the Mojo interface, for whatever reason)

Daniel

--
You received this message because you are subscribed to the Google Groups "chromium-mojo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-moj...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-mojo/38b2aab7-4b40-4ae8-8b69-231aa7e72524n%40chromium.org.
Reply all
Reply to author
Forward
0 new messages