Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ enum {
PROP_WEBRTC_UDP_PORTS_RANGE,
PROP_ENABLE_NON_COMPOSITED_WEBGL,
PROP_SCREEN_SUPPORTS_HDR,
PROP_OPPORTUNISTIC_SWEEPING_AND_GC,
N_PROPERTIES,
};

Expand Down Expand Up @@ -459,6 +460,9 @@ ALLOW_DEPRECATED_DECLARATIONS_BEGIN
case PROP_SCREEN_SUPPORTS_HDR:
webkit_settings_set_screen_supports_hdr(settings, g_value_get_boolean(value));
break;
case PROP_OPPORTUNISTIC_SWEEPING_AND_GC:
webkit_settings_set_opportunistic_sweeping_and_gc(settings, g_value_get_boolean(value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
break;
Expand Down Expand Up @@ -700,6 +704,9 @@ ALLOW_DEPRECATED_DECLARATIONS_BEGIN
case PROP_SCREEN_SUPPORTS_HDR:
g_value_set_boolean(value, webkit_settings_get_screen_supports_hdr(settings));
break;
case PROP_OPPORTUNISTIC_SWEEPING_AND_GC:
g_value_set_boolean(value, webkit_settings_get_opportunistic_sweeping_and_gc(settings));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
break;
Expand Down Expand Up @@ -1895,6 +1902,20 @@ static void webkit_settings_class_init(WebKitSettingsClass* klass)
FALSE,
readWriteConstructParamFlags);

/**
* WebKitSettings:opportunistic-sweeping-and-gc:
*
* Enable or disable opportunistic sweeping and garbage collection.
* GC timers will be postponed if any critical tasks are pending.
*
*/
sObjProperties[PROP_OPPORTUNISTIC_SWEEPING_AND_GC] = g_param_spec_boolean(
"opportunistic-sweeping-and-gc",
_("Enable opportunistic sweeping and garbage collection"),
_("Whether opportunistic sweeping and garbage collection should be enabled"),
FEATURE_DEFAULT(OpportunisticSweepingAndGarbageCollectionEnabled),
readWriteConstructParamFlags);

g_object_class_install_properties(gObjectClass, N_PROPERTIES, sObjProperties);
}

Expand Down Expand Up @@ -4958,3 +4979,38 @@ webkit_settings_set_screen_supports_hdr(WebKitSettings* settings, gboolean scree
priv->preferences->setScreenSupportsHDR(screenSupportsHDR);
g_object_notify_by_pspec(G_OBJECT(settings), sObjProperties[PROP_SCREEN_SUPPORTS_HDR]);
}

/**
* webkit_settings_get_opportunistic_sweeping_and_gc:
* @settings: a #WebKitSettings
*
* Get the #WebKitSettings:opportunistic-sweeping-and-gc property.
*
* Returns: %TRUE if opportunistic sweeping and garbage collection is enabled or %FALSE otherwise.
*/
gboolean
webkit_settings_get_opportunistic_sweeping_and_gc(WebKitSettings* settings)
{
g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
return settings->priv->preferences->opportunisticSweepingAndGarbageCollectionEnabled();
}

/**
* webkit_settings_set_opportunistic_sweeping_and_gc:
* @settings: a #WebKitSettings
* @enabled: Value to be set
*
* Set the #WebKitSettings:opportunistic-sweeping-and-gc property.
*/
void
webkit_settings_set_opportunistic_sweeping_and_gc(WebKitSettings* settings, gboolean enabled)
{
g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
WebKitSettingsPrivate* priv = settings->priv;
bool currentValue = priv->preferences->opportunisticSweepingAndGarbageCollectionEnabled();
if (currentValue == enabled)
return;

priv->preferences->setOpportunisticSweepingAndGarbageCollectionEnabled(enabled);
g_object_notify_by_pspec(G_OBJECT(settings), sObjProperties[PROP_OPPORTUNISTIC_SWEEPING_AND_GC]);
}
6 changes: 6 additions & 0 deletions Source/WebKit/UIProcess/API/glib/WebKitSettings.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,12 @@ WEBKIT_API void
webkit_settings_set_screen_supports_hdr (WebKitSettings* settings,
gboolean screenSupportsHDR);

WEBKIT_API gboolean
webkit_settings_get_opportunistic_sweeping_and_gc (WebKitSettings* settings);
WEBKIT_API void
webkit_settings_set_opportunistic_sweeping_and_gc (WebKitSettings* settings,
gboolean enabled);

G_END_DECLS

#endif /* WebKitSettings_h */