Merge "Fix wording of JSE heap size limit configuration APIs" into androidx-main
NOKEYCHECK=True
GitOrigin-RevId: ecbce54583c0f6afedf36a6dc25748fe93ea5432
diff --git a/main/java/androidx/javascriptengine/IsolateStartupParameters.java b/main/java/androidx/javascriptengine/IsolateStartupParameters.java
index fe7714f..fcb961f 100644
--- a/main/java/androidx/javascriptengine/IsolateStartupParameters.java
+++ b/main/java/androidx/javascriptengine/IsolateStartupParameters.java
@@ -25,7 +25,10 @@
public final class IsolateStartupParameters {
private long mMaxHeapSizeBytes;
private int mMaxEvaluationReturnSizeBytes = DEFAULT_MAX_EVALUATION_RETURN_SIZE_BYTES;
- public static final long DEFAULT_ISOLATE_HEAP_SIZE = 0;
+ /**
+ * Special value for selecting a default heap size limit (which may be device-specific).
+ */
+ public static final long DEFAULT_MAX_HEAP_SIZE = 0;
/**
* Default maximum size in bytes for evaluation returns/errors.
*/
@@ -37,11 +40,11 @@
/**
* Sets the max heap size used by the {@link JavaScriptIsolate}.
* <p>
- * A heap size of {@link IsolateStartupParameters#DEFAULT_ISOLATE_HEAP_SIZE} indicates no
- * limit.
+ * A heap size of {@link IsolateStartupParameters#DEFAULT_MAX_HEAP_SIZE} indicates to use a
+ * default limit (which may be device-specific).
* <p>
- * If a value higher than the device specific maximum heap size limit is supplied, this limit
- * will be used as the maximum heap size.
+ * If a value higher than the device-specific maximum heap size limit is supplied, the device's
+ * maximum limit will be used as the heap size limit.
* <p>
* The applied limit may not be exact. For example, the limit may internally be rounded up to
* some multiple of bytes, be increased to some minimum value, or reduced to some maximum
@@ -58,7 +61,8 @@
* exhaustion equally, and may crash the sandbox without attributing the failure to memory
* exhaustion in a particular isolate.
*
- * @param size heap size in bytes
+ * @param size {@link IsolateStartupParameters#DEFAULT_MAX_HEAP_SIZE} or a heap size limit in
+ * bytes
*/
@RequiresFeature(name = JavaScriptSandbox.JS_FEATURE_ISOLATE_MAX_HEAP_SIZE,
enforcement = "androidx.javascriptengine.JavaScriptSandbox#isFeatureSupported")
@@ -94,10 +98,10 @@
* Gets the max heap size used by the {@link JavaScriptIsolate}.
* <p>
* If not set using {@link IsolateStartupParameters#setMaxHeapSizeBytes(long)}, the default
- * value is {@link IsolateStartupParameters#DEFAULT_ISOLATE_HEAP_SIZE} which indicates no
- * heap size limit.
+ * value is {@link IsolateStartupParameters#DEFAULT_MAX_HEAP_SIZE} which indicates a default
+ * limit will be chosen automatically.
*
- * @return heap size in bytes
+ * @return {@link IsolateStartupParameters#DEFAULT_MAX_HEAP_SIZE} or a heap size limit in bytes
*/
public @IntRange(from = 0) long getMaxHeapSizeBytes() {
return mMaxHeapSizeBytes;