Skip to content

Commit 6854909

Browse files
committed
Add support for resetting KeyedServices
These services meant to be initialized once in chrome. We may want to reinit them if the profile's storage path changes. Expose KeyedServiceFactory::Disassociate so we can shutdown services at runtime. Change-Id: I585540bb419609a6058f924dba0e7f6ac7e013a6 Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/605522 Reviewed-by: Szabolcs David <[email protected]>
1 parent 5ddfabc commit 6854909

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

chromium/components/keyed_service/core/keyed_service_factory.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,10 @@ int KeyedServiceFactory::GetServicesCount(void* context) {
155155
auto it = GetKeyedServicesCount().find(context);
156156
return it != GetKeyedServicesCount().end() ? it->second : 0;
157157
}
158+
159+
#if BUILDFLAG(IS_QTWEBENGINE)
160+
void KeyedServiceFactory::RemoveFromBrowserContext(void* context)
161+
{
162+
Disassociate(context);
163+
}
164+
#endif

chromium/components/keyed_service/core/keyed_service_factory.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ class KEYED_SERVICE_EXPORT KeyedServiceFactory
3333
// context.
3434
static int GetServicesCount(void* context);
3535

36+
#if BUILDFLAG(IS_QTWEBENGINE)
37+
void RemoveFromBrowserContext(void* context);
38+
#endif
39+
3640
protected:
3741
KeyedServiceFactory(const char* name, DependencyManager* manager, Type type);
3842
~KeyedServiceFactory() override;

0 commit comments

Comments
 (0)