This PR replaces the use of `BuildServiceInstanceFor` across brave, as
it has been deprecated, in favour of
`BuildServiceInstanceForBrowserContext`, which return a `unique_ptr`
rather than a naked pointer allocation.
Chromium change:
https://chromium.googlesource.com/chromium/src/+/6121e052e0373a9a0cc84a718ef73e68e3b8a628
commit 6121e052e0373a9a0cc84a718ef73e68e3b8a628
Author: Tom Sepez <tsepez@chromium.org>
Date: Wed Dec 14 21:38:26 2022 +0000
Rework BrowserContextKeyedServiceFactory::BuildServiceInstanceFor().
Avoid releasing an unique_ptr<> only to re-insert the raw value back
into a different one. Instead, maintain ownership at all times.
This is done by overriding the form of BuildServiceInstanceFor() as declared by KeyedServiceFactory, rather than the form of declared by BrowserContextKeyedServiceFactory.
Demonstrate one usage in page_colors_factor.cc as an example, before
taking on the hundreds that remain.
Bug: 1396138
Use `constexpr` strings
This PR changes moves away from uses of `const char` with two
approaches. For `.cc` files, these types are turned into constexpr ones,
which gives the compiler more leeway for optimisations.
For the constants on header files, we are converting these instances to
`inline constexpr`, in order to also reduce string duplication across
the binary.
This change was generated with a tool.