Skip to content

Commit f7bca0e

Browse files
Add API to set "volume capacity override" value
The NetworkStorageManager adjusts the volume capacity to multiples of 1GB in "originQuotaManagerParameters()". This may be too high for embedded systems / containerized apps. This can be overriden using a "volume capacity override" setting, but no API exists to set this value.
1 parent 2b4e92d commit f7bca0e

1 file changed

Lines changed: 27 additions & 1 deletion

File tree

Source/WebKit/UIProcess/API/glib/WebKitWebsiteDataManager.cpp

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ enum {
8888
PROP_IS_EPHEMERAL,
8989
PROP_LOCAL_STORAGE_QUOTA,
9090
PROP_ORIGIN_STORAGE_RATIO,
91-
PROP_TOTAL_STORAGE_RATIO
91+
PROP_TOTAL_STORAGE_RATIO,
92+
PROP_VOLUME_CAPACITY_OVERRIDE
9293
};
9394

9495
struct _WebKitWebsiteDataManagerPrivate {
@@ -119,6 +120,7 @@ struct _WebKitWebsiteDataManagerPrivate {
119120

120121
gdouble originStorageRatio;
121122
gdouble totalStorageRatio;
123+
guint64 volumeCapacityOverride;
122124
unsigned localStorageQuota { 0 };
123125
};
124126

@@ -228,6 +230,9 @@ static void webkitWebsiteDataManagerSetProperty(GObject* object, guint propID, c
228230
case PROP_TOTAL_STORAGE_RATIO:
229231
manager->priv->totalStorageRatio = g_value_get_double(value);
230232
break;
233+
case PROP_VOLUME_CAPACITY_OVERRIDE:
234+
manager->priv->volumeCapacityOverride = g_value_get_uint64(value);
235+
break;
231236
case PROP_LOCAL_STORAGE_QUOTA:
232237
manager->priv->localStorageQuota = g_value_get_uint(value);
233238
WebProcessPool::setLocalStorageQuota(manager->priv->localStorageQuota);
@@ -549,6 +554,24 @@ static void webkit_website_data_manager_class_init(WebKitWebsiteDataManagerClass
549554
nullptr, nullptr,
550555
-1.0, 1.0, -1.0,
551556
static_cast<GParamFlags>(WEBKIT_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)));
557+
558+
/**
559+
* WebKitWebsiteDataManager:volume-capacity-override:
560+
*
561+
* The volume capacity that shall be considered as available for any data storage. Relevant for
562+
* origin and total storage ratios.
563+
* A value of 0, which is the default, means no override shall take place and auto-detection shall
564+
* be performed.
565+
*
566+
* Since: 2.46
567+
*/
568+
g_object_class_install_property(
569+
gObjectClass,
570+
PROP_VOLUME_CAPACITY_OVERRIDE,
571+
g_param_spec_uint64("volume-capacity-override",
572+
nullptr, nullptr,
573+
0, G_MAXUINT64, 0,
574+
static_cast<GParamFlags>(WEBKIT_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)));
552575
}
553576

554577
WebKit::WebsiteDataStore& webkitWebsiteDataManagerGetDataStore(WebKitWebsiteDataManager* manager)
@@ -583,6 +606,9 @@ WebKit::WebsiteDataStore& webkitWebsiteDataManagerGetDataStore(WebKitWebsiteData
583606
if (priv->totalStorageRatio >= 0.0)
584607
configuration->setTotalQuotaRatio(priv->totalStorageRatio);
585608

609+
if (priv->volumeCapacityOverride > 0)
610+
configuration->setVolumeCapacityOverride(priv->volumeCapacityOverride);
611+
586612
priv->websiteDataStore = WebKit::WebsiteDataStore::create(WTFMove(configuration), PAL::SessionID::generatePersistentSessionID());
587613
#if !ENABLE(2022_GLIB_API)
588614
priv->websiteDataStore->setIgnoreTLSErrors(priv->tlsErrorsPolicy == WEBKIT_TLS_ERRORS_POLICY_IGNORE);

0 commit comments

Comments
 (0)