Google Groups

Trying to establish a basic Mojo connection in Chromium


Simon Que Jan 6, 2016 2:04 PM
Posted in group: Chromium-dev
I'm trying to connect the browser and renderer processes using Mojo. I want the renderer process to call the function on the browser process. I imitated some of the existing Chromium code that uses Mojo but it's not working. The Mojo interface function is not being called when the caller in the remote process is attempting to call it.

Explanation of files:
- leak_detector_monitor.mojom: The LeakDetectorMonitor interface that exposes a single function, StoreLeakReport().
- leak_detector_monitor_impl.(cc|h): Implements the LeakDetectorMonitor interface. StoreLeakReport() doesn't actually do anything. It just logs a message. Exposes a Create() function.
- leak_detector_monitor_client.(cc|h): Singleton class that connects to LeakDetectorMonitorImpl using the ServiceRegistry and calls StoreLeakReport().
- chrome/browser/chrome_content_browser_client.cc: Add LeakDetectorMonitorImpl::Create() to the service registry.
- chrome/renderer/chrome_render_process_observer.cc: Initialize LeakDetectorMonitorClient.

The log is shown below (Chrome on Chrome OS). The new interface is registered with the service registry in chrome_content_browser_client.cc and leak_detector_monitor_client.cc connects to it successfully. However, there is no logging from either the Create() function or the StoreLeakReport() function in leak_detector_monitor_impl.cc.

What am I doing wrong?

Simon

========================================================================
[3662:3662:0105/180101:ERROR:chrome_content_browser_client.cc(2648)] Adding LeakDetectorMonitorImpl service
[3662:3662:0105/180101:ERROR:chrome_content_browser_client.cc(2648)] Adding LeakDetectorMonitorImpl service
[3920:3920:0105/180101:ERROR:leak_detector_monitor_client.cc(44)] Connecting to remote service
[3920:3920:0105/180101:ERROR:leak_detector_monitor_client.cc(46)]   result: 1
[3920:3920:0105/180101:ERROR:leak_detector_monitor_client.cc(56)] LeakDetectorMonitorClient::OnLeakFound
[3920:3920:0105/180101:ERROR:leak_detector_monitor_client.cc(58)] Done
[3662:3662:0105/180101:ERROR:chrome_content_browser_client.cc(2648)] Adding LeakDetectorMonitorImpl service
[4110:4110:0105/180101:ERROR:chrome_content_browser_client.cc(2648)] Adding LeakDetectorMonitorImpl service
[4110:4110:0105/180101:ERROR:chrome_content_browser_client.cc(2648)] Adding LeakDetectorMonitorImpl service
[4345:4345:0105/180101:ERROR:leak_detector_monitor_client.cc(44)] Connecting to remote service
[4345:4345:0105/180101:ERROR:leak_detector_monitor_client.cc(46)]   result: 1
[4345:4345:0105/180101:ERROR:leak_detector_monitor_client.cc(56)] LeakDetectorMonitorClient::OnLeakFound
[4345:4345:0105/180101:ERROR:leak_detector_monitor_client.cc(58)] Done
[4110:4110:0105/180101:ERROR:chrome_content_browser_client.cc(2648)] Adding LeakDetectorMonitorImpl service
[4548:4548:0105/180101:ERROR:chrome_content_browser_client.cc(2648)] Adding LeakDetectorMonitorImpl service
[4548:4548:0105/180101:ERROR:chrome_content_browser_client.cc(2648)] Adding LeakDetectorMonitorImpl service
[4810:4810:0105/180101:ERROR:leak_detector_monitor_client.cc(44)] Connecting to remote service
[4810:4810:0105/180101:ERROR:leak_detector_monitor_client.cc(46)]   result: 1
[4810:4810:0105/180101:ERROR:leak_detector_monitor_client.cc(56)] LeakDetectorMonitorClient::OnLeakFound
[4548:4548:0105/180102:ERROR:chrome_content_browser_client.cc(2648)] Adding LeakDetectorMonitorImpl service
[5034:5034:0105/180102:ERROR:chrome_content_browser_client.cc(2648)] Adding LeakDetectorMonitorImpl service
[5034:5034:0105/180102:ERROR:chrome_content_browser_client.cc(2648)] Adding LeakDetectorMonitorImpl service
[5292:5292:0105/180102:ERROR:leak_detector_monitor_client.cc(44)] Connecting to remote service
[5292:5292:0105/180102:ERROR:leak_detector_monitor_client.cc(46)]   result: 1
[5292:5292:0105/180102:ERROR:leak_detector_monitor_client.cc(56)] LeakDetectorMonitorClient::OnLeakFound
[5292:5292:0105/180102:ERROR:leak_detector_monitor_client.cc(58)] Done
[5034:5034:0105/180102:ERROR:chrome_content_browser_client.cc(2648)] Adding LeakDetectorMonitorImpl service