diff --git a/peridot/build/modular_config/modular_config_schema.json b/peridot/build/modular_config/modular_config_schema.json index 0985967271b35b7fe2eb65aa356cf73bca09b355..884da64ee0ad334afd3618ef89eec55576720e48 100644 --- a/peridot/build/modular_config/modular_config_schema.json +++ b/peridot/build/modular_config/modular_config_schema.json @@ -62,6 +62,7 @@ }, "enable_cobalt": { "type": "boolean", "default": true }, "enable_story_shell_preload": { "type": "boolean", "default": true }, + "use_parent_runner_for_story_realm": { "type": "boolean", "default": false }, "use_memfs_for_ledger": { "type": "boolean", "default": false }, "startup_agents": { "type": "array", diff --git a/peridot/docs/modular/guide/config.md b/peridot/docs/modular/guide/config.md index 8050ba34371fd4c2382d75d590711579e3389e4a..3f8c0bbb5125ac6589e009b70ef908c9d02184e8 100644 --- a/peridot/docs/modular/guide/config.md +++ b/peridot/docs/modular/guide/config.md @@ -112,6 +112,11 @@ modular_config() target in the product's monolith packages. - When set to false, StoryShell instances are not warmed up as a startup latency optimization. This is used for testing. - **default**: `true` +* `use_parent_runner_for_story_realm`: **boolean** *(optional)* + - When set to true, stories will share a runner provided by the parent + environment. When set to false, new runners will be started in the + environment for stories. + - **default**: `false` * `use_memfs_for_ledger`: **boolean** *(optional)* - Tells the sessionmgr whether it should host+pass a memfs-backed directory to the ledger for the user's repository, or to use /data/LEDGER. diff --git a/peridot/lib/modular_config/modular_config_constants.h b/peridot/lib/modular_config/modular_config_constants.h index 9315bf59db0019a3d514710c59d5792ed42cf969..1d288d4b294865349531616523cf3ad9c40441cb 100644 --- a/peridot/lib/modular_config/modular_config_constants.h +++ b/peridot/lib/modular_config/modular_config_constants.h @@ -52,6 +52,8 @@ constexpr char kEnableStoryShellPreload[] = "enable_story_shell_preload"; constexpr char kStartupAgents[] = "startup_agents"; constexpr char kSessionAgents[] = "session_agents"; constexpr char kUseMemfsForLedger[] = "use_memfs_for_ledger"; +constexpr char kUseParentRunnerForStoryRealm[] = + "use_parent_runner_for_story_realm"; // Shell constants constexpr char kDefaultBaseShellUrl[] = diff --git a/peridot/lib/modular_config/modular_config_xdr.cc b/peridot/lib/modular_config/modular_config_xdr.cc index 128852e71cd9856048eea5b4e879a615ae943b42..6dc4442008223ce33e4383518747da829fefb74c 100644 --- a/peridot/lib/modular_config/modular_config_xdr.cc +++ b/peridot/lib/modular_config/modular_config_xdr.cc @@ -287,6 +287,12 @@ void XdrSessionmgrConfig_v1( xdr->FieldWithDefault(modular_config::kComponentArgs, data->mutable_component_args(), XdrComponentArgs, has_component_args, std::move(default_component_args)); + + bool has_use_parent_runner_for_story_realm = + data->has_use_parent_runner_for_story_realm(); + xdr->FieldWithDefault(modular_config::kUseParentRunnerForStoryRealm, + data->mutable_use_parent_runner_for_story_realm(), + has_use_parent_runner_for_story_realm, false); } } // namespace modular \ No newline at end of file diff --git a/peridot/lib/modular_config/modular_config_xdr_unittest.cc b/peridot/lib/modular_config/modular_config_xdr_unittest.cc index 55ee246efa01d88ae6bda767b19d08d5829cebe8..4c29d113ade9f6a7829deb771d97aceebee2051c 100644 --- a/peridot/lib/modular_config/modular_config_xdr_unittest.cc +++ b/peridot/lib/modular_config/modular_config_xdr_unittest.cc @@ -54,15 +54,15 @@ TEST(ModularConfigXdr, BasemgrDefaultValues) { fuchsia::modular::session::BasemgrConfig read_config; EXPECT_TRUE(XdrRead(read_json, &read_config, XdrBasemgrConfig)); - EXPECT_EQ(true, read_config.enable_cobalt()); - EXPECT_EQ(false, read_config.enable_presenter()); - EXPECT_EQ(true, read_config.use_minfs()); - EXPECT_EQ(false, read_config.use_session_shell_for_story_shell_factory()); - EXPECT_EQ(false, read_config.test()); + EXPECT_TRUE(read_config.enable_cobalt()); + EXPECT_FALSE(read_config.enable_presenter()); + EXPECT_TRUE(read_config.use_minfs()); + EXPECT_FALSE(read_config.use_session_shell_for_story_shell_factory()); + EXPECT_FALSE(read_config.test()); EXPECT_EQ("fuchsia-pkg://fuchsia.com/dev_base_shell#meta/dev_base_shell.cmx", read_config.base_shell().app_config().url()); - EXPECT_EQ(false, read_config.base_shell().keep_alive_after_login()); + EXPECT_FALSE(read_config.base_shell().keep_alive_after_login()); ASSERT_EQ(1u, read_config.session_shell_map().size()); EXPECT_EQ( @@ -96,7 +96,8 @@ TEST(ModularConfigXdr, SessionmgrDefaultValues) { "use_memfs_for_ledger":false, "startup_agents":null, "session_agents":null, - "component_args":null})"; + "component_args":null, + "use_parent_runner_for_story_realm": false})"; // Remove whitespace for string comparison expected_json.erase( @@ -113,6 +114,7 @@ TEST(ModularConfigXdr, SessionmgrDefaultValues) { EXPECT_TRUE(read_config.enable_cobalt()); EXPECT_TRUE(read_config.enable_story_shell_preload()); EXPECT_FALSE(read_config.use_memfs_for_ledger()); + EXPECT_FALSE(read_config.use_parent_runner_for_story_realm()); EXPECT_EQ(0u, read_config.startup_agents().size()); EXPECT_EQ(0u, read_config.session_agents().size()); diff --git a/sdk/fidl/fuchsia.modular.session/modular_config.fidl b/sdk/fidl/fuchsia.modular.session/modular_config.fidl index 2d47414d3f904b90095a7d94a6872f5ccf41b101..daa537009acaddada21b7c49198a912bbc51fcbb 100644 --- a/sdk/fidl/fuchsia.modular.session/modular_config.fidl +++ b/sdk/fidl/fuchsia.modular.session/modular_config.fidl @@ -119,6 +119,12 @@ table SessionmgrConfig { /// A map of agents to the arguments they should be started with. 8: vector<AppConfig> component_args; + + /// When set to true, stories will share a runner provided by the parent + /// environment. When set to false, new runners will be started in the + /// environment for stories. + /// Default: false + 9: bool use_parent_runner_for_story_realm; }; /// Used to pass around configuration references to apps such as base shell,