summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2011-02-18 15:58:41 +0000
committerKristian Monsen <kristianm@google.com>2011-02-18 16:20:32 +0000
commit307f42fb458f80f70023ef4cedabed30da37079d (patch)
tree98e1a70b86f68cdb400ef6201b42fdef2faeac11
parentcc30bda6414cbf4dc6dc760c50cbfe39b1895ba4 (diff)
downloadexternal_webkit-307f42fb458f80f70023ef4cedabed30da37079d.zip
external_webkit-307f42fb458f80f70023ef4cedabed30da37079d.tar.gz
external_webkit-307f42fb458f80f70023ef4cedabed30da37079d.tar.bz2
Part of fix for bug 3424424 Browser hanging
Always calling complete, and adding an assert if Wait finishes without incrementing the count. Change-Id: Iceec36c2b82f225ee88cd67eeb18d5c5064c6bfb
-rw-r--r--WebKit/android/WebCoreSupport/WebCookieJar.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/WebKit/android/WebCoreSupport/WebCookieJar.cpp b/WebKit/android/WebCoreSupport/WebCookieJar.cpp
index 9c1d7fa..99de67e 100644
--- a/WebKit/android/WebCoreSupport/WebCookieJar.cpp
+++ b/WebKit/android/WebCoreSupport/WebCookieJar.cpp
@@ -31,9 +31,16 @@
#include "WebRequestContext.h"
#include "WebUrlLoaderClient.h"
-
+#include <cutils/log.h>
#include <dirent.h>
+#undef ASSERT
+#define ASSERT(assertion, ...) do \
+ if (!(assertion)) { \
+ android_printLog(ANDROID_LOG_ERROR, __FILE__, __VA_ARGS__); \
+ } \
+while (0)
+
namespace android {
static WTF::Mutex instanceMutex;
@@ -193,16 +200,21 @@ public:
Task* callback = NewRunnableMethod(this, &FlushSemaphore::Callback);
ioThread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
monster, &net::CookieMonster::FlushStore, callback));
+ } else {
+ Callback();
}
}
// Block until the given number of callbacks has been made.
void Wait(int numCallbacks) {
AutoLock al(m_lock);
+ int lastCount = m_count;
while (m_count < numCallbacks) {
// TODO(husky): Maybe use TimedWait() here? But it's not obvious what
// to do if the flush fails. Might be okay just to let the OS kill us.
m_condition.Wait();
+ ASSERT(lastCount != m_count, "Wait finished without incrementing m_count %d %d", m_count, lastCount);
+ lastCount = m_count;
}
m_count -= numCallbacks;
}