Skip to content

Commit 9c6b01a

Browse files
Steve BlockAndroid (Google) Code Review
authored andcommitted
Merge "Clean up JavaDoc for WebStorage"
2 parents 9f7296a + 285ddfc commit 9c6b01a

File tree

4 files changed

+160
-100
lines changed

4 files changed

+160
-100
lines changed

core/java/android/webkit/CallbackProxy.java

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -513,34 +513,34 @@ public void handleMessage(Message msg) {
513513
String databaseIdentifier =
514514
(String) map.get("databaseIdentifier");
515515
String url = (String) map.get("url");
516-
long currentQuota =
517-
((Long) map.get("currentQuota")).longValue();
518-
long totalUsedQuota =
519-
((Long) map.get("totalUsedQuota")).longValue();
520-
long estimatedSize =
521-
((Long) map.get("estimatedSize")).longValue();
516+
long quota =
517+
((Long) map.get("quota")).longValue();
518+
long totalQuota =
519+
((Long) map.get("totalQuota")).longValue();
520+
long estimatedDatabaseSize =
521+
((Long) map.get("estimatedDatabaseSize")).longValue();
522522
WebStorage.QuotaUpdater quotaUpdater =
523523
(WebStorage.QuotaUpdater) map.get("quotaUpdater");
524524

525525
mWebChromeClient.onExceededDatabaseQuota(url,
526-
databaseIdentifier, currentQuota, estimatedSize,
527-
totalUsedQuota, quotaUpdater);
526+
databaseIdentifier, quota, estimatedDatabaseSize,
527+
totalQuota, quotaUpdater);
528528
}
529529
break;
530530

531531
case REACHED_APPCACHE_MAXSIZE:
532532
if (mWebChromeClient != null) {
533533
HashMap<String, Object> map =
534534
(HashMap<String, Object>) msg.obj;
535-
long spaceNeeded =
536-
((Long) map.get("spaceNeeded")).longValue();
537-
long totalUsedQuota =
538-
((Long) map.get("totalUsedQuota")).longValue();
535+
long requiredStorage =
536+
((Long) map.get("requiredStorage")).longValue();
537+
long quota =
538+
((Long) map.get("quota")).longValue();
539539
WebStorage.QuotaUpdater quotaUpdater =
540540
(WebStorage.QuotaUpdater) map.get("quotaUpdater");
541541

542-
mWebChromeClient.onReachedMaxAppCacheSize(spaceNeeded,
543-
totalUsedQuota, quotaUpdater);
542+
mWebChromeClient.onReachedMaxAppCacheSize(requiredStorage,
543+
quota, quotaUpdater);
544544
}
545545
break;
546546

@@ -1462,29 +1462,31 @@ public boolean onJsBeforeUnload(String url, String message) {
14621462
* @param url The URL that caused the quota overflow.
14631463
* @param databaseIdentifier The identifier of the database that the
14641464
* transaction that caused the overflow was running on.
1465-
* @param currentQuota The current quota the origin is allowed.
1466-
* @param estimatedSize The estimated size of the database.
1467-
* @param totalUsedQuota is the sum of all origins' quota.
1465+
* @param quota The current quota the origin is allowed.
1466+
* @param estimatedDatabaseSize The estimated size of the database.
1467+
* @param totalQuota is the sum of all origins' quota.
14681468
* @param quotaUpdater An instance of a class encapsulating a callback
14691469
* to WebViewCore to run when the decision to allow or deny more
14701470
* quota has been made.
14711471
*/
14721472
public void onExceededDatabaseQuota(
1473-
String url, String databaseIdentifier, long currentQuota,
1474-
long estimatedSize, long totalUsedQuota,
1473+
String url, String databaseIdentifier, long quota,
1474+
long estimatedDatabaseSize, long totalQuota,
14751475
WebStorage.QuotaUpdater quotaUpdater) {
14761476
if (mWebChromeClient == null) {
1477-
quotaUpdater.updateQuota(currentQuota);
1477+
// Native-side logic prevents the quota being updated to a smaller
1478+
// value.
1479+
quotaUpdater.updateQuota(quota);
14781480
return;
14791481
}
14801482

14811483
Message exceededQuota = obtainMessage(EXCEEDED_DATABASE_QUOTA);
14821484
HashMap<String, Object> map = new HashMap();
14831485
map.put("databaseIdentifier", databaseIdentifier);
14841486
map.put("url", url);
1485-
map.put("currentQuota", currentQuota);
1486-
map.put("estimatedSize", estimatedSize);
1487-
map.put("totalUsedQuota", totalUsedQuota);
1487+
map.put("quota", quota);
1488+
map.put("estimatedDatabaseSize", estimatedDatabaseSize);
1489+
map.put("totalQuota", totalQuota);
14881490
map.put("quotaUpdater", quotaUpdater);
14891491
exceededQuota.obj = map;
14901492
sendMessage(exceededQuota);
@@ -1493,24 +1495,26 @@ public void onExceededDatabaseQuota(
14931495
/**
14941496
* Called by WebViewCore to inform the Java side that the appcache has
14951497
* exceeded its max size.
1496-
* @param spaceNeeded is the amount of disk space that would be needed
1497-
* in order for the last appcache operation to succeed.
1498-
* @param totalUsedQuota is the sum of all origins' quota.
1498+
* @param requiredStorage is the amount of storage, in bytes, that would be
1499+
* needed in order for the last appcache operation to succeed.
1500+
* @param quota is the current quota (for all origins).
14991501
* @param quotaUpdater An instance of a class encapsulating a callback
15001502
* to WebViewCore to run when the decision to allow or deny a bigger
15011503
* app cache size has been made.
15021504
*/
1503-
public void onReachedMaxAppCacheSize(long spaceNeeded,
1504-
long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater) {
1505+
public void onReachedMaxAppCacheSize(long requiredStorage,
1506+
long quota, WebStorage.QuotaUpdater quotaUpdater) {
15051507
if (mWebChromeClient == null) {
1506-
quotaUpdater.updateQuota(0);
1508+
// Native-side logic prevents the quota being updated to a smaller
1509+
// value.
1510+
quotaUpdater.updateQuota(quota);
15071511
return;
15081512
}
15091513

15101514
Message msg = obtainMessage(REACHED_APPCACHE_MAXSIZE);
15111515
HashMap<String, Object> map = new HashMap();
1512-
map.put("spaceNeeded", spaceNeeded);
1513-
map.put("totalUsedQuota", totalUsedQuota);
1516+
map.put("requiredStorage", requiredStorage);
1517+
map.put("quota", quota);
15141518
map.put("quotaUpdater", quotaUpdater);
15151519
msg.obj = map;
15161520
sendMessage(msg);

core/java/android/webkit/WebChromeClient.java

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -216,37 +216,54 @@ public boolean onJsBeforeUnload(WebView view, String url, String message,
216216
}
217217

218218
/**
219-
* Tell the client that the database quota for the origin has been exceeded.
220-
* @param url The URL that triggered the notification
221-
* @param databaseIdentifier The identifier of the database that caused the
222-
* quota overflow.
223-
* @param currentQuota The current quota for the origin.
224-
* @param estimatedSize The estimated size of the database.
225-
* @param totalUsedQuota is the sum of all origins' quota.
226-
* @param quotaUpdater A callback to inform the WebCore thread that a new
227-
* quota is available. This callback must always be executed at some
228-
* point to ensure that the sleeping WebCore thread is woken up.
219+
* Tell the client that the quota has been exceeded for the Web SQL Database
220+
* API for a particular origin and request a new quota. The client must
221+
* respond by invoking the
222+
* {@link WebStorage.QuotaUpdater#updateQuota(long) updateQuota(long)}
223+
* method of the supplied {@link WebStorage.QuotaUpdater} instance. The
224+
* minimum value that can be set for the new quota is the current quota. The
225+
* default implementation responds with the current quota, so the quota will
226+
* not be increased.
227+
* @param url The URL of the page that triggered the notification
228+
* @param databaseIdentifier The identifier of the database where the quota
229+
* was exceeded.
230+
* @param quota The quota for the origin, in bytes
231+
* @param estimatedDatabaseSize The estimated size of the offending
232+
* database, in bytes
233+
* @param totalQuota The total quota for all origins, in bytes
234+
* @param quotaUpdater An instance of {@link WebStorage.QuotaUpdater} which
235+
* must be used to inform the WebView of the new quota.
229236
*/
237+
// Note that the callback must always be executed at some point to ensure
238+
// that the sleeping WebCore thread is woken up.
230239
public void onExceededDatabaseQuota(String url, String databaseIdentifier,
231-
long currentQuota, long estimatedSize, long totalUsedQuota,
232-
WebStorage.QuotaUpdater quotaUpdater) {
240+
long quota, long estimatedDatabaseSize, long totalQuota,
241+
WebStorage.QuotaUpdater quotaUpdater) {
233242
// This default implementation passes the current quota back to WebCore.
234243
// WebCore will interpret this that new quota was declined.
235-
quotaUpdater.updateQuota(currentQuota);
244+
quotaUpdater.updateQuota(quota);
236245
}
237246

238247
/**
239-
* Tell the client that the Application Cache has exceeded its max size.
240-
* @param spaceNeeded is the amount of disk space that would be needed
241-
* in order for the last appcache operation to succeed.
242-
* @param totalUsedQuota is the sum of all origins' quota.
243-
* @param quotaUpdater A callback to inform the WebCore thread that a new
244-
* app cache size is available. This callback must always be executed at
245-
* some point to ensure that the sleeping WebCore thread is woken up.
248+
* Tell the client that the quota has been reached for the Application Cache
249+
* API and request a new quota. The client must respond by invoking the
250+
* {@link WebStorage.QuotaUpdater#updateQuota(long) updateQuota(long)}
251+
* method of the supplied {@link WebStorage.QuotaUpdater} instance. The
252+
* minimum value that can be set for the new quota is the current quota. The
253+
* default implementation responds with the current quota, so the quota will
254+
* not be increased.
255+
* @param requiredStorage The amount of storage required by the Application
256+
* Cache operation that triggered this notification,
257+
* in bytes.
258+
* @param quota The quota, in bytes
259+
* @param quotaUpdater An instance of {@link WebStorage.QuotaUpdater} which
260+
* must be used to inform the WebView of the new quota.
246261
*/
247-
public void onReachedMaxAppCacheSize(long spaceNeeded, long totalUsedQuota,
262+
// Note that the callback must always be executed at some point to ensure
263+
// that the sleeping WebCore thread is woken up.
264+
public void onReachedMaxAppCacheSize(long requiredStorage, long quota,
248265
WebStorage.QuotaUpdater quotaUpdater) {
249-
quotaUpdater.updateQuota(0);
266+
quotaUpdater.updateQuota(quota);
250267
}
251268

252269
/**

0 commit comments

Comments
 (0)