Commit 6b977b2e authored by Fabrice de Gans-Riberi's avatar Fabrice de Gans-Riberi Committed by Commit Bot

[fuchsia] Only create a single channel for ApplicationContext

A channel for chromium.cast.ApplicationContext was created in both
PendingCastComponent and CastComponent. This sometimes caused issues
in agents that make use of ScopedServiceBinding to handle the
server-end of this channel. These agents could get into a state where
they never got a signal on the second client disconnect.

Bug: 1095217, b/158684780
Change-Id: I06e8e1dd35516bb88ea4929e9f43fb4cd862cd1a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2246794
Commit-Queue: Fabrice de Gans-Riberi <fdegans@chromium.org>
Reviewed-by: default avatarKevin Marshall <kmarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#778597}
parent 17cb992f
......@@ -57,6 +57,7 @@ CastComponent::CastComponent(WebContentRunner* runner,
initial_url_rewrite_rules_(
std::move(params.initial_url_rewrite_rules.value())),
api_bindings_client_(std::move(params.api_bindings_client)),
application_context_(params.application_context.Bind()),
media_session_id_(params.media_session_id.value()),
headless_disconnect_watch_(FROM_HERE) {
base::AutoReset<bool> constructor_active_reset(&constructor_active_, true);
......@@ -132,9 +133,6 @@ void CastComponent::StartComponent() {
application_config_.force_content_dimensions()));
}
application_context_ =
agent_manager_->ConnectToAgentService<chromium::cast::ApplicationContext>(
application_config_.agent_url());
application_controller_ = std::make_unique<ApplicationControllerImpl>(
frame(), application_context_.get());
......
......@@ -52,6 +52,8 @@ class CastComponent : public WebComponent,
// Parameters asynchronously initialized by PendingCastComponent.
std::unique_ptr<ApiBindingsClient> api_bindings_client;
chromium::cast::ApplicationConfig application_config;
fidl::InterfaceHandle<chromium::cast::ApplicationContext>
application_context;
base::Optional<std::vector<fuchsia::web::UrlRequestRewriteRule>>
initial_url_rewrite_rules;
base::Optional<uint64_t> media_session_id;
......
......@@ -163,5 +163,7 @@ void PendingCastComponent::MaybeLaunchComponent() {
// user-after-free of |this|.
params_.url_rewrite_rules_provider.set_error_handler(nullptr);
params_.application_context = application_context_.Unbind();
delegate_->LaunchPendingComponent(this, std::move(params_));
}
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