[reland] variations: converts the variations target to a component
This differs from the original patch in that
variations_crash_keys_unittest.cc is only built in non-component
builds. This is because the test uses crash_reporter::GetCrashKeyValue()
which returns the keys of the calling component. In the case of a
component build, that is now the unit-test instead of tge variations
component. This results in the test failing. This is explicitly called
out here:
https://chromium.googlesource.com/chromium/src/+/refs/heads/main/components/crash/core/common/crash_key.h#290
As there are builders that build non-component builds, there is still
coverage on the CQ and main waterfall.
You can diff between patchset 1 and 2 to see the change since first
landing.
The variations target is currently a static_library. This means
any executable/shared-library target that depends upon it ends up
copying the symbols, and we end up with multiple instances of
singletons. This is painful as I'm trying to ensure a single
instance of VariationsIdsProvider is created, but because there
are multiple that is difficult.
By converting the target to a component the duplication doesn't
happen and a single instance is created.
BUG=1148350
TEST=covered by tests
Change-Id: I9d46517b5f0d75e51a2f53dfc5c8e9882ca26af8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2930537
Reviewed-by: Alexei Svitkine <[email protected]>
Reviewed-by: Reilly Grant <[email protected]>
Commit-Queue: Scott Violet <[email protected]>
Cr-Commit-Position: refs/heads/master@{#888209}
diff --git a/components/variations/variations_seed_store.h b/components/variations/variations_seed_store.h
index 8f905e1..62b55da06 100644
--- a/components/variations/variations_seed_store.h
+++ b/components/variations/variations_seed_store.h
@@ -10,6 +10,7 @@
#include "base/callback.h"
#include "base/compiler_specific.h"
+#include "base/component_export.h"
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/time/time.h"
@@ -27,7 +28,7 @@
// VariationsSeedStore is a helper class for reading and writing the variations
// seed from Local State.
-class VariationsSeedStore {
+class COMPONENT_EXPORT(VARIATIONS) VariationsSeedStore {
public:
// Standard constructor. Enables signature verification.
explicit VariationsSeedStore(PrefService* local_state);