Commit 30f8264d authored by Wez's avatar Wez Committed by Chromium LUCI CQ

[fuchsia] Fix data & CDM quota-bytes configuration handling.

Bug: 1154829
Change-Id: Icd469fee4847b04787096d14f366b0f84b4832c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2577466
Commit-Queue: David Dorwin <ddorwin@chromium.org>
Auto-Submit: Wez <wez@chromium.org>
Reviewed-by: default avatarDavid Dorwin <ddorwin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834442}
parent 4882399a
......@@ -122,11 +122,14 @@ void DeleteStagedForDeletionDirectoryIfExists() {
// Populates |params| with web data settings. Web data persistence is only
// enabled if a soft quota is explicitly specified via config-data.
void SetDataParamsForMainContext(fuchsia::web::CreateContextParams* params) {
// Set web and CDM data quotas based on the CastRunner configuration.
// Set the web data quota based on the CastRunner configuration.
const base::Optional<base::Value>& config = cr_fuchsia::LoadPackageConfig();
if (!config)
return;
constexpr char kDataQuotaBytesSwitch[] = "data-quota-bytes";
const base::Optional<int> data_quota_bytes =
config && config->FindIntPath(kDataQuotaBytesSwitch);
config->FindIntPath(kDataQuotaBytesSwitch);
if (!data_quota_bytes)
return;
......@@ -146,11 +149,13 @@ void SetDataParamsForMainContext(fuchsia::web::CreateContextParams* params) {
// CDM data persistence is always enabled, with an optional soft quota.
void SetCdmParamsForMainContext(fuchsia::web::CreateContextParams* params) {
const base::Optional<base::Value>& config = cr_fuchsia::LoadPackageConfig();
constexpr char kCdmDataQuotaBytesSwitch[] = "cdm-data-quota-bytes";
const base::Optional<int> cdm_data_quota_bytes =
config && config->FindIntPath(kCdmDataQuotaBytesSwitch);
if (cdm_data_quota_bytes)
params->set_cdm_data_quota_bytes(*cdm_data_quota_bytes);
if (config) {
constexpr char kCdmDataQuotaBytesSwitch[] = "cdm-data-quota-bytes";
const base::Optional<int> cdm_data_quota_bytes =
config->FindIntPath(kCdmDataQuotaBytesSwitch);
if (cdm_data_quota_bytes)
params->set_cdm_data_quota_bytes(*cdm_data_quota_bytes);
}
// TODO(b/154204041): Consider using isolated-persistent-storage for CDM data.
// Create an isolated-cache-storage sub-directory for CDM data.
......@@ -694,4 +699,4 @@ void CastRunner::StartComponentInternal(
pending_components_.emplace(std::make_unique<PendingCastComponent>(
this, std::move(startup_context), std::move(controller_request),
url.GetContent()));
}
\ No newline at end of file
}
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