diff options
author | Tamas Zakor <ztamas@inf.u-szeged.hu> | 2020-04-20 11:41:29 +0200 |
---|---|---|
committer | Tamas Zakor <ztamas@inf.u-szeged.hu> | 2020-04-23 13:55:26 +0200 |
commit | 75412200db05ddc5ee2b9aea367b580d8b0c438e (patch) | |
tree | 8177900a8af22aab7321bf6b12474876e175ae43 /src/core/profile_io_data_qt.h | |
parent | ab179f60844f5b0cd6ef863b753566a3588e9d5d (diff) |
Avoid the network context reset during http cache clear
Reinstate BrowsingDataRemoverObserverQt() to check if http cache
clearing is in-progress or done. ProfileIODataQt::resetNetworkContext()
should not be called during http cache clearing because it causes an
assert. Call it after the clearing is done.
Change-Id: I6750341ff23f704ba547c913f40b0cec92b1cc43
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/profile_io_data_qt.h')
-rw-r--r-- | src/core/profile_io_data_qt.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/core/profile_io_data_qt.h b/src/core/profile_io_data_qt.h index 26ae1bcb2..b0567dead 100644 --- a/src/core/profile_io_data_qt.h +++ b/src/core/profile_io_data_qt.h @@ -40,6 +40,7 @@ #ifndef PROFILE_IO_DATA_QT_H #define PROFILE_IO_DATA_QT_H +#include "content/public/browser/browsing_data_remover.h" #include "chrome/browser/profiles/profile.h" #include "extensions/buildflags/buildflags.h" @@ -65,6 +66,16 @@ struct ClientCertificateStoreData; class ProfileIODataQt; class ProfileQt; +class BrowsingDataRemoverObserverQt : public content::BrowsingDataRemover::Observer { +public: + BrowsingDataRemoverObserverQt(ProfileIODataQt *profileIOData); + + void OnBrowsingDataRemoverDone() override; + +private: + ProfileIODataQt *m_profileIOData; +}; + // ProfileIOData contains data that lives on the IOthread // we still use shared memebers and use mutex which breaks // idea for this object, but this is wip. @@ -89,6 +100,8 @@ public: // Used in NetworkDelegateQt::OnBeforeURLRequest. void setFullConfiguration(); // runs on ui thread void resetNetworkContext(); // runs on ui thread + void clearHttpCache(); // runs on ui thread + bool isClearHttpCacheInProgress() { return m_clearHttpCacheInProgress; } network::mojom::NetworkContextParamsPtr CreateNetworkContextParams(); @@ -104,6 +117,8 @@ public: CookieMonsterDelegateQt *cookieDelegate() const { return m_cookieDelegate.get(); } private: + void removeBrowsingDataRemoverObserver(); + ProfileQt *m_profile; std::unique_ptr<content::ResourceContext> m_resourceContext; scoped_refptr<CookieMonsterDelegateQt> m_cookieDelegate; @@ -126,9 +141,13 @@ private: #endif int m_httpCacheMaxSize = 0; bool m_useForGlobalCertificateVerification = false; - base::WeakPtrFactory<ProfileIODataQt> m_weakPtrFactory; // this should be always the last member + BrowsingDataRemoverObserverQt m_removerObserver; QString m_dataPath; + bool m_clearHttpCacheInProgress = false; + base::WeakPtrFactory<ProfileIODataQt> m_weakPtrFactory; // this should be always the last member DISALLOW_COPY_AND_ASSIGN(ProfileIODataQt); + + friend class BrowsingDataRemoverObserverQt; }; } // namespace QtWebEngineCore |