summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Popescu <andreip@google.com>2009-07-22 19:21:48 +0100
committerAndrei Popescu <andreip@google.com>2009-07-22 19:21:48 +0100
commit9a56bb838c099a318d4f961f290d324ed5f1949d (patch)
treec378065c3bf20820e72ea0c36f996816f7448772
parentbc4aa5f6935bb91aab3f9913e460771f2f012f8d (diff)
downloadframeworks_base-9a56bb838c099a318d4f961f290d324ed5f1949d.zip
frameworks_base-9a56bb838c099a318d4f961f290d324ed5f1949d.tar.gz
frameworks_base-9a56bb838c099a318d4f961f290d324ed5f1949d.tar.bz2
cleanup the WebStorage Java class. There were too many calls to syncValues().
-rw-r--r--core/java/android/webkit/WebStorage.java13
1 files changed, 4 insertions, 9 deletions
diff --git a/core/java/android/webkit/WebStorage.java b/core/java/android/webkit/WebStorage.java
index 7522b5a..1a60dba 100644
--- a/core/java/android/webkit/WebStorage.java
+++ b/core/java/android/webkit/WebStorage.java
@@ -51,8 +51,9 @@ public final class WebStorage {
// Global instance of a WebStorage
private static WebStorage sWebStorage;
- // We keep a copy of the origins, quotas and usages
- // that we protect via a lock and update in syncValues()
+ // We keep the origins, quotas and usages as member values
+ // that we protect via a lock and update in syncValues().
+ // This is needed to transfer this data across threads.
private static Lock mLock = new ReentrantLock();
private static Condition mCacheUpdated = mLock.newCondition();
@@ -104,18 +105,15 @@ public final class WebStorage {
Origin website = (Origin) msg.obj;
nativeSetQuotaForOrigin(website.getOrigin(),
website.getQuota());
- syncValues();
} break;
case DELETE_ORIGIN: {
Origin website = (Origin) msg.obj;
nativeDeleteOrigin(website.getOrigin());
- syncValues();
} break;
case DELETE_ALL:
nativeDeleteAllData();
- syncValues();
break;
case UPDATE:
@@ -204,7 +202,6 @@ public final class WebStorage {
if (origin != null) {
if (WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName())) {
nativeSetQuotaForOrigin(origin, quota);
- syncValues();
} else {
postMessage(Message.obtain(null, SET_QUOTA_ORIGIN,
new Origin(origin, quota)));
@@ -220,7 +217,6 @@ public final class WebStorage {
if (origin != null) {
if (WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName())) {
nativeDeleteOrigin(origin);
- syncValues();
} else {
postMessage(Message.obtain(null, DELETE_ORIGIN,
new Origin(origin)));
@@ -235,7 +231,6 @@ public final class WebStorage {
public void deleteAllData() {
if (WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName())) {
nativeDeleteAllData();
- syncValues();
} else {
postMessage(Message.obtain(null, DELETE_ALL));
}
@@ -276,7 +271,7 @@ public final class WebStorage {
/**
* Run on the webcore thread
- * sync the local cached values with the real ones
+ * set the local values with the current ones
*/
private void syncValues() {
mLock.lock();