Commit 662332c4 authored by Fergus Dall's avatar Fergus Dall Committed by Chromium LUCI CQ

VCD: Fix DCHECK failure in RegisterClientWithToken

RegisterClientWithToken posts a task to |proxy_thread_| which does the
actual work and runs the callback. But the callback is the response to
a mojo message that must only be run on the sequence that created
it. This causes a DCHECK failure in mojo::ResponderThunk::Accept.

Fix this by having RegisterClientWithTokenOnProxyThread post a task
back to the original sequence to actually run the callback.

Also have RegisterClientWithTokenOnProxyThread call
AddClientObserverOnProxyThread directly instead of going via
AddClientObserver, as it is already running on the right thread anyway.

This issue appears to have been introduced in CL:2501104

Bug: none
Change-Id: I4ae88c0c508e9120be7526c7b46c492592176500
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2583596
Commit-Queue: Fergus Dall <sidereal@google.com>
Commit-Queue: Wei Lee <wtlee@chromium.org>
Reviewed-by: default avatarWei Lee <wtlee@chromium.org>
Auto-Submit: Fergus Dall <sidereal@google.com>
Cr-Commit-Position: refs/heads/master@{#835604}
parent 6f7d0548
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/synchronization/waitable_event.h" #include "base/synchronization/waitable_event.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "media/base/bind_to_current_loop.h"
#include "media/capture/video/chromeos/mojom/camera_common.mojom.h" #include "media/capture/video/chromeos/mojom/camera_common.mojom.h"
#include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/platform/named_platform_channel.h" #include "mojo/public/cpp/platform/named_platform_channel.h"
...@@ -301,7 +302,8 @@ void CameraHalDispatcherImpl::RegisterClientWithToken( ...@@ -301,7 +302,8 @@ void CameraHalDispatcherImpl::RegisterClientWithToken(
base::BindOnce( base::BindOnce(
&CameraHalDispatcherImpl::RegisterClientWithTokenOnProxyThread, &CameraHalDispatcherImpl::RegisterClientWithTokenOnProxyThread,
base::Unretained(this), std::move(client), type, base::Unretained(this), std::move(client), type,
std::move(client_auth_token), std::move(callback))); std::move(client_auth_token),
media::BindToCurrentLoop(std::move(callback))));
} }
void CameraHalDispatcherImpl::GetJpegDecodeAccelerator( void CameraHalDispatcherImpl::GetJpegDecodeAccelerator(
...@@ -508,7 +510,8 @@ void CameraHalDispatcherImpl::RegisterClientWithTokenOnProxyThread( ...@@ -508,7 +510,8 @@ void CameraHalDispatcherImpl::RegisterClientWithTokenOnProxyThread(
client_observer->client().set_disconnect_handler(base::BindOnce( client_observer->client().set_disconnect_handler(base::BindOnce(
&CameraHalDispatcherImpl::OnCameraHalClientConnectionError, &CameraHalDispatcherImpl::OnCameraHalClientConnectionError,
base::Unretained(this), base::Unretained(client_observer.get()))); base::Unretained(this), base::Unretained(client_observer.get())));
AddClientObserver(std::move(client_observer), std::move(callback)); AddClientObserverOnProxyThread(std::move(client_observer),
std::move(callback));
} }
void CameraHalDispatcherImpl::AddClientObserverOnProxyThread( void CameraHalDispatcherImpl::AddClientObserverOnProxyThread(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment