Commit 82bdeffe authored by Oscar Johansson's avatar Oscar Johansson Committed by Commit Bot

Rename UserDataKey to be unique (components/autofill)

When building using jumbo, files gets merged and
functions with the same name may end up in the same
namespace/scope and conflict. This happens for
the function UserDataKey. Since the function relies
on that the static int is unique this function could
not be moved to a shared util file. Instead, the issue
was solved by renaming the function.

Bug: 869381
Change-Id: Ifd67ac865e9d0bad272cc51ef1af8c3a5b382893
Reviewed-on: https://chromium-review.googlesource.com/1160487Reviewed-by: default avatarVadym Doroshenko <dvadym@chromium.org>
Commit-Queue: Oscar Johansson <oscarj@opera.com>
Cr-Commit-Position: refs/heads/master@{#580483}
parent 561f2872
......@@ -50,7 +50,7 @@ const char kAutocompleteTagDelimiter[] = "|";
return ret_val; \
}
void* UserDataKey() {
void* AutocompleteSyncBridgeUserDataKey() {
// Use the address of a static that COMDAT folding won't ever collide
// with something else.
static int user_data_key = 0;
......@@ -283,7 +283,7 @@ void AutocompleteSyncBridge::CreateForWebDataServiceAndBackend(
AutofillWebDataService* web_data_service,
AutofillWebDataBackend* web_data_backend) {
web_data_service->GetDBUserData()->SetUserData(
UserDataKey(),
AutocompleteSyncBridgeUserDataKey(),
std::make_unique<AutocompleteSyncBridge>(
web_data_backend,
std::make_unique<ClientTagBasedModelTypeProcessor>(
......@@ -294,7 +294,8 @@ void AutocompleteSyncBridge::CreateForWebDataServiceAndBackend(
ModelTypeSyncBridge* AutocompleteSyncBridge::FromWebDataService(
AutofillWebDataService* web_data_service) {
return static_cast<AutocompleteSyncBridge*>(
web_data_service->GetDBUserData()->GetUserData(UserDataKey()));
web_data_service->GetDBUserData()->GetUserData(
AutocompleteSyncBridgeUserDataKey()));
}
AutocompleteSyncBridge::AutocompleteSyncBridge(
......
......@@ -42,7 +42,7 @@ std::string LimitData(const std::string& data) {
return sanitized_value;
}
void* UserDataKey() {
void* AutofillProfileSyncableServiceUserDataKey() {
// Use the address of a static that COMDAT folding won't ever fold
// with something else.
static int user_data_key = 0;
......@@ -74,8 +74,9 @@ void AutofillProfileSyncableService::CreateForWebDataServiceAndBackend(
AutofillWebDataBackend* webdata_backend,
const std::string& app_locale) {
web_data_service->GetDBUserData()->SetUserData(
UserDataKey(), base::WrapUnique(new AutofillProfileSyncableService(
webdata_backend, app_locale)));
AutofillProfileSyncableServiceUserDataKey(),
base::WrapUnique(
new AutofillProfileSyncableService(webdata_backend, app_locale)));
}
// static
......@@ -83,7 +84,8 @@ AutofillProfileSyncableService*
AutofillProfileSyncableService::FromWebDataService(
AutofillWebDataService* web_data_service) {
return static_cast<AutofillProfileSyncableService*>(
web_data_service->GetDBUserData()->GetUserData(UserDataKey()));
web_data_service->GetDBUserData()->GetUserData(
AutofillProfileSyncableServiceUserDataKey()));
}
AutofillProfileSyncableService::AutofillProfileSyncableService()
......
......@@ -33,7 +33,7 @@ namespace autofill {
namespace {
void* UserDataKey() {
void* AutofillWalletMetadataSyncableServiceUserDataKey() {
// Use the address of a static so that COMDAT folding won't ever fold
// with something else.
static int user_data_key = 0;
......@@ -496,7 +496,8 @@ void AutofillWalletMetadataSyncableService::CreateForWebDataServiceAndBackend(
AutofillWebDataBackend* web_data_backend,
const std::string& app_locale) {
web_data_service->GetDBUserData()->SetUserData(
UserDataKey(), base::WrapUnique(new AutofillWalletMetadataSyncableService(
AutofillWalletMetadataSyncableServiceUserDataKey(),
base::WrapUnique(new AutofillWalletMetadataSyncableService(
web_data_backend, app_locale)));
}
......@@ -505,7 +506,8 @@ AutofillWalletMetadataSyncableService*
AutofillWalletMetadataSyncableService::FromWebDataService(
AutofillWebDataService* web_data_service) {
return static_cast<AutofillWalletMetadataSyncableService*>(
web_data_service->GetDBUserData()->GetUserData(UserDataKey()));
web_data_service->GetDBUserData()->GetUserData(
AutofillWalletMetadataSyncableServiceUserDataKey()));
}
AutofillWalletMetadataSyncableService::AutofillWalletMetadataSyncableService(
......
......@@ -26,7 +26,7 @@ namespace autofill {
namespace {
void* UserDataKey() {
void* AutofillWalletSyncableServiceUserDataKey() {
// Use the address of a static so that COMDAT folding won't ever fold
// with something else.
static int user_data_key = 0;
......@@ -242,8 +242,9 @@ void AutofillWalletSyncableService::CreateForWebDataServiceAndBackend(
AutofillWebDataBackend* webdata_backend,
const std::string& app_locale) {
web_data_service->GetDBUserData()->SetUserData(
UserDataKey(), base::WrapUnique(new AutofillWalletSyncableService(
webdata_backend, app_locale)));
AutofillWalletSyncableServiceUserDataKey(),
base::WrapUnique(
new AutofillWalletSyncableService(webdata_backend, app_locale)));
}
// static
......@@ -251,7 +252,8 @@ AutofillWalletSyncableService*
AutofillWalletSyncableService::FromWebDataService(
AutofillWebDataService* web_data_service) {
return static_cast<AutofillWalletSyncableService*>(
web_data_service->GetDBUserData()->GetUserData(UserDataKey()));
web_data_service->GetDBUserData()->GetUserData(
AutofillWalletSyncableServiceUserDataKey()));
}
void AutofillWalletSyncableService::InjectStartSyncFlare(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment