0

[content] Fix ConnectionFilter registration

Fixes the ordering between ContentClient::OnServiceManagerConnected()
and ServiceManagerConnection::Start() in ChildThreadImpl and
UtilityThreadIMpl, ensuring embedders can register their own ConnectionFilters
prior to incoming interface requests being dispatched on the IO thread.

Bug: 894369
Change-Id: Ibaa9290904f1c5004b53111aec687385e4e80a9d
Reviewed-on: https://chromium-review.googlesource.com/c/1279172
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Erik Chen <erikchen@chromium.org>
Commit-Queue: Ken Rockot <rockot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599393}
This commit is contained in:
Ken Rockot
2018-10-12 22:56:30 +00:00
committed by Commit Bot
parent bb11cbc66e
commit efbd9084b6
2 changed files with 10 additions and 2 deletions

@ -743,9 +743,13 @@ void ChildThreadImpl::OnAssociatedInterfaceRequest(
void ChildThreadImpl::StartServiceManagerConnection() {
DCHECK(service_manager_connection_);
service_manager_connection_->Start();
GetContentClient()->OnServiceManagerConnected(
service_manager_connection_.get());
// NOTE: You must register any ConnectionFilter instances on
// |service_manager_connection_| *before* this call to |Start()|, otherwise
// incoming interface requests may race with the registration.
service_manager_connection_->Start();
}
bool ChildThreadImpl::OnControlMessageReceived(const IPC::Message& msg) {

@ -151,8 +151,12 @@ void UtilityThreadImpl::Init() {
service_factory_.reset(new UtilityServiceFactory);
if (connection) {
connection->Start();
GetContentClient()->OnServiceManagerConnected(connection);
// NOTE: You must register any ConnectionFilter instances on |connection|
// *before* this call to |Start()|, otherwise incoming interface requests
// may race with the registration.
connection->Start();
}
}