Pass the estimated size of new HTML 5 databases to the ChromeClient so it can use that amount to figure an initial default quota.
Change-Id:Ic9372b0c86472b42ba5d0b964aaff1e2bbfe3efa
This commit is contained in:
@@ -162447,6 +162447,8 @@
|
|||||||
</parameter>
|
</parameter>
|
||||||
<parameter name="currentQuota" type="long">
|
<parameter name="currentQuota" type="long">
|
||||||
</parameter>
|
</parameter>
|
||||||
|
<parameter name="estimatedSize" type="long">
|
||||||
|
</parameter>
|
||||||
<parameter name="totalUsedQuota" type="long">
|
<parameter name="totalUsedQuota" type="long">
|
||||||
</parameter>
|
</parameter>
|
||||||
<parameter name="quotaUpdater" type="android.webkit.WebStorage.QuotaUpdater">
|
<parameter name="quotaUpdater" type="android.webkit.WebStorage.QuotaUpdater">
|
||||||
@@ -164109,6 +164111,8 @@
|
|||||||
</parameter>
|
</parameter>
|
||||||
<parameter name="currentQuota" type="long">
|
<parameter name="currentQuota" type="long">
|
||||||
</parameter>
|
</parameter>
|
||||||
|
<parameter name="estimatedSize" type="long">
|
||||||
|
</parameter>
|
||||||
<parameter name="totalUsedQuota" type="long">
|
<parameter name="totalUsedQuota" type="long">
|
||||||
</parameter>
|
</parameter>
|
||||||
<parameter name="quotaUpdater" type="android.webkit.WebStorage.QuotaUpdater">
|
<parameter name="quotaUpdater" type="android.webkit.WebStorage.QuotaUpdater">
|
||||||
|
|||||||
@@ -434,12 +434,14 @@ class CallbackProxy extends Handler {
|
|||||||
((Long) map.get("currentQuota")).longValue();
|
((Long) map.get("currentQuota")).longValue();
|
||||||
long totalUsedQuota =
|
long totalUsedQuota =
|
||||||
((Long) map.get("totalUsedQuota")).longValue();
|
((Long) map.get("totalUsedQuota")).longValue();
|
||||||
|
long estimatedSize =
|
||||||
|
((Long) map.get("estimatedSize")).longValue();
|
||||||
WebStorage.QuotaUpdater quotaUpdater =
|
WebStorage.QuotaUpdater quotaUpdater =
|
||||||
(WebStorage.QuotaUpdater) map.get("quotaUpdater");
|
(WebStorage.QuotaUpdater) map.get("quotaUpdater");
|
||||||
|
|
||||||
mWebChromeClient.onExceededDatabaseQuota(url,
|
mWebChromeClient.onExceededDatabaseQuota(url,
|
||||||
databaseIdentifier, currentQuota, totalUsedQuota,
|
databaseIdentifier, currentQuota, estimatedSize,
|
||||||
quotaUpdater);
|
totalUsedQuota, quotaUpdater);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1195,6 +1197,7 @@ class CallbackProxy extends Handler {
|
|||||||
* @param databaseIdentifier The identifier of the database that the
|
* @param databaseIdentifier The identifier of the database that the
|
||||||
* transaction that caused the overflow was running on.
|
* transaction that caused the overflow was running on.
|
||||||
* @param currentQuota The current quota the origin is allowed.
|
* @param currentQuota The current quota the origin is allowed.
|
||||||
|
* @param estimatedSize The estimated size of the database.
|
||||||
* @param totalUsedQuota is the sum of all origins' quota.
|
* @param totalUsedQuota is the sum of all origins' quota.
|
||||||
* @param quotaUpdater An instance of a class encapsulating a callback
|
* @param quotaUpdater An instance of a class encapsulating a callback
|
||||||
* to WebViewCore to run when the decision to allow or deny more
|
* to WebViewCore to run when the decision to allow or deny more
|
||||||
@@ -1202,7 +1205,8 @@ class CallbackProxy extends Handler {
|
|||||||
*/
|
*/
|
||||||
public void onExceededDatabaseQuota(
|
public void onExceededDatabaseQuota(
|
||||||
String url, String databaseIdentifier, long currentQuota,
|
String url, String databaseIdentifier, long currentQuota,
|
||||||
long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater) {
|
long estimatedSize, long totalUsedQuota,
|
||||||
|
WebStorage.QuotaUpdater quotaUpdater) {
|
||||||
if (mWebChromeClient == null) {
|
if (mWebChromeClient == null) {
|
||||||
quotaUpdater.updateQuota(currentQuota);
|
quotaUpdater.updateQuota(currentQuota);
|
||||||
return;
|
return;
|
||||||
@@ -1213,6 +1217,7 @@ class CallbackProxy extends Handler {
|
|||||||
map.put("databaseIdentifier", databaseIdentifier);
|
map.put("databaseIdentifier", databaseIdentifier);
|
||||||
map.put("url", url);
|
map.put("url", url);
|
||||||
map.put("currentQuota", currentQuota);
|
map.put("currentQuota", currentQuota);
|
||||||
|
map.put("estimatedSize", estimatedSize);
|
||||||
map.put("totalUsedQuota", totalUsedQuota);
|
map.put("totalUsedQuota", totalUsedQuota);
|
||||||
map.put("quotaUpdater", quotaUpdater);
|
map.put("quotaUpdater", quotaUpdater);
|
||||||
exceededQuota.obj = map;
|
exceededQuota.obj = map;
|
||||||
|
|||||||
@@ -215,13 +215,14 @@ public class WebChromeClient {
|
|||||||
* @param databaseIdentifier The identifier of the database that caused the
|
* @param databaseIdentifier The identifier of the database that caused the
|
||||||
* quota overflow.
|
* quota overflow.
|
||||||
* @param currentQuota The current quota for the origin.
|
* @param currentQuota The current quota for the origin.
|
||||||
|
* @param estimatedSize The estimated size of the database.
|
||||||
* @param totalUsedQuota is the sum of all origins' quota.
|
* @param totalUsedQuota is the sum of all origins' quota.
|
||||||
* @param quotaUpdater A callback to inform the WebCore thread that a new
|
* @param quotaUpdater A callback to inform the WebCore thread that a new
|
||||||
* quota is available. This callback must always be executed at some
|
* quota is available. This callback must always be executed at some
|
||||||
* point to ensure that the sleeping WebCore thread is woken up.
|
* point to ensure that the sleeping WebCore thread is woken up.
|
||||||
*/
|
*/
|
||||||
public void onExceededDatabaseQuota(String url, String databaseIdentifier,
|
public void onExceededDatabaseQuota(String url, String databaseIdentifier,
|
||||||
long currentQuota, long totalUsedQuota,
|
long currentQuota, long estimatedSize, long totalUsedQuota,
|
||||||
WebStorage.QuotaUpdater quotaUpdater) {
|
WebStorage.QuotaUpdater quotaUpdater) {
|
||||||
// This default implementation passes the current quota back to WebCore.
|
// This default implementation passes the current quota back to WebCore.
|
||||||
// WebCore will interpret this that new quota was declined.
|
// WebCore will interpret this that new quota was declined.
|
||||||
|
|||||||
@@ -258,20 +258,23 @@ final class WebViewCore {
|
|||||||
* @param url The URL that caused the overflow.
|
* @param url The URL that caused the overflow.
|
||||||
* @param databaseIdentifier The identifier of the database.
|
* @param databaseIdentifier The identifier of the database.
|
||||||
* @param currentQuota The current quota for the origin.
|
* @param currentQuota The current quota for the origin.
|
||||||
|
* @param estimatedSize The estimated size of the database.
|
||||||
*/
|
*/
|
||||||
protected void exceededDatabaseQuota(String url,
|
protected void exceededDatabaseQuota(String url,
|
||||||
String databaseIdentifier,
|
String databaseIdentifier,
|
||||||
long currentQuota) {
|
long currentQuota,
|
||||||
|
long estimatedSize) {
|
||||||
// Inform the callback proxy of the quota overflow. Send an object
|
// Inform the callback proxy of the quota overflow. Send an object
|
||||||
// that encapsulates a call to the nativeSetDatabaseQuota method to
|
// that encapsulates a call to the nativeSetDatabaseQuota method to
|
||||||
// awaken the sleeping webcore thread when a decision from the
|
// awaken the sleeping webcore thread when a decision from the
|
||||||
// client to allow or deny quota is available.
|
// client to allow or deny quota is available.
|
||||||
mCallbackProxy.onExceededDatabaseQuota(url, databaseIdentifier,
|
mCallbackProxy.onExceededDatabaseQuota(url, databaseIdentifier,
|
||||||
currentQuota, getUsedQuota(), new WebStorage.QuotaUpdater() {
|
currentQuota, estimatedSize, getUsedQuota(),
|
||||||
public void updateQuota(long quota) {
|
new WebStorage.QuotaUpdater() {
|
||||||
nativeSetNewStorageLimit(quota);
|
public void updateQuota(long quota) {
|
||||||
}
|
nativeSetNewStorageLimit(quota);
|
||||||
});
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -552,7 +552,8 @@ public class TestShellActivity extends Activity implements LayoutTestController
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onExceededDatabaseQuota(String url_str,
|
public void onExceededDatabaseQuota(String url_str,
|
||||||
String databaseIdentifier, long currentQuota, long totalUsedQuota,
|
String databaseIdentifier, long currentQuota,
|
||||||
|
long estimatedSize, long totalUsedQuota,
|
||||||
WebStorage.QuotaUpdater callback) {
|
WebStorage.QuotaUpdater callback) {
|
||||||
if (mDumpDatabaseCallbacks) {
|
if (mDumpDatabaseCallbacks) {
|
||||||
if (mDatabaseCallbackStrings == null) {
|
if (mDatabaseCallbackStrings == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user