[leveldb_proto] Change factory to be a SimpleKeyedServiceFactory.
Up until now, the leveldb_proto component had two factories for its
KeyedService, one based on BrowserContext, and one based on BrowserState
(for iOS). This CL changes the BrowserContext based one to be based
on the SimpleKeyedServiceFactory instead, to make it possible to use
the database in reduced mode.
The new API uses std::unique_ptr<...> instead of raw pointers and
WrapUnique which the iOS code already did, so now we use that
everywhere. In addition, the constructor is made public so it can
easily be used with std::make_unique instead of base::WrapUnique.
As part of this, its dependencies needed to be updated to retrieve
the SimpleFactoryKey from the profile, and also pass in the PrefService,
since that's how the API currently works (and there are upcoming plans
to use the PrefService from leveldb_proto).
Lastly, this CL fixes a memory leak in the ProtoDatabaseImpl
unit tests, and removes unnecessary leveldb_proto namespace usage.
Bug: 943354
Change-Id: I4dd5826ff917ad151a966c57dd7ea00d61b6261d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1529913
Reviewed-by: ssid <[email protected]>
Reviewed-by: Sylvain Defresne <[email protected]>
Reviewed-by: Xi Han <[email protected]>
Commit-Queue: Tommy Nyquist <[email protected]>
Cr-Commit-Position: refs/heads/master@{#643182}
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index 4aef7c16..a8cc06d 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -1884,6 +1884,7 @@
"//components/language/content/browser",
"//components/language/core/browser",
"//components/language/core/common",
+ "//components/leveldb_proto",
"//components/leveldb_proto/content:factory",
"//components/live_tab_count_metrics",
"//components/metrics:call_stack_profile_collector",