diff --git a/build/config/fuchsia/test/minimum.shard.test-cml b/build/config/fuchsia/test/minimum.shard.test-cml index e08873678ea550..1e42fbb37006fa 100644 --- a/build/config/fuchsia/test/minimum.shard.test-cml +++ b/build/config/fuchsia/test/minimum.shard.test-cml @@ -61,7 +61,7 @@ "fuchsia.hwinfo.Product", "fuchsia.media.ProfileProvider", "fuchsia.process.Launcher", - "fuchsia.sys.Loader", + "fuchsia.sys.Loader" ], }, ], diff --git a/chrome/app/chrome.cml b/chrome/app/chrome.cml index 4ef84128df73e6..f9486a24bc58a6 100644 --- a/chrome/app/chrome.cml +++ b/chrome/app/chrome.cml @@ -67,6 +67,7 @@ "fuchsia.net.name.Lookup", "fuchsia.posix.socket.Provider", "fuchsia.process.Launcher", + "fuchsia.tracing.perfetto.ProducerConnector", "fuchsia.ui.composition.Allocator", "fuchsia.ui.composition.Flatland", "fuchsia.ui.composition.ScreenCapture", diff --git a/chrome/app/chrome_v1.cmx b/chrome/app/chrome_v1.cmx index cd376be6523529..de1dc48acc3dde 100644 --- a/chrome/app/chrome_v1.cmx +++ b/chrome/app/chrome_v1.cmx @@ -31,6 +31,7 @@ "fuchsia.posix.socket.Provider", "fuchsia.process.Launcher", "fuchsia.sysmem.Allocator", + "fuchsia.tracing.perfetto.ProducerConnector", "fuchsia.ui.composition.Allocator", "fuchsia.ui.composition.Flatland", "fuchsia.ui.input3.Keyboard", diff --git a/content/shell/fuchsia/content_shell.cmx b/content/shell/fuchsia/content_shell.cmx index 6fdf0124bf0fe0..8edcff59de2ccd 100644 --- a/content/shell/fuchsia/content_shell.cmx +++ b/content/shell/fuchsia/content_shell.cmx @@ -32,6 +32,7 @@ "fuchsia.process.Launcher", "fuchsia.sys.Launcher", "fuchsia.sysmem.Allocator", + "fuchsia.tracing.perfetto.ProducerConnector", "fuchsia.ui.composition.Allocator", "fuchsia.ui.composition.Flatland", "fuchsia.ui.input3.Keyboard", diff --git a/fuchsia_web/runners/cast/cast_runner.cc b/fuchsia_web/runners/cast/cast_runner.cc index a132087c4a5230..12f3e899a366bd 100644 --- a/fuchsia_web/runners/cast/cast_runner.cc +++ b/fuchsia_web/runners/cast/cast_runner.cc @@ -73,6 +73,7 @@ static constexpr const char* kServices[] = { "fuchsia.ui.composition.Flatland", "fuchsia.ui.input3.Keyboard", "fuchsia.ui.scenic.Scenic", + "fuchsia.tracing.perfetto.ProducerConnector", "fuchsia.vulkan.loader.Loader", }; diff --git a/fuchsia_web/runners/cast/cast_runner.cml b/fuchsia_web/runners/cast/cast_runner.cml index f14c2f54201b0a..b2c765b435d9c9 100644 --- a/fuchsia_web/runners/cast/cast_runner.cml +++ b/fuchsia_web/runners/cast/cast_runner.cml @@ -65,6 +65,7 @@ "fuchsia.settings.Display", "fuchsia.sys.Environment", "fuchsia.sys.Loader", + "fuchsia.tracing.perfetto.ProducerConnector", "fuchsia.ui.composition.Allocator", "fuchsia.ui.composition.Flatland", "fuchsia.ui.input3.Keyboard", diff --git a/fuchsia_web/runners/cast/cast_runner.cmx b/fuchsia_web/runners/cast/cast_runner.cmx index eaf7f8bd68b755..258e26451a7376 100644 --- a/fuchsia_web/runners/cast/cast_runner.cmx +++ b/fuchsia_web/runners/cast/cast_runner.cmx @@ -36,6 +36,7 @@ "fuchsia.sys.Loader", "fuchsia.sys.Runner-cast", "fuchsia.sysmem.Allocator", + "fuchsia.tracing.perfetto.ProducerConnector", "fuchsia.ui.composition.Allocator", "fuchsia.ui.composition.Flatland", "fuchsia.ui.input3.Keyboard", diff --git a/fuchsia_web/runners/web/web_runner.cmx b/fuchsia_web/runners/web/web_runner.cmx index c98e487a46b7b5..fac8885b72ee63 100644 --- a/fuchsia_web/runners/web/web_runner.cmx +++ b/fuchsia_web/runners/web/web_runner.cmx @@ -32,6 +32,7 @@ "fuchsia.sys.Environment", "fuchsia.sys.Loader", "fuchsia.sysmem.Allocator", + "fuchsia.tracing.perfetto.ProducerConnector", "fuchsia.ui.composition.Allocator", "fuchsia.ui.composition.Flatland", "fuchsia.ui.input3.Keyboard", diff --git a/fuchsia_web/webengine/test/web_engine_shell.cmx b/fuchsia_web/webengine/test/web_engine_shell.cmx index a14d6350d9fb31..5817f99d6de984 100644 --- a/fuchsia_web/webengine/test/web_engine_shell.cmx +++ b/fuchsia_web/webengine/test/web_engine_shell.cmx @@ -35,6 +35,7 @@ "fuchsia.sys.Launcher", "fuchsia.sys.Loader", "fuchsia.sysmem.Allocator", + "fuchsia.tracing.perfetto.ProducerConnector", "fuchsia.ui.composition.Allocator", "fuchsia.ui.composition.Flatland", "fuchsia.ui.input3.Keyboard", diff --git a/fuchsia_web/webengine/web_instance.cmx b/fuchsia_web/webengine/web_instance.cmx index 4163a99ea85c81..0f4d39fed6a822 100644 --- a/fuchsia_web/webengine/web_instance.cmx +++ b/fuchsia_web/webengine/web_instance.cmx @@ -34,6 +34,7 @@ "fuchsia.process.Launcher", "fuchsia.settings.Display", "fuchsia.sysmem.Allocator", + "fuchsia.tracing.perfetto.ProducerConnector", "fuchsia.ui.composition.Allocator", "fuchsia.ui.composition.Flatland", "fuchsia.ui.input3.Keyboard", diff --git a/fuchsia_web/webinstance_host/web_instance_host.cc b/fuchsia_web/webinstance_host/web_instance_host.cc index d0bc11f4502844..255506bb5862f6 100644 --- a/fuchsia_web/webinstance_host/web_instance_host.cc +++ b/fuchsia_web/webinstance_host/web_instance_host.cc @@ -355,12 +355,18 @@ std::vector GetRequiredServicesForConfig( // at: // https://fuchsia.dev/reference/fidl/fuchsia.web#CreateContextParams.service_directory std::vector services{ - "fuchsia.buildinfo.Provider", "fuchsia.device.NameProvider", - "fuchsia.fonts.Provider", "fuchsia.hwinfo.Product", - "fuchsia.intl.PropertyProvider", "fuchsia.logger.LogSink", - "fuchsia.memorypressure.Provider", "fuchsia.process.Launcher", + "fuchsia.buildinfo.Provider", + "fuchsia.device.NameProvider", + "fuchsia.fonts.Provider", + "fuchsia.hwinfo.Product", + "fuchsia.intl.PropertyProvider", + "fuchsia.logger.LogSink", + "fuchsia.memorypressure.Provider", + "fuchsia.process.Launcher", "fuchsia.settings.Display", // Used if preferred theme is DEFAULT. - "fuchsia.sysmem.Allocator", "fuchsia.ui.scenic.Scenic"}; + "fuchsia.sysmem.Allocator", + "fuchsia.tracing.perfetto.ProducerConnector", + "fuchsia.ui.scenic.Scenic"}; // TODO(crbug.com/1209031): Provide these conditionally, once corresponding // ContextFeatureFlags have been defined. diff --git a/sandbox/policy/BUILD.gn b/sandbox/policy/BUILD.gn index 6b3f41103fc457..6b593accb53956 100644 --- a/sandbox/policy/BUILD.gn +++ b/sandbox/policy/BUILD.gn @@ -152,6 +152,7 @@ component("policy") { ] deps += [ + "//services/tracing/public/cpp", "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.buildinfo", "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.camera3", "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.fonts", @@ -164,6 +165,7 @@ component("policy") { "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.memorypressure", "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.net.interfaces", "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.sysmem", + "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.tracing.perfetto", "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.ui.scenic", ] } diff --git a/sandbox/policy/fuchsia/DEPS b/sandbox/policy/fuchsia/DEPS new file mode 100644 index 00000000000000..c92f537a276e7a --- /dev/null +++ b/sandbox/policy/fuchsia/DEPS @@ -0,0 +1,3 @@ +include_rules = [ + "+services/tracing/public/cpp", +] diff --git a/sandbox/policy/fuchsia/sandbox_policy_fuchsia.cc b/sandbox/policy/fuchsia/sandbox_policy_fuchsia.cc index 3f5cbb9f8e965f..8bcdca0af30a83 100644 --- a/sandbox/policy/fuchsia/sandbox_policy_fuchsia.cc +++ b/sandbox/policy/fuchsia/sandbox_policy_fuchsia.cc @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -45,6 +46,7 @@ #include "printing/buildflags/buildflags.h" #include "sandbox/policy/mojom/sandbox.mojom.h" #include "sandbox/policy/switches.h" +#include "services/tracing/public/cpp/tracing_features.h" namespace sandbox { namespace policy { @@ -211,7 +213,21 @@ SandboxPolicyFuchsia::SandboxPolicyFuchsia(sandbox::mojom::Sandbox type) { base::SequenceBound( GetServiceDirectoryTaskRunner(), base::ComponentContextForProcess()->svc()); - for (const char* service_name : kMinimalServices) { + + std::vector services(kMinimalServices.begin(), + kMinimalServices.end()); + + // Grant access to the services required by the process type. + std::copy(config->services.begin(), config->services.end(), + std::back_inserter(services)); + + // If system tracing is enabled, then allow child processes to also make + // use of it. + if (tracing::ShouldSetupSystemTracing()) { + services.push_back(fuchsia::tracing::perfetto::ProducerConnector::Name_); + } + + for (const char* service_name : services) { // |service_name_| points to a compile-time constant in // |kMinimalServices|. It will remain valid for the duration of the task. filtered_service_directory_ @@ -219,14 +235,7 @@ SandboxPolicyFuchsia::SandboxPolicyFuchsia(sandbox::mojom::Sandbox type) { .WithArgs(service_name) .Then(base::BindOnce(&AddServiceCallback, service_name)); } - for (const char* service_name : config->services) { - // |service_name_| comes from |config|, which points to a compile-time - // constant. It will remain valid for the duration of the task. - filtered_service_directory_ - .AsyncCall(&base::FilteredServiceDirectory::AddService) - .WithArgs(service_name) - .Then(base::BindOnce(&AddServiceCallback, service_name)); - } + filtered_service_directory_ .AsyncCall(&base::FilteredServiceDirectory::ConnectClient) .WithArgs(service_directory_client_.NewRequest())