Fix deadlock of WebViewCoreThread

There was a deadlock in destroy process.
Investigation showed that WebViewCoreThread is waiting some
callbacks but in this case WebViewCoreThread can not resume
itself not to call notify method.

Flow:
1. CallbackProxy.sendMessageToUiThreadSync
2. WebViewClassic.destroy()
3. CallbackProxy.blockMessages()
4. CallbackProxy.handleMessage is called via MainThread
5. The WebViewCoreThread deadlock is occured.

The cases we have to call notify method are followings.
OVERRIDE_URL
CREATE_WINDOW
SAVE_PASSWORD
NOTIFY
OPEN_FILE_CHOOSER
JS_ALERT
JS_CONFIRM
JS_PROMPT
JS_UNLOAD
JS_TIMEOUT

Change-Id: I9d95ae500bf6338d77b32b5fa15de7cff5720d0f
This commit is contained in:
Yuya Aoki
2013-03-14 18:02:22 +09:00
committed by Takeshi Aimi
parent ddf7a0660c
commit dae43b16a7

View File

@@ -305,7 +305,12 @@ class CallbackProxy extends Handler {
// in the UI thread. The WebViewClient and WebChromeClient functions
// that check for a non-null callback are ok because java ensures atomic
// 32-bit reads and writes.
if (messagesBlocked()) return;
if (messagesBlocked()) {
synchronized (this) {
notify();
}
return;
}
switch (msg.what) {
case PAGE_STARTED:
String startedUrl = msg.getData().getString("url");