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[] = "|"; ...@@ -50,7 +50,7 @@ const char kAutocompleteTagDelimiter[] = "|";
return ret_val; \ return ret_val; \
} }
void* UserDataKey() { void* AutocompleteSyncBridgeUserDataKey() {
// Use the address of a static that COMDAT folding won't ever collide // Use the address of a static that COMDAT folding won't ever collide
// with something else. // with something else.
static int user_data_key = 0; static int user_data_key = 0;
...@@ -283,7 +283,7 @@ void AutocompleteSyncBridge::CreateForWebDataServiceAndBackend( ...@@ -283,7 +283,7 @@ void AutocompleteSyncBridge::CreateForWebDataServiceAndBackend(
AutofillWebDataService* web_data_service, AutofillWebDataService* web_data_service,
AutofillWebDataBackend* web_data_backend) { AutofillWebDataBackend* web_data_backend) {
web_data_service->GetDBUserData()->SetUserData( web_data_service->GetDBUserData()->SetUserData(
UserDataKey(), AutocompleteSyncBridgeUserDataKey(),
std::make_unique<AutocompleteSyncBridge>( std::make_unique<AutocompleteSyncBridge>(
web_data_backend, web_data_backend,
std::make_unique<ClientTagBasedModelTypeProcessor>( std::make_unique<ClientTagBasedModelTypeProcessor>(
...@@ -294,7 +294,8 @@ void AutocompleteSyncBridge::CreateForWebDataServiceAndBackend( ...@@ -294,7 +294,8 @@ void AutocompleteSyncBridge::CreateForWebDataServiceAndBackend(
ModelTypeSyncBridge* AutocompleteSyncBridge::FromWebDataService( ModelTypeSyncBridge* AutocompleteSyncBridge::FromWebDataService(
AutofillWebDataService* web_data_service) { AutofillWebDataService* web_data_service) {
return static_cast<AutocompleteSyncBridge*>( return static_cast<AutocompleteSyncBridge*>(
web_data_service->GetDBUserData()->GetUserData(UserDataKey())); web_data_service->GetDBUserData()->GetUserData(
AutocompleteSyncBridgeUserDataKey()));
} }
AutocompleteSyncBridge::AutocompleteSyncBridge( AutocompleteSyncBridge::AutocompleteSyncBridge(
......
...@@ -42,7 +42,7 @@ std::string LimitData(const std::string& data) { ...@@ -42,7 +42,7 @@ std::string LimitData(const std::string& data) {
return sanitized_value; return sanitized_value;
} }
void* UserDataKey() { void* AutofillProfileSyncableServiceUserDataKey() {
// Use the address of a static that COMDAT folding won't ever fold // Use the address of a static that COMDAT folding won't ever fold
// with something else. // with something else.
static int user_data_key = 0; static int user_data_key = 0;
...@@ -74,8 +74,9 @@ void AutofillProfileSyncableService::CreateForWebDataServiceAndBackend( ...@@ -74,8 +74,9 @@ void AutofillProfileSyncableService::CreateForWebDataServiceAndBackend(
AutofillWebDataBackend* webdata_backend, AutofillWebDataBackend* webdata_backend,
const std::string& app_locale) { const std::string& app_locale) {
web_data_service->GetDBUserData()->SetUserData( web_data_service->GetDBUserData()->SetUserData(
UserDataKey(), base::WrapUnique(new AutofillProfileSyncableService( AutofillProfileSyncableServiceUserDataKey(),
webdata_backend, app_locale))); base::WrapUnique(
new AutofillProfileSyncableService(webdata_backend, app_locale)));
} }
// static // static
...@@ -83,7 +84,8 @@ AutofillProfileSyncableService* ...@@ -83,7 +84,8 @@ AutofillProfileSyncableService*
AutofillProfileSyncableService::FromWebDataService( AutofillProfileSyncableService::FromWebDataService(
AutofillWebDataService* web_data_service) { AutofillWebDataService* web_data_service) {
return static_cast<AutofillProfileSyncableService*>( return static_cast<AutofillProfileSyncableService*>(
web_data_service->GetDBUserData()->GetUserData(UserDataKey())); web_data_service->GetDBUserData()->GetUserData(
AutofillProfileSyncableServiceUserDataKey()));
} }
AutofillProfileSyncableService::AutofillProfileSyncableService() AutofillProfileSyncableService::AutofillProfileSyncableService()
......
...@@ -33,7 +33,7 @@ namespace autofill { ...@@ -33,7 +33,7 @@ namespace autofill {
namespace { namespace {
void* UserDataKey() { void* AutofillWalletMetadataSyncableServiceUserDataKey() {
// Use the address of a static so that COMDAT folding won't ever fold // Use the address of a static so that COMDAT folding won't ever fold
// with something else. // with something else.
static int user_data_key = 0; static int user_data_key = 0;
...@@ -496,8 +496,9 @@ void AutofillWalletMetadataSyncableService::CreateForWebDataServiceAndBackend( ...@@ -496,8 +496,9 @@ void AutofillWalletMetadataSyncableService::CreateForWebDataServiceAndBackend(
AutofillWebDataBackend* web_data_backend, AutofillWebDataBackend* web_data_backend,
const std::string& app_locale) { const std::string& app_locale) {
web_data_service->GetDBUserData()->SetUserData( web_data_service->GetDBUserData()->SetUserData(
UserDataKey(), base::WrapUnique(new AutofillWalletMetadataSyncableService( AutofillWalletMetadataSyncableServiceUserDataKey(),
web_data_backend, app_locale))); base::WrapUnique(new AutofillWalletMetadataSyncableService(
web_data_backend, app_locale)));
} }
// static // static
...@@ -505,7 +506,8 @@ AutofillWalletMetadataSyncableService* ...@@ -505,7 +506,8 @@ AutofillWalletMetadataSyncableService*
AutofillWalletMetadataSyncableService::FromWebDataService( AutofillWalletMetadataSyncableService::FromWebDataService(
AutofillWebDataService* web_data_service) { AutofillWebDataService* web_data_service) {
return static_cast<AutofillWalletMetadataSyncableService*>( return static_cast<AutofillWalletMetadataSyncableService*>(
web_data_service->GetDBUserData()->GetUserData(UserDataKey())); web_data_service->GetDBUserData()->GetUserData(
AutofillWalletMetadataSyncableServiceUserDataKey()));
} }
AutofillWalletMetadataSyncableService::AutofillWalletMetadataSyncableService( AutofillWalletMetadataSyncableService::AutofillWalletMetadataSyncableService(
......
...@@ -26,7 +26,7 @@ namespace autofill { ...@@ -26,7 +26,7 @@ namespace autofill {
namespace { namespace {
void* UserDataKey() { void* AutofillWalletSyncableServiceUserDataKey() {
// Use the address of a static so that COMDAT folding won't ever fold // Use the address of a static so that COMDAT folding won't ever fold
// with something else. // with something else.
static int user_data_key = 0; static int user_data_key = 0;
...@@ -242,8 +242,9 @@ void AutofillWalletSyncableService::CreateForWebDataServiceAndBackend( ...@@ -242,8 +242,9 @@ void AutofillWalletSyncableService::CreateForWebDataServiceAndBackend(
AutofillWebDataBackend* webdata_backend, AutofillWebDataBackend* webdata_backend,
const std::string& app_locale) { const std::string& app_locale) {
web_data_service->GetDBUserData()->SetUserData( web_data_service->GetDBUserData()->SetUserData(
UserDataKey(), base::WrapUnique(new AutofillWalletSyncableService( AutofillWalletSyncableServiceUserDataKey(),
webdata_backend, app_locale))); base::WrapUnique(
new AutofillWalletSyncableService(webdata_backend, app_locale)));
} }
// static // static
...@@ -251,7 +252,8 @@ AutofillWalletSyncableService* ...@@ -251,7 +252,8 @@ AutofillWalletSyncableService*
AutofillWalletSyncableService::FromWebDataService( AutofillWalletSyncableService::FromWebDataService(
AutofillWebDataService* web_data_service) { AutofillWebDataService* web_data_service) {
return static_cast<AutofillWalletSyncableService*>( return static_cast<AutofillWalletSyncableService*>(
web_data_service->GetDBUserData()->GetUserData(UserDataKey())); web_data_service->GetDBUserData()->GetUserData(
AutofillWalletSyncableServiceUserDataKey()));
} }
void AutofillWalletSyncableService::InjectStartSyncFlare( 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