diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2019-03-01 12:42:01 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-03-23 00:24:58 +0000 |
commit | cedb457045c9972ba6da9c101c2ad65006b4db93 (patch) | |
tree | 4877744e17cc9b41163a82f487c76a1eb52929a7 /src/core/profile_io_data_qt.cpp | |
parent | ce6a1a74d16deecf0c150aa1f5bae2cc6a95e7b1 (diff) |
Fix disabling http cache after 73-based
BrowserDataRemoverImpl::Remove() indirectly calls
TransportSecurityState::DeleteAllDynamicDataSince() which notifies by
a callback about the finished deletion since:
https://chromium-review.googlesource.com/c/chromium/src/+/1335939
During the deletion the ProfileIODataQt::requestStorageGeneration()
should not be called because it deletes net::TransporSecurityPersister
which background_runner is where the finished deletion callback is
scheduled.
Change-Id: I4782d701f706ed7c8e104a78ba84a27183166fa4
Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
Diffstat (limited to 'src/core/profile_io_data_qt.cpp')
-rw-r--r-- | src/core/profile_io_data_qt.cpp | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/src/core/profile_io_data_qt.cpp b/src/core/profile_io_data_qt.cpp index 467223164..5d317b7f0 100644 --- a/src/core/profile_io_data_qt.cpp +++ b/src/core/profile_io_data_qt.cpp @@ -172,6 +172,7 @@ ProfileIODataQt::ProfileIODataQt(ProfileQt *profile) m_clientCertificateStoreData(new ClientCertificateStoreData), #endif m_mutex(QMutex::Recursive), + m_removerObserver(this), m_weakPtrFactory(this) { if (content::BrowserThread::IsThreadInitialized(content::BrowserThread::UI)) @@ -670,7 +671,8 @@ void ProfileIODataQt::updateStorageSettings() file::ForgetServiceInstanceGroupUserDirAssociation(groupId); file::AssociateServiceInstanceGroupWithUserDir(groupId, toFilePath(m_profileAdapter->dataPath())); } - requestStorageGeneration(); + if (!m_pendingStorageRequestGeneration) + requestStorageGeneration(); } void ProfileIODataQt::updateCookieStore() @@ -680,7 +682,8 @@ void ProfileIODataQt::updateCookieStore() m_persistentCookiesPolicy = m_profileAdapter->persistentCookiesPolicy(); m_cookiesPath = m_profileAdapter->cookiesPath(); m_channelIdPath = m_profileAdapter->channelIdPath(); - requestStorageGeneration(); + if (!m_pendingStorageRequestGeneration) + requestStorageGeneration(); } void ProfileIODataQt::updateUserAgent() @@ -689,7 +692,8 @@ void ProfileIODataQt::updateUserAgent() QMutexLocker lock(&m_mutex); m_httpAcceptLanguage = m_profileAdapter->httpAcceptLanguage(); m_httpUserAgent = m_profileAdapter->httpUserAgent(); - requestStorageGeneration(); + if (!m_pendingStorageRequestGeneration) + requestStorageGeneration(); } void ProfileIODataQt::updateHttpCache() @@ -701,14 +705,19 @@ void ProfileIODataQt::updateHttpCache() m_httpCacheMaxSize = m_profileAdapter->httpCacheMaxSize(); if (m_httpCacheType == ProfileAdapter::NoCache) { + m_pendingStorageRequestGeneration = true; content::BrowsingDataRemover *remover = content::BrowserContext::GetBrowsingDataRemover(m_profileAdapter->profile()); - remover->Remove(base::Time(), base::Time::Max(), + remover->AddObserver(&m_removerObserver); + remover->RemoveAndReply(base::Time(), base::Time::Max(), content::BrowsingDataRemover::DATA_TYPE_CACHE, content::BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB | - content::BrowsingDataRemover::ORIGIN_TYPE_PROTECTED_WEB); + content::BrowsingDataRemover::ORIGIN_TYPE_PROTECTED_WEB, + &m_removerObserver); + return; } - requestStorageGeneration(); + if (!m_pendingStorageRequestGeneration) + requestStorageGeneration(); } void ProfileIODataQt::updateJobFactory() @@ -800,4 +809,24 @@ ProfileIODataQt *ProfileIODataQt::FromResourceContext(content::ResourceContext * return static_cast<ResourceContextQt *>(resource_context)->m_io_data; } +void ProfileIODataQt::removeBrowsingDataRemoverObserver() +{ + content::BrowsingDataRemover *remover = + content::BrowserContext::GetBrowsingDataRemover(m_profileAdapter->profile()); + remover->RemoveObserver(&m_removerObserver); +} + +BrowsingDataRemoverObserverQt::BrowsingDataRemoverObserverQt(ProfileIODataQt *profileIOData) + : m_profileIOData(profileIOData) +{ +} + +void BrowsingDataRemoverObserverQt::OnBrowsingDataRemoverDone() +{ + Q_ASSERT(m_profileIOData->m_pendingStorageRequestGeneration); + m_profileIOData->requestStorageGeneration(); + m_profileIOData->removeBrowsingDataRemoverObserver(); + m_profileIOData->m_pendingStorageRequestGeneration = false; +} + } // namespace QtWebEngineCore |