summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/android
diff options
context:
space:
mode:
authorSelim Gurun <sgurun@google.com>2011-12-01 09:46:54 -0800
committerSelim Gurun <sgurun@google.com>2011-12-02 09:30:03 -0800
commit17393d82fd683230373d65641b1eea02af17c0e2 (patch)
treef7bef710af4a62ebeddbea6fd0a63a7a26ec24a6 /Source/WebKit/android
parent931e90d171935ef706b6906c5867a51fc491a83d (diff)
downloadexternal_webkit-17393d82fd683230373d65641b1eea02af17c0e2.zip
external_webkit-17393d82fd683230373d65641b1eea02af17c0e2.tar.gz
external_webkit-17393d82fd683230373d65641b1eea02af17c0e2.tar.bz2
Fix init and cleanup of WebCookieJar.
Fix potential race condition due to reordering of stores in init. Fix cleanup of leftover files. Both of these were introduced during fix for "Defer CookieManager initialization". https://android-git.corp.google.com/g/#/c/152972/3 BUG: 5253777 Change-Id: Ib90debe39f009d178b3183c79949fb0f4a18fdb3
Diffstat (limited to 'Source/WebKit/android')
-rw-r--r--Source/WebKit/android/WebCoreSupport/WebCookieJar.cpp8
-rw-r--r--Source/WebKit/android/WebCoreSupport/WebCookieJar.h2
2 files changed, 2 insertions, 8 deletions
diff --git a/Source/WebKit/android/WebCoreSupport/WebCookieJar.cpp b/Source/WebKit/android/WebCoreSupport/WebCookieJar.cpp
index b33cbc2..0af3cc2 100644
--- a/Source/WebKit/android/WebCoreSupport/WebCookieJar.cpp
+++ b/Source/WebKit/android/WebCoreSupport/WebCookieJar.cpp
@@ -123,6 +123,7 @@ void WebCookieJar::cleanup(bool isPrivateBrowsing)
MutexLocker lock(instanceMutex);
scoped_refptr<WebCookieJar>* instancePtr = instance(isPrivateBrowsing);
*instancePtr = 0;
+ removeFileOrDirectory(databaseDirectory(isPrivateBrowsing).c_str());
}
WebCookieJar::WebCookieJar(const std::string& databaseFilePath)
@@ -130,10 +131,6 @@ WebCookieJar::WebCookieJar(const std::string& databaseFilePath)
, m_databaseFilePath(databaseFilePath)
, m_allowCookies(true) {}
-WebCookieJar::~WebCookieJar() {
- removeFileOrDirectory(m_databaseFilePath.c_str());
-}
-
void WebCookieJar::initCookieStore() {
MutexLocker lock(m_cookieStoreInitializeMutex);
if (m_cookieStoreInitialized)
@@ -183,8 +180,7 @@ int WebCookieJar::CanSetCookie(const GURL&, const GURL&, const std::string&) con
net::CookieStore* WebCookieJar::cookieStore()
{
- if (!m_cookieStoreInitialized)
- initCookieStore();
+ initCookieStore();
return m_cookieStore.get();
}
diff --git a/Source/WebKit/android/WebCoreSupport/WebCookieJar.h b/Source/WebKit/android/WebCoreSupport/WebCookieJar.h
index 25d9e78..7ade9d0 100644
--- a/Source/WebKit/android/WebCoreSupport/WebCookieJar.h
+++ b/Source/WebKit/android/WebCoreSupport/WebCookieJar.h
@@ -66,9 +66,7 @@ public:
int getNumCookiesInDatabase();
private:
- friend class base::RefCountedThreadSafe<WebCookieJar>;
WebCookieJar(const std::string& databaseFilePath);
- ~WebCookieJar();
void initCookieStore();
private: