Skip to content

Commit

Permalink
[CfM-R108] xu_camera: Use UI thread for D-Bus.
Browse files Browse the repository at this point in the history
When XuCameraService uses IpPeripheralServiceClient to
send dbus commands to IpPeripheralService, it must use
the UI thread.
(https://chromium.googlesource.com/chromiumos/docs/+/HEAD/dbus_in_chrome.md#using-system-daemons_d_bus-services)

Without this change, on M108, gdb showed that we were crashing in
`ObjectProxy::CallMethodWithErrorResponse' on
`bus_->AssertOnOriginThread();` at
https://source.chromium.org/chromium/chromium/src/+/main:dbus/object_proxy.cc;l=169

BUG=b:284299455
TESTED=Endeavour on R108-15183.82.41 and Falcon camera on 1.5.17

Change-Id: I7fc001b329e8ad4ecbe4fa263d2ef5f5a27aeea1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4859064
Commit-Queue: Richard Yeh <rcy@google.com>
Owners-Override: Richard Yeh <rcy@google.com>
Reviewed-by: Kyle Williams <kdgwill@chromium.org>
Cr-Commit-Position: refs/branch-heads/5359_179@{#37}
Cr-Branched-From: 296508e-refs/branch-heads/5359@{#1312}
Cr-Branched-From: 27d3765-refs/heads/main@{#1058933}
  • Loading branch information
Richard Yeh authored and Chromium LUCI CQ committed Sep 13, 2023
1 parent b0c8419 commit 30d8453
Showing 1 changed file with 10 additions and 4 deletions.
Expand Up @@ -438,8 +438,11 @@ void XuCameraService::GetCtrlWithDevicePath(
switch (ctrl->which()) {
case mojom::CtrlType::Tag::kQueryCtrl:
if (is_ip_camera) {
GetCtrlDbus(*dev_path, std::move(ctrl->get_query_ctrl()),
GetRequest(fn), std::move(callback));
content::GetUIThreadTaskRunner({})->PostTask(
FROM_HERE, base::BindOnce(&XuCameraService::GetCtrlDbus,
weak_factory_.GetWeakPtr(), *dev_path,
std::move(ctrl->get_query_ctrl()),
GetRequest(fn), std::move(callback)));
return;
}
error_code =
Expand Down Expand Up @@ -498,8 +501,11 @@ void XuCameraService::SetCtrlWithDevicePath(
switch (ctrl->which()) {
case mojom::CtrlType::Tag::kQueryCtrl:
if (is_ip_camera) {
SetCtrlDbus(*dev_path, std::move(ctrl->get_query_ctrl()), data_,
std::move(callback));
content::GetUIThreadTaskRunner({})->PostTask(
FROM_HERE, base::BindOnce(&XuCameraService::SetCtrlDbus,
weak_factory_.GetWeakPtr(), *dev_path,
std::move(ctrl->get_query_ctrl()), data_,
std::move(callback)));
return;
}
error_code =
Expand Down

0 comments on commit 30d8453

Please sign in to comment.