diff options
author | Leander Beernaert <leander.beernaert@qt.io> | 2019-05-24 15:10:03 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-06-03 11:30:05 +0200 |
commit | fec15bc826459c02459249e2f1d053db87a3670b (patch) | |
tree | d78f8570133a3ac63b46253d5d7e884ea004d03b | |
parent | 724612780323916b94d882591d2bc93c09975ffb (diff) | |
download | qtwebengine-chromium-fec15bc826459c02459249e2f1d053db87a3670b.tar.gz |
Enable the option to remove previous user PrefService
We need this change so we can replace the previous user PrefService
with a new one when changing the data path in QWebEngineProfile. If
we don't have this change, the code will assert.
This is required to properly fix QTBUG-75740.
Change-Id: I956f0b0549caf258cc49ac0818f6eca0ddcbafd7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r-- | chromium/components/user_prefs/user_prefs.cc | 9 | ||||
-rw-r--r-- | chromium/components/user_prefs/user_prefs.h | 4 |
2 files changed, 13 insertions, 0 deletions
diff --git a/chromium/components/user_prefs/user_prefs.cc b/chromium/components/user_prefs/user_prefs.cc index a752c8f8acc..dff5f2a258d 100644 --- a/chromium/components/user_prefs/user_prefs.cc +++ b/chromium/components/user_prefs/user_prefs.cc @@ -38,6 +38,15 @@ void UserPrefs::Set(base::SupportsUserData* context, PrefService* prefs) { context->SetUserData(UserDataKey(), base::WrapUnique(new UserPrefs(prefs))); } +// static +// TODO: Remove in Qt6 when contexts are only set once +void UserPrefs::Remove(base::SupportsUserData* context) { + DCHECK(context); + DCHECK(context->GetUserData(UserDataKey())); + context->RemoveUserData(UserDataKey()); +} + + UserPrefs::UserPrefs(PrefService* prefs) : prefs_(prefs) { } diff --git a/chromium/components/user_prefs/user_prefs.h b/chromium/components/user_prefs/user_prefs.h index 392e5dc7f23..3a86997cf23 100644 --- a/chromium/components/user_prefs/user_prefs.h +++ b/chromium/components/user_prefs/user_prefs.h @@ -29,6 +29,10 @@ class USER_PREFS_EXPORT UserPrefs : public base::SupportsUserData::Data { // only once per context. static void Set(base::SupportsUserData* context, PrefService* prefs); + // Remove existing |prefs| on a |context|. + // TODO: Remove in Qt6 when contexts are only set once + static void Remove(base::SupportsUserData* context); + private: explicit UserPrefs(PrefService* prefs); |