dbus call to Chrome?

471 views
Skip to first unread message

Xiaochu Liu

unread,
Sep 7, 2017, 4:45:13 PM9/7/17
to Chromium OS dev
Hi there,

I am aware we are using dbus call frequently in Chrome OS. The dbus call I'm seeing often is calling from Chrome to Chrome OS. But do we actually have dbus call to Chrome as well? I'm investigating options to call a c++ function in Chrome from Chrome OS...

Thanks,
Xiaochu

Justin TerAvest

unread,
Sep 7, 2017, 4:55:02 PM9/7/17
to Xiaochu Liu, Chromium OS dev
Some processes in Chrome OS make D-Bus calls to Chrome.

See src/platform2/login_manager/liveness_checker_impl.cc for an example:
  DVLOG(1) << "Sending a liveness ping to the browser.";
  last_ping_acked_ = false;
  dbus::MethodCall ping(chromeos::kLibCrosServiceInterface,
                        chromeos::kCheckLiveness);
  chrome_dbus_proxy_->CallMethod(&ping,
                                 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
                                 base::Bind(&LivenessCheckerImpl::HandleAck,
                                            weak_ptr_factory_.GetWeakPtr()));



--
--
Chromium OS Developers mailing list: chromiu...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-os-dev?hl=en


Xiaochu Liu

unread,
Sep 7, 2017, 5:13:11 PM9/7/17
to Justin TerAvest, Chromium OS dev
Very helpful! 

Thanks,
-Xiaochu

Yusuke Sato

unread,
Sep 8, 2017, 5:07:54 PM9/8/17
to Xiaochu Liu, Justin TerAvest, Chromium OS dev
In addition to method calls, session_manager also sends a signal (which is one-way) to Chrome browser process.

This one

    <!--                                                                                                                                                                                                                                                                                  
        ArcInstanceStopped:                                                                                                                                                                                                                                                               
        @clean: True if the stopping instance is initiated intentionally. False                                                                                                                                                                                                           
                otherwise, like unexpected instance crash.                                                                                                                                                                                                                                
        @container_instance_id: opaque identifier of the stopped container.                                                                                                                                                                                                               
                See also StartArcInstance.                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                                          
        Sent when ARC instance is stopped. Maybe clean shutdown, or crash.                                                                                                                                                                                                                
    -->
    <signal name="ArcInstanceStopped">
      <arg type="b" name="clean" />
      <arg type="s" name="container_instance_id" />
    </signal>

in platform2/login_manager/dbus_bindings/org.chromium.SessionManagerInterface.xml is one of such signals. It is sent in session_manager_impl.cc like this:

 void SessionManagerImpl::OnAndroidContainerStopped() {
 ...
   adaptor_.SendArcInstanceStoppedSignal(clean, container_instance_id);
 }

-Yusuke

Xiaochu Liu

unread,
Sep 8, 2017, 5:41:23 PM9/8/17
to Yusuke Sato, Justin TerAvest, Chromium OS dev
Thanks!

-Xiaochu

James Cook

unread,
Sep 8, 2017, 9:16:19 PM9/8/17
to Xiaochu Liu, Yusuke Sato, Justin TerAvest, Chromium OS dev, Daniel Erat
FYI - I think we're trying to avoid adding things to kLibCrosServiceInterface (which was just a big bag of different functions) and instead add to smaller interfaces.  derat@ might have suggestions for where to add a new method. What sorts of chrome functions do you need to call?

Daniel Erat

unread,
Sep 8, 2017, 9:21:58 PM9/8/17
to James Cook, Xiaochu Liu, Yusuke Sato, Justin TerAvest, Chromium OS dev
Yes, that's correct. https://crbug.com/692246 has more details, and you can see some example changes in the closed bugs that it's blocked on.

(If there's a bug or design doc tracking what you're doing, I'm happy to try to provide advice there!)

Xiaochu Liu

unread,
Sep 11, 2017, 1:24:23 PM9/11/17
to Daniel Erat, James Cook, Yusuke Sato, Justin TerAvest, Chromium OS dev
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages