Commit 43db4790 authored by Fabrice de Gans-Riberi's avatar Fabrice de Gans-Riberi Committed by Commit Bot

[fuchsia] Add build flag to enable remote debugging in WebRunner.

Bug: 1016036
Change-Id: I9c2125d7b2fe11c08f7fa7024155ae25f4a0360e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1898713Reviewed-by: default avatarWez <wez@chromium.org>
Commit-Queue: Fabrice de Gans-Riberi <fdegans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712396}
parent 12863bae
...@@ -14,11 +14,17 @@ declare_args() { ...@@ -14,11 +14,17 @@ declare_args() {
# TODO(crbug.com/1000858): Revisit this value once hardware playback is fixed # TODO(crbug.com/1000858): Revisit this value once hardware playback is fixed
# (fxb/13659). # (fxb/13659).
enable_software_video_decoders = true enable_software_video_decoders = true
# Set to a non-zero value to enable remote debugging on that port in WebRunner.
web_runner_remote_debugging_port = 0
} }
buildflag_header("buildflags") { buildflag_header("buildflags") {
header = "buildflags.h" header = "buildflags.h"
flags = [ "ENABLE_SOFTWARE_VIDEO_DECODERS=$enable_software_video_decoders" ] flags = [
"ENABLE_SOFTWARE_VIDEO_DECODERS=$enable_software_video_decoders",
"WEB_RUNNER_REMOTE_DEBUGGING_PORT=$web_runner_remote_debugging_port",
]
visibility = [ ":*" ] visibility = [ ":*" ]
} }
...@@ -31,6 +37,7 @@ source_set("common") { ...@@ -31,6 +37,7 @@ source_set("common") {
"common/web_content_runner.h", "common/web_content_runner.h",
] ]
deps = [ deps = [
":buildflags",
"//base", "//base",
"//fuchsia/base", "//fuchsia/base",
"//fuchsia/base:modular", "//fuchsia/base:modular",
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "base/fuchsia/scoped_service_binding.h" #include "base/fuchsia/scoped_service_binding.h"
#include "base/fuchsia/startup_context.h" #include "base/fuchsia/startup_context.h"
#include "base/logging.h" #include "base/logging.h"
#include "fuchsia/runners/buildflags.h"
#include "fuchsia/runners/common/web_component.h" #include "fuchsia/runners/common/web_component.h"
#include "url/gurl.h" #include "url/gurl.h"
...@@ -54,10 +55,17 @@ fuchsia::web::ContextPtr WebContentRunner::CreateWebContext( ...@@ -54,10 +55,17 @@ fuchsia::web::ContextPtr WebContentRunner::CreateWebContext(
// static // static
fuchsia::web::ContextPtr WebContentRunner::CreateDefaultWebContext( fuchsia::web::ContextPtr WebContentRunner::CreateDefaultWebContext(
fuchsia::web::ContextFeatureFlags features) { fuchsia::web::ContextFeatureFlags features) {
return CreateWebContext(BuildCreateContextParams( fuchsia::web::CreateContextParams create_context_params =
OpenDirectoryOrFail( BuildCreateContextParams(OpenDirectoryOrFail(base::FilePath(
base::FilePath(base::fuchsia::kPersistedDataDirectoryPath)), base::fuchsia::kPersistedDataDirectoryPath)),
features)); features);
if (BUILDFLAG(WEB_RUNNER_REMOTE_DEBUGGING_PORT) != 0) {
create_context_params.set_remote_debugging_port(
BUILDFLAG(WEB_RUNNER_REMOTE_DEBUGGING_PORT));
}
return CreateWebContext(std::move(create_context_params));
} }
// static // static
...@@ -114,6 +122,8 @@ void WebContentRunner::StartComponent( ...@@ -114,6 +122,8 @@ void WebContentRunner::StartComponent(
this, this,
std::make_unique<base::fuchsia::StartupContext>(std::move(startup_info)), std::make_unique<base::fuchsia::StartupContext>(std::move(startup_info)),
std::move(controller_request)); std::move(controller_request));
if (BUILDFLAG(WEB_RUNNER_REMOTE_DEBUGGING_PORT) != 0)
component->EnableRemoteDebugging();
component->StartComponent(); component->StartComponent();
component->LoadUrl(url, std::vector<fuchsia::net::http::Header>()); component->LoadUrl(url, std::vector<fuchsia::net::http::Header>());
RegisterComponent(std::move(component)); RegisterComponent(std::move(component));
......
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