Commit 911b4598 authored by Fabrice de Gans-Riberi's avatar Fabrice de Gans-Riberi Committed by Commit Bot

[fuchsia] Set an ephemeral debugging port for child contexts

Previously, all contexts would share the same port for remote
debugging, resulting in the main context failing to open the remote
debugging port randomly.
With this change, only the main context uses the default port. All other
contexts use an ephemeral port.

Bug: 1076982
Change-Id: I6fa2fee65c10277c5e5e705d051e13f7db62057d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2443531
Commit-Queue: Fabrice de Gans-Riberi <fdegans@chromium.org>
Auto-Submit: Fabrice de Gans-Riberi <fdegans@chromium.org>
Reviewed-by: default avatarSergey Ulanov <sergeyu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#813855}
parent 4ee64a34
...@@ -67,6 +67,9 @@ bool IsPermissionGrantedInAppConfig( ...@@ -67,6 +67,9 @@ bool IsPermissionGrantedInAppConfig(
return false; return false;
} }
// Ephemeral remote debugging port used by child contexts.
const uint16_t kEphemeralRemoteDebuggingPort = 0;
} // namespace } // namespace
CastRunner::CastRunner(bool is_headless) CastRunner::CastRunner(bool is_headless)
...@@ -226,8 +229,6 @@ fuchsia::web::CreateContextParams CastRunner::GetCommonContextParams() { ...@@ -226,8 +229,6 @@ fuchsia::web::CreateContextParams CastRunner::GetCommonContextParams() {
params.set_user_agent_product("CrKey"); params.set_user_agent_product("CrKey");
params.set_user_agent_version("1.43.000000"); params.set_user_agent_version("1.43.000000");
params.set_remote_debugging_port(CastRunner::kRemoteDebuggingPort);
// When tests require that VULKAN be disabled, DRM must also be disabled. // When tests require that VULKAN be disabled, DRM must also be disabled.
if (disable_vulkan_for_test_) { if (disable_vulkan_for_test_) {
*params.mutable_features() &= *params.mutable_features() &=
...@@ -248,6 +249,7 @@ fuchsia::web::CreateContextParams CastRunner::GetCommonContextParams() { ...@@ -248,6 +249,7 @@ fuchsia::web::CreateContextParams CastRunner::GetCommonContextParams() {
fuchsia::web::CreateContextParams CastRunner::GetMainContextParams() { fuchsia::web::CreateContextParams CastRunner::GetMainContextParams() {
fuchsia::web::CreateContextParams params = GetCommonContextParams(); fuchsia::web::CreateContextParams params = GetCommonContextParams();
params.set_remote_debugging_port(CastRunner::kRemoteDebuggingPort);
*params.mutable_features() |= *params.mutable_features() |=
fuchsia::web::ContextFeatureFlags::NETWORK | fuchsia::web::ContextFeatureFlags::NETWORK |
fuchsia::web::ContextFeatureFlags::LEGACYMETRICS; fuchsia::web::ContextFeatureFlags::LEGACYMETRICS;
...@@ -266,6 +268,7 @@ fuchsia::web::CreateContextParams ...@@ -266,6 +268,7 @@ fuchsia::web::CreateContextParams
CastRunner::GetIsolatedContextParamsWithFuchsiaDirs( CastRunner::GetIsolatedContextParamsWithFuchsiaDirs(
std::vector<fuchsia::web::ContentDirectoryProvider> content_directories) { std::vector<fuchsia::web::ContentDirectoryProvider> content_directories) {
fuchsia::web::CreateContextParams params = GetCommonContextParams(); fuchsia::web::CreateContextParams params = GetCommonContextParams();
params.set_remote_debugging_port(kEphemeralRemoteDebuggingPort);
params.set_content_directories(std::move(content_directories)); params.set_content_directories(std::move(content_directories));
isolated_services_->ConnectClient( isolated_services_->ConnectClient(
params.mutable_service_directory()->NewRequest()); params.mutable_service_directory()->NewRequest());
...@@ -275,6 +278,7 @@ CastRunner::GetIsolatedContextParamsWithFuchsiaDirs( ...@@ -275,6 +278,7 @@ CastRunner::GetIsolatedContextParamsWithFuchsiaDirs(
fuchsia::web::CreateContextParams fuchsia::web::CreateContextParams
CastRunner::GetIsolatedContextParamsForCastStreaming() { CastRunner::GetIsolatedContextParamsForCastStreaming() {
fuchsia::web::CreateContextParams params = GetCommonContextParams(); fuchsia::web::CreateContextParams params = GetCommonContextParams();
params.set_remote_debugging_port(kEphemeralRemoteDebuggingPort);
ApplyCastStreamingContextParams(&params); ApplyCastStreamingContextParams(&params);
// TODO(crbug.com/1069746): Use a different FilteredServiceDirectory for Cast // TODO(crbug.com/1069746): Use a different FilteredServiceDirectory for Cast
// Streaming Contexts. // Streaming Contexts.
......
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