diff options
author | Steve Block <steveblock@google.com> | 2011-05-12 12:48:14 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-06-02 14:08:37 +0100 |
commit | b4d178df818e8b6e7a1cfbb0e34bbf7bb9d74ec9 (patch) | |
tree | 85bdbdf9e1873a443a8215103fb09d35bd420b33 /Source/WebKit/android/jni/WebViewCore.h | |
parent | 1b22c7a9c33756726c60ab2c9c67d4bbeac153ce (diff) | |
download | external_webkit-b4d178df818e8b6e7a1cfbb0e34bbf7bb9d74ec9.zip external_webkit-b4d178df818e8b6e7a1cfbb0e34bbf7bb9d74ec9.tar.gz external_webkit-b4d178df818e8b6e7a1cfbb0e34bbf7bb9d74ec9.tar.bz2 |
Always check weak global references before using them
We hold weak references to Java objects from native code in several
places to avoid circular reference problems. These objects may become
weakly reachable at any time, after which the GC could null our weak
reference, so we have to null-check at every use.
Note that weak references are nulled before the referent is finalized,
so we can't rely on doing work in the finalizer to wait for the
currently executing message to complete and to remove other messages
from the queue.
This effectively reverts
https://android-git.corp.google.com/g/#change,30955
Bug: 4336862
Change-Id: I431fcac11220cb406c26e31aacb9bda7ea22776e
Diffstat (limited to 'Source/WebKit/android/jni/WebViewCore.h')
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Source/WebKit/android/jni/WebViewCore.h b/Source/WebKit/android/jni/WebViewCore.h index 8d8f303..0e9d80f 100644 --- a/Source/WebKit/android/jni/WebViewCore.h +++ b/Source/WebKit/android/jni/WebViewCore.h @@ -231,24 +231,28 @@ namespace android { bool jsInterrupt(); /** - * Tell the Java side that the origin has exceeded its database quota. + * Posts a message to the UI thread to inform the Java side that the + * origin has exceeded its database quota. * @param url The URL of the page that caused the quota overflow * @param databaseIdentifier the id of the database that caused the * quota overflow. * @param currentQuota The current quota for the origin * @param estimatedSize The estimated size of the database + * @return Whether the message was successfully sent. */ - void exceededDatabaseQuota(const WTF::String& url, + bool exceededDatabaseQuota(const WTF::String& url, const WTF::String& databaseIdentifier, const unsigned long long currentQuota, const unsigned long long estimatedSize); /** - * Tell the Java side that the appcache has exceeded its max size. + * Posts a message to the UI thread to inform the Java side that the + * appcache has exceeded its max size. * @param spaceNeeded is the amount of disk space that would be needed * in order for the last appcache operation to succeed. + * @return Whether the message was successfully sent. */ - void reachedMaxAppCacheSize(const unsigned long long spaceNeeded); + bool reachedMaxAppCacheSize(const unsigned long long spaceNeeded); /** * Set up the PageGroup's idea of which links have been visited, |