diff options
author | Steve Block <steveblock@google.com> | 2010-11-29 07:19:42 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-11-29 07:19:42 -0800 |
commit | 454adf027eb747dd9d6c6b041f1d2d68f228c44b (patch) | |
tree | 0df65d7a67702d4322a0d5472058ee04700f5723 /WebKit/android/WebCoreSupport/WebRequestContext.cpp | |
parent | 9092f30ce1d2ad138d0095acddc2f5f4b2a025f9 (diff) | |
parent | 8f71a88eb32d112e6277f0a0260df04e969d6f8a (diff) | |
download | external_webkit-454adf027eb747dd9d6c6b041f1d2d68f228c44b.zip external_webkit-454adf027eb747dd9d6c6b041f1d2d68f228c44b.tar.gz external_webkit-454adf027eb747dd9d6c6b041f1d2d68f228c44b.tar.bz2 |
Merge changes I006cddf2,Ib304a845,I4622749d
* changes:
Moves implementation of ResourceLoaderAndroid to ResourceLoaderAndroid.cpp
Add a static WebRequestContext::acceptLanguage() method
Make WebCookieJar::get() threadsafe
Diffstat (limited to 'WebKit/android/WebCoreSupport/WebRequestContext.cpp')
-rw-r--r-- | WebKit/android/WebCoreSupport/WebRequestContext.cpp | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/WebKit/android/WebCoreSupport/WebRequestContext.cpp b/WebKit/android/WebCoreSupport/WebRequestContext.cpp index 223cd8d..eed8863 100644 --- a/WebKit/android/WebCoreSupport/WebRequestContext.cpp +++ b/WebKit/android/WebCoreSupport/WebRequestContext.cpp @@ -38,10 +38,11 @@ namespace { // TODO: The userAgent should not be a static, as it can be set per WebView. // http://b/3113804 std::string userAgent(""); -std::string acceptLanguage(""); - Lock userAgentLock; -Lock acceptLanguageLock; + +std::string acceptLanguageStdString(""); +WTF::String acceptLanguageWtfString(""); +WTF::Mutex acceptLanguageMutex; } using namespace WTF; @@ -78,20 +79,23 @@ const std::string& WebRequestContext::GetUserAgent(const GURL& url) const return userAgent; } -void WebRequestContext::setAcceptLanguage(String string) +void WebRequestContext::setAcceptLanguage(const String& string) { - // The accept language is set on the WebCore thread and read on the network - // stack's IO thread. - AutoLock aLock(acceptLanguageLock); - acceptLanguage = string.utf8().data(); + MutexLocker lock(acceptLanguageMutex); + acceptLanguageStdString = string.utf8().data(); + acceptLanguageWtfString = string; } const std::string& WebRequestContext::GetAcceptLanguage() const { - // The accept language is set on the WebCore thread and read on the network - // stack's IO thread. - AutoLock aLock(acceptLanguageLock); - return acceptLanguage; + MutexLocker lock(acceptLanguageMutex); + return acceptLanguageStdString; +} + +const String& WebRequestContext::acceptLanguage() +{ + MutexLocker lock(acceptLanguageMutex); + return acceptLanguageWtfString; } WebRequestContext* WebRequestContext::getImpl(bool isPrivateBrowsing) @@ -111,10 +115,7 @@ WebRequestContext* WebRequestContext::getImpl(bool isPrivateBrowsing) WebRequestContext* WebRequestContext::getRegularContext() { - static WTF::Mutex regularContextMutex; static scoped_refptr<WebRequestContext> regularContext(0); - - MutexLocker lock(regularContextMutex); if (!regularContext) regularContext = getImpl(false); return regularContext; |