diff options
author | Bart Sears <bsears@google.com> | 2011-04-20 10:17:18 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-04-20 10:17:18 -0700 |
commit | 752846c3545e73f6dc643afc8f8ebd8d84e39fe8 (patch) | |
tree | 105980f5445b53029cb3e7a47168d47c35e98b6e /WebKit | |
parent | 9e879a9666886e49cfea841f0317116a108c1bc0 (diff) | |
parent | c471914f1c3bb86fb8c2fae304d848e7675a9258 (diff) | |
download | external_webkit-752846c3545e73f6dc643afc8f8ebd8d84e39fe8.zip external_webkit-752846c3545e73f6dc643afc8f8ebd8d84e39fe8.tar.gz external_webkit-752846c3545e73f6dc643afc8f8ebd8d84e39fe8.tar.bz2 |
am c471914f: am 80e2925e: Merge "DO NOT MERGE" into honeycomb-mr1
* commit 'c471914f1c3bb86fb8c2fae304d848e7675a9258':
DO NOT MERGE
Diffstat (limited to 'WebKit')
-rw-r--r-- | WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp b/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp index fcfb4ca..cf218e7 100644 --- a/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp +++ b/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp @@ -180,14 +180,29 @@ bool WebUrlLoaderClient::start(bool isMainResource, bool isMainFrame, bool sync, thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(m_request.get(), &WebRequest::start)); // Run callbacks until the queue is exhausted and m_finished is true. + // Sometimes, a sync load can wait forever and lock up the WebCore thread, + // here we use TimedWait() with multiple tries to avoid locking. + const int kMaxNumTimeout = 3; + const int kCallbackWaitingTime = 10; + int num_timeout = 0; while(!m_finished) { while (!m_queue.empty()) { OwnPtr<Task> task(m_queue.front()); m_queue.pop_front(); task->Run(); } - if (m_queue.empty() && !m_finished) { - syncCondition()->Wait(); + if (m_finished) break; + + syncCondition()->TimedWait(base::TimeDelta::FromSeconds(kCallbackWaitingTime)); + if (m_queue.empty()) { + LOGE("Synchronous request timed out after %d seconds for the %dth try, URL: %s", + kCallbackWaitingTime, num_timeout, m_request->getUrl().c_str()); + num_timeout++; + if (num_timeout >= kMaxNumTimeout) { + cancel(); + m_resourceHandle = 0; + return false; + } } } |