diff options
author | Andrei Popescu <andreip@google.com> | 2009-07-28 13:38:06 +0100 |
---|---|---|
committer | Andrei Popescu <andreip@google.com> | 2009-07-29 11:07:44 +0100 |
commit | 59e2ad93bf37c7ded44c033d38fe7c972e2f4118 (patch) | |
tree | c6c9f7416111e9bceab53e83c52917c42561d27a /core/java/android/webkit/WebStorage.java | |
parent | c6c18133b3969a17c79d21728578f510c8b1560e (diff) | |
download | frameworks_base-59e2ad93bf37c7ded44c033d38fe7c972e2f4118.zip frameworks_base-59e2ad93bf37c7ded44c033d38fe7c972e2f4118.tar.gz frameworks_base-59e2ad93bf37c7ded44c033d38fe7c972e2f4118.tar.bz2 |
Wire in the AppCache out-of-space callback
Diffstat (limited to 'core/java/android/webkit/WebStorage.java')
-rw-r--r-- | core/java/android/webkit/WebStorage.java | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/core/java/android/webkit/WebStorage.java b/core/java/android/webkit/WebStorage.java index 1a60dba..c3b359e 100644 --- a/core/java/android/webkit/WebStorage.java +++ b/core/java/android/webkit/WebStorage.java @@ -55,7 +55,8 @@ public final class WebStorage { // 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(); + private static Condition mUpdateCondition = mLock.newCondition(); + private static boolean mUpdateAvailable; // Message ids static final int UPDATE = 0; @@ -133,8 +134,11 @@ public final class WebStorage { Set ret = null; mLock.lock(); try { + mUpdateAvailable = false; update(); - mCacheUpdated.await(); + while (!mUpdateAvailable) { + mUpdateCondition.await(); + } ret = mOrigins; } catch (InterruptedException e) { Log.e(TAG, "Exception while waiting on the updated origins", e); @@ -155,8 +159,11 @@ public final class WebStorage { } mLock.lock(); try { + mUpdateAvailable = false; update(); - mCacheUpdated.await(); + while (!mUpdateAvailable) { + mUpdateCondition.await(); + } Long usage = mUsages.get(origin); if (usage != null) { ret = usage.longValue(); @@ -180,8 +187,11 @@ public final class WebStorage { } mLock.lock(); try { + mUpdateAvailable = false; update(); - mCacheUpdated.await(); + while (!mUpdateAvailable) { + mUpdateCondition.await(); + } Long quota = mQuotas.get(origin); if (quota != null) { ret = quota.longValue(); @@ -286,7 +296,8 @@ public final class WebStorage { mQuotas.put(origin, new Long(nativeGetQuotaForOrigin(origin))); mUsages.put(origin, new Long(nativeGetUsageForOrigin(origin))); } - mCacheUpdated.signal(); + mUpdateAvailable = true; + mUpdateCondition.signal(); mLock.unlock(); } |