Hi All,
I have an application running on MacOS (based on Chromium M97) where I'm initiating a Mojo binding from the renderer process and finding that my associated implementation in the browser process is not being executed. Referencing the below example code [1], I've verified that
GetInterface is being called in the renderer process but the
MyInterfaceImpl object is not being created in the browser process. Complicating matters is that this failure appears to be timing related, in that it succeeds most of the time, but will fail more frequently when the system is under heavy CPU load. I've also been unable to reproduce this failure on Windows using the same code.
Is there a recommended way to debug why a specific Mojo connection is failing? Am I doing anything wrong in the below code that might explain this behavior (wrong usage, wrong callback methods, etc)?
Thanks,
Marshall
[1] Example code:
From
ContentRendererClient::RenderFrameCreated in the renderer process:
mojo::Remote<my::mojom::MyInterface> remote;
render_frame->GetBrowserInterfaceBroker()->GetInterface(
remote.BindNewPipeAndPassReceiver()); map->Add<my::mojom::MyInterface>(base::BindRepeating(
[](content::RenderFrameHost* frame_host,
mojo::PendingReceiver<my::mojom::MyInterface> receiver) { // This object is never created.
new MyInterfaceImpl(frame_host, std::move(receiver));
}));