Commit ce9d1920 authored by Mikel Astiz's avatar Mikel Astiz Committed by Commit Bot

Plumb crashpad dumper for pseudo-USS types

If a model (or SyncableService) reports an error, let's plumb it through
to base::debug::DumpWithoutCrashing() via ReportUnrecoverableError(),
which does it only for canary&dev channels, with random sampling. This
achieves feature parity with the directory-based setup and may allow
future investigations if we see datatypes with high error rates.

Bug: 870624
Change-Id: Idb3d00b178167a8b7b9eabb560858197e03aecb2
Reviewed-on: https://chromium-review.googlesource.com/c/1264198Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Commit-Queue: Mikel Astiz <mastiz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#597035}
parent a3925d24
...@@ -12,13 +12,15 @@ ...@@ -12,13 +12,15 @@
SupervisedUserSyncModelTypeController::SupervisedUserSyncModelTypeController( SupervisedUserSyncModelTypeController::SupervisedUserSyncModelTypeController(
syncer::ModelType type, syncer::ModelType type,
const Profile* profile, const Profile* profile,
const base::RepeatingClosure& dump_stack,
syncer::SyncClient* sync_client) syncer::SyncClient* sync_client)
: SyncableServiceBasedModelTypeController( : SyncableServiceBasedModelTypeController(
type, type,
sync_client->GetModelTypeStoreService()->GetStoreFactory(), sync_client->GetModelTypeStoreService()->GetStoreFactory(),
base::BindOnce(&syncer::SyncClient::GetSyncableServiceForType, base::BindOnce(&syncer::SyncClient::GetSyncableServiceForType,
base::Unretained(sync_client), base::Unretained(sync_client),
type)), type),
dump_stack),
profile_(profile) { profile_(profile) {
DCHECK(type == syncer::SUPERVISED_USER_SETTINGS || DCHECK(type == syncer::SUPERVISED_USER_SETTINGS ||
type == syncer::SUPERVISED_USER_WHITELISTS); type == syncer::SUPERVISED_USER_WHITELISTS);
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SYNC_MODEL_TYPE_CONTROLLER_H_ #ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SYNC_MODEL_TYPE_CONTROLLER_H_
#define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SYNC_MODEL_TYPE_CONTROLLER_H_ #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SYNC_MODEL_TYPE_CONTROLLER_H_
#include "base/callback_forward.h"
#include "base/macros.h" #include "base/macros.h"
#include "components/sync/driver/syncable_service_based_model_type_controller.h" #include "components/sync/driver/syncable_service_based_model_type_controller.h"
...@@ -20,9 +21,11 @@ class SupervisedUserSyncModelTypeController ...@@ -20,9 +21,11 @@ class SupervisedUserSyncModelTypeController
: public syncer::SyncableServiceBasedModelTypeController { : public syncer::SyncableServiceBasedModelTypeController {
public: public:
// |sync_client| and |profile| must not be null and must outlive this object. // |sync_client| and |profile| must not be null and must outlive this object.
SupervisedUserSyncModelTypeController(syncer::ModelType type, SupervisedUserSyncModelTypeController(
const Profile* profile, syncer::ModelType type,
syncer::SyncClient* sync_client); const Profile* profile,
const base::RepeatingClosure& dump_stack,
syncer::SyncClient* sync_client);
~SupervisedUserSyncModelTypeController() override; ~SupervisedUserSyncModelTypeController() override;
// DataTypeController override. // DataTypeController override.
......
...@@ -288,25 +288,24 @@ ChromeSyncClient::CreateDataTypeControllers( ...@@ -288,25 +288,24 @@ ChromeSyncClient::CreateDataTypeControllers(
component_factory_->CreateCommonDataTypeControllers( component_factory_->CreateCommonDataTypeControllers(
disabled_types, local_device_info_provider); disabled_types, local_device_info_provider);
base::RepeatingClosure error_callback = base::BindRepeating( const base::RepeatingClosure dump_stack = base::BindRepeating(
&syncer::ReportUnrecoverableError, chrome::GetChannel()); &syncer::ReportUnrecoverableError, chrome::GetChannel());
#if BUILDFLAG(ENABLE_SUPERVISED_USERS) #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
if (base::FeatureList::IsEnabled(switches::kSyncPseudoUSSSupervisedUsers)) { if (base::FeatureList::IsEnabled(switches::kSyncPseudoUSSSupervisedUsers)) {
controllers.push_back( controllers.push_back(
std::make_unique<SupervisedUserSyncModelTypeController>( std::make_unique<SupervisedUserSyncModelTypeController>(
syncer::SUPERVISED_USER_SETTINGS, profile_, this)); syncer::SUPERVISED_USER_SETTINGS, profile_, dump_stack, this));
controllers.push_back( controllers.push_back(
std::make_unique<SupervisedUserSyncModelTypeController>( std::make_unique<SupervisedUserSyncModelTypeController>(
syncer::SUPERVISED_USER_WHITELISTS, profile_, this)); syncer::SUPERVISED_USER_WHITELISTS, profile_, dump_stack, this));
} else { } else {
controllers.push_back( controllers.push_back(
std::make_unique<SupervisedUserSyncDataTypeController>( std::make_unique<SupervisedUserSyncDataTypeController>(
syncer::SUPERVISED_USER_SETTINGS, error_callback, this, profile_)); syncer::SUPERVISED_USER_SETTINGS, dump_stack, this, profile_));
controllers.push_back( controllers.push_back(
std::make_unique<SupervisedUserSyncDataTypeController>( std::make_unique<SupervisedUserSyncDataTypeController>(
syncer::SUPERVISED_USER_WHITELISTS, error_callback, this, syncer::SUPERVISED_USER_WHITELISTS, dump_stack, this, profile_));
profile_));
} }
#endif // BUILDFLAG(ENABLE_SUPERVISED_USERS) #endif // BUILDFLAG(ENABLE_SUPERVISED_USERS)
...@@ -319,10 +318,10 @@ ChromeSyncClient::CreateDataTypeControllers( ...@@ -319,10 +318,10 @@ ChromeSyncClient::CreateDataTypeControllers(
syncer::APPS, GetModelTypeStoreService()->GetStoreFactory(), syncer::APPS, GetModelTypeStoreService()->GetStoreFactory(),
base::BindOnce(&ChromeSyncClient::GetSyncableServiceForType, base::BindOnce(&ChromeSyncClient::GetSyncableServiceForType,
base::Unretained(this), syncer::APPS), base::Unretained(this), syncer::APPS),
profile_)); dump_stack, profile_));
} else { } else {
controllers.push_back(std::make_unique<ExtensionDataTypeController>( controllers.push_back(std::make_unique<ExtensionDataTypeController>(
syncer::APPS, error_callback, this, profile_)); syncer::APPS, dump_stack, this, profile_));
} }
} }
...@@ -334,10 +333,10 @@ ChromeSyncClient::CreateDataTypeControllers( ...@@ -334,10 +333,10 @@ ChromeSyncClient::CreateDataTypeControllers(
syncer::EXTENSIONS, GetModelTypeStoreService()->GetStoreFactory(), syncer::EXTENSIONS, GetModelTypeStoreService()->GetStoreFactory(),
base::BindOnce(&ChromeSyncClient::GetSyncableServiceForType, base::BindOnce(&ChromeSyncClient::GetSyncableServiceForType,
base::Unretained(this), syncer::EXTENSIONS), base::Unretained(this), syncer::EXTENSIONS),
profile_)); dump_stack, profile_));
} else { } else {
controllers.push_back(std::make_unique<ExtensionDataTypeController>( controllers.push_back(std::make_unique<ExtensionDataTypeController>(
syncer::EXTENSIONS, error_callback, this, profile_)); syncer::EXTENSIONS, dump_stack, this, profile_));
} }
} }
...@@ -345,14 +344,14 @@ ChromeSyncClient::CreateDataTypeControllers( ...@@ -345,14 +344,14 @@ ChromeSyncClient::CreateDataTypeControllers(
// disabled. // disabled.
if (!disabled_types.Has(syncer::EXTENSION_SETTINGS)) { if (!disabled_types.Has(syncer::EXTENSION_SETTINGS)) {
controllers.push_back(std::make_unique<ExtensionSettingDataTypeController>( controllers.push_back(std::make_unique<ExtensionSettingDataTypeController>(
syncer::EXTENSION_SETTINGS, error_callback, this, profile_)); syncer::EXTENSION_SETTINGS, dump_stack, this, profile_));
} }
// App setting sync is enabled by default. Register unless explicitly // App setting sync is enabled by default. Register unless explicitly
// disabled. // disabled.
if (!disabled_types.Has(syncer::APP_SETTINGS)) { if (!disabled_types.Has(syncer::APP_SETTINGS)) {
controllers.push_back(std::make_unique<ExtensionSettingDataTypeController>( controllers.push_back(std::make_unique<ExtensionSettingDataTypeController>(
syncer::APP_SETTINGS, error_callback, this, profile_)); syncer::APP_SETTINGS, dump_stack, this, profile_));
} }
#endif // BUILDFLAG(ENABLE_EXTENSIONS) #endif // BUILDFLAG(ENABLE_EXTENSIONS)
...@@ -364,10 +363,10 @@ ChromeSyncClient::CreateDataTypeControllers( ...@@ -364,10 +363,10 @@ ChromeSyncClient::CreateDataTypeControllers(
syncer::THEMES, GetModelTypeStoreService()->GetStoreFactory(), syncer::THEMES, GetModelTypeStoreService()->GetStoreFactory(),
base::BindOnce(&ChromeSyncClient::GetSyncableServiceForType, base::BindOnce(&ChromeSyncClient::GetSyncableServiceForType,
base::Unretained(this), syncer::THEMES), base::Unretained(this), syncer::THEMES),
profile_)); dump_stack, profile_));
} else { } else {
controllers.push_back(std::make_unique<ThemeDataTypeController>( controllers.push_back(std::make_unique<ThemeDataTypeController>(
error_callback, this, profile_)); dump_stack, this, profile_));
} }
} }
...@@ -376,11 +375,11 @@ ChromeSyncClient::CreateDataTypeControllers( ...@@ -376,11 +375,11 @@ ChromeSyncClient::CreateDataTypeControllers(
if (!disabled_types.Has(syncer::SEARCH_ENGINES)) { if (!disabled_types.Has(syncer::SEARCH_ENGINES)) {
if (base::FeatureList::IsEnabled(switches::kSyncPseudoUSSSearchEngines)) { if (base::FeatureList::IsEnabled(switches::kSyncPseudoUSSSearchEngines)) {
controllers.push_back(std::make_unique<SearchEngineModelTypeController>( controllers.push_back(std::make_unique<SearchEngineModelTypeController>(
error_callback, GetModelTypeStoreService()->GetStoreFactory(), dump_stack, GetModelTypeStoreService()->GetStoreFactory(),
TemplateURLServiceFactory::GetForProfile(profile_))); TemplateURLServiceFactory::GetForProfile(profile_)));
} else { } else {
controllers.push_back(std::make_unique<SearchEngineDataTypeController>( controllers.push_back(std::make_unique<SearchEngineDataTypeController>(
error_callback, this, dump_stack, this,
TemplateURLServiceFactory::GetForProfile(profile_))); TemplateURLServiceFactory::GetForProfile(profile_)));
} }
} }
...@@ -392,10 +391,11 @@ ChromeSyncClient::CreateDataTypeControllers( ...@@ -392,10 +391,11 @@ ChromeSyncClient::CreateDataTypeControllers(
std::make_unique<syncer::SyncableServiceBasedModelTypeController>( std::make_unique<syncer::SyncableServiceBasedModelTypeController>(
syncer::APP_LIST, GetModelTypeStoreService()->GetStoreFactory(), syncer::APP_LIST, GetModelTypeStoreService()->GetStoreFactory(),
base::BindOnce(&ChromeSyncClient::GetSyncableServiceForType, base::BindOnce(&ChromeSyncClient::GetSyncableServiceForType,
base::Unretained(this), syncer::APP_LIST))); base::Unretained(this), syncer::APP_LIST),
dump_stack));
} else { } else {
controllers.push_back(std::make_unique<AsyncDirectoryTypeController>( controllers.push_back(std::make_unique<AsyncDirectoryTypeController>(
syncer::APP_LIST, error_callback, this, syncer::GROUP_UI, syncer::APP_LIST, dump_stack, this, syncer::GROUP_UI,
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::UI}))); base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::UI})));
} }
#endif // BUILDFLAG(ENABLE_APP_LIST) #endif // BUILDFLAG(ENABLE_APP_LIST)
...@@ -408,10 +408,11 @@ ChromeSyncClient::CreateDataTypeControllers( ...@@ -408,10 +408,11 @@ ChromeSyncClient::CreateDataTypeControllers(
std::make_unique<syncer::SyncableServiceBasedModelTypeController>( std::make_unique<syncer::SyncableServiceBasedModelTypeController>(
syncer::DICTIONARY, GetModelTypeStoreService()->GetStoreFactory(), syncer::DICTIONARY, GetModelTypeStoreService()->GetStoreFactory(),
base::BindOnce(&ChromeSyncClient::GetSyncableServiceForType, base::BindOnce(&ChromeSyncClient::GetSyncableServiceForType,
base::Unretained(this), syncer::DICTIONARY))); base::Unretained(this), syncer::DICTIONARY),
dump_stack));
} else { } else {
controllers.push_back(std::make_unique<AsyncDirectoryTypeController>( controllers.push_back(std::make_unique<AsyncDirectoryTypeController>(
syncer::DICTIONARY, error_callback, this, syncer::GROUP_UI, syncer::DICTIONARY, dump_stack, this, syncer::GROUP_UI,
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::UI}))); base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::UI})));
} }
} }
...@@ -422,12 +423,12 @@ ChromeSyncClient::CreateDataTypeControllers( ...@@ -422,12 +423,12 @@ ChromeSyncClient::CreateDataTypeControllers(
switches::kEnableWifiCredentialSync) && switches::kEnableWifiCredentialSync) &&
!disabled_types.Has(syncer::WIFI_CREDENTIALS)) { !disabled_types.Has(syncer::WIFI_CREDENTIALS)) {
controllers.push_back(std::make_unique<AsyncDirectoryTypeController>( controllers.push_back(std::make_unique<AsyncDirectoryTypeController>(
syncer::WIFI_CREDENTIALS, error_callback, this, syncer::GROUP_UI, syncer::WIFI_CREDENTIALS, dump_stack, this, syncer::GROUP_UI,
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::UI}))); base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::UI})));
} }
if (arc::IsArcAllowedForProfile(profile_)) { if (arc::IsArcAllowedForProfile(profile_)) {
controllers.push_back(std::make_unique<ArcPackageSyncDataTypeController>( controllers.push_back(std::make_unique<ArcPackageSyncDataTypeController>(
syncer::ARC_PACKAGE, error_callback, this, profile_)); syncer::ARC_PACKAGE, dump_stack, this, profile_));
} }
#endif // defined(OS_CHROMEOS) #endif // defined(OS_CHROMEOS)
......
...@@ -15,11 +15,13 @@ ExtensionModelTypeController::ExtensionModelTypeController( ...@@ -15,11 +15,13 @@ ExtensionModelTypeController::ExtensionModelTypeController(
syncer::ModelType type, syncer::ModelType type,
syncer::OnceModelTypeStoreFactory store_factory, syncer::OnceModelTypeStoreFactory store_factory,
SyncableServiceProvider syncable_service_provider, SyncableServiceProvider syncable_service_provider,
const base::RepeatingClosure& dump_stack,
Profile* profile) Profile* profile)
: SyncableServiceBasedModelTypeController( : SyncableServiceBasedModelTypeController(
type, type,
std::move(store_factory), std::move(store_factory),
std::move(syncable_service_provider)), std::move(syncable_service_provider),
dump_stack),
profile_(profile) { profile_(profile) {
DCHECK(type == syncer::EXTENSIONS || type == syncer::APPS || DCHECK(type == syncer::EXTENSIONS || type == syncer::APPS ||
type == syncer::THEMES); type == syncer::THEMES);
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_SYNC_GLUE_EXTENSION_MODEL_TYPE_CONTROLLER_H_ #ifndef CHROME_BROWSER_SYNC_GLUE_EXTENSION_MODEL_TYPE_CONTROLLER_H_
#define CHROME_BROWSER_SYNC_GLUE_EXTENSION_MODEL_TYPE_CONTROLLER_H_ #define CHROME_BROWSER_SYNC_GLUE_EXTENSION_MODEL_TYPE_CONTROLLER_H_
#include "base/callback_forward.h"
#include "base/macros.h" #include "base/macros.h"
#include "components/sync/driver/syncable_service_based_model_type_controller.h" #include "components/sync/driver/syncable_service_based_model_type_controller.h"
...@@ -22,6 +23,7 @@ class ExtensionModelTypeController ...@@ -22,6 +23,7 @@ class ExtensionModelTypeController
syncer::ModelType type, syncer::ModelType type,
syncer::OnceModelTypeStoreFactory store_factory, syncer::OnceModelTypeStoreFactory store_factory,
SyncableServiceProvider syncable_service_provider, SyncableServiceProvider syncable_service_provider,
const base::RepeatingClosure& dump_stack,
Profile* profile); Profile* profile);
~ExtensionModelTypeController() override; ~ExtensionModelTypeController() override;
......
...@@ -138,7 +138,7 @@ ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers( ...@@ -138,7 +138,7 @@ ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers(
syncer::ModelTypeSet disabled_types, syncer::ModelTypeSet disabled_types,
syncer::LocalDeviceInfoProvider* local_device_info_provider) { syncer::LocalDeviceInfoProvider* local_device_info_provider) {
syncer::DataTypeController::TypeVector controllers; syncer::DataTypeController::TypeVector controllers;
base::Closure error_callback = const base::RepeatingClosure dump_stack =
base::BindRepeating(&syncer::ReportUnrecoverableError, channel_); base::BindRepeating(&syncer::ReportUnrecoverableError, channel_);
// TODO(stanisc): can DEVICE_INFO be one of disabled datatypes? // TODO(stanisc): can DEVICE_INFO be one of disabled datatypes?
...@@ -166,7 +166,7 @@ ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers( ...@@ -166,7 +166,7 @@ ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers(
} else { } else {
controllers.push_back( controllers.push_back(
std::make_unique<AutofillProfileDataTypeController>( std::make_unique<AutofillProfileDataTypeController>(
db_thread_, error_callback, sync_client_, db_thread_, dump_stack, sync_client_,
web_data_service_on_disk_)); web_data_service_on_disk_));
} }
} }
...@@ -183,7 +183,7 @@ ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers( ...@@ -183,7 +183,7 @@ ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers(
} else { } else {
controllers.push_back( controllers.push_back(
std::make_unique<AutofillWalletDataTypeController>( std::make_unique<AutofillWalletDataTypeController>(
syncer::AUTOFILL_WALLET_DATA, db_thread_, error_callback, syncer::AUTOFILL_WALLET_DATA, db_thread_, dump_stack,
sync_client_, web_data_service_on_disk_)); sync_client_, web_data_service_on_disk_));
} }
} }
...@@ -201,7 +201,7 @@ ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers( ...@@ -201,7 +201,7 @@ ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers(
} else { } else {
controllers.push_back( controllers.push_back(
std::make_unique<AutofillWalletDataTypeController>( std::make_unique<AutofillWalletDataTypeController>(
syncer::AUTOFILL_WALLET_METADATA, db_thread_, error_callback, syncer::AUTOFILL_WALLET_METADATA, db_thread_, dump_stack,
sync_client_, web_data_service_on_disk_)); sync_client_, web_data_service_on_disk_));
} }
} }
...@@ -221,7 +221,7 @@ ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers( ...@@ -221,7 +221,7 @@ ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers(
sync_client_->GetFaviconService())))); sync_client_->GetFaviconService()))));
} else { } else {
controllers.push_back(std::make_unique<BookmarkDataTypeController>( controllers.push_back(std::make_unique<BookmarkDataTypeController>(
error_callback, sync_client_)); dump_stack, sync_client_));
} }
} }
...@@ -244,12 +244,12 @@ ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers( ...@@ -244,12 +244,12 @@ ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers(
switches::kSyncPseudoUSSHistoryDeleteDirectives)) { switches::kSyncPseudoUSSHistoryDeleteDirectives)) {
controllers.push_back( controllers.push_back(
std::make_unique<HistoryDeleteDirectivesModelTypeController>( std::make_unique<HistoryDeleteDirectivesModelTypeController>(
sync_client_)); dump_stack, sync_client_));
} else { } else {
controllers.push_back( controllers.push_back(
std::make_unique<HistoryDeleteDirectivesDataTypeController>( std::make_unique<HistoryDeleteDirectivesDataTypeController>(
error_callback, sync_client_)); dump_stack, sync_client_));
} }
} }
...@@ -270,7 +270,7 @@ ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers( ...@@ -270,7 +270,7 @@ ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers(
history_disabled_pref_)); history_disabled_pref_));
} else { } else {
controllers.push_back(std::make_unique<SessionDataTypeController>( controllers.push_back(std::make_unique<SessionDataTypeController>(
error_callback, sync_client_, local_device_info_provider, dump_stack, sync_client_, local_device_info_provider,
history_disabled_pref_)); history_disabled_pref_));
} }
} }
...@@ -285,14 +285,16 @@ ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers( ...@@ -285,14 +285,16 @@ ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers(
sync_client_->GetModelTypeStoreService()->GetStoreFactory(), sync_client_->GetModelTypeStoreService()->GetStoreFactory(),
base::BindOnce(&syncer::SyncClient::GetSyncableServiceForType, base::BindOnce(&syncer::SyncClient::GetSyncableServiceForType,
base::Unretained(sync_client_), base::Unretained(sync_client_),
syncer::FAVICON_IMAGES))); syncer::FAVICON_IMAGES),
dump_stack));
controllers.push_back( controllers.push_back(
std::make_unique<SyncableServiceBasedModelTypeController>( std::make_unique<SyncableServiceBasedModelTypeController>(
syncer::FAVICON_TRACKING, syncer::FAVICON_TRACKING,
sync_client_->GetModelTypeStoreService()->GetStoreFactory(), sync_client_->GetModelTypeStoreService()->GetStoreFactory(),
base::BindOnce(&syncer::SyncClient::GetSyncableServiceForType, base::BindOnce(&syncer::SyncClient::GetSyncableServiceForType,
base::Unretained(sync_client_), base::Unretained(sync_client_),
syncer::FAVICON_TRACKING))); syncer::FAVICON_TRACKING),
dump_stack));
} else { } else {
controllers.push_back(std::make_unique<AsyncDirectoryTypeController>( controllers.push_back(std::make_unique<AsyncDirectoryTypeController>(
syncer::FAVICON_IMAGES, base::RepeatingClosure(), sync_client_, syncer::FAVICON_IMAGES, base::RepeatingClosure(), sync_client_,
...@@ -308,7 +310,7 @@ ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers( ...@@ -308,7 +310,7 @@ ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers(
// disabled. // disabled.
if (!disabled_types.Has(syncer::PASSWORDS)) { if (!disabled_types.Has(syncer::PASSWORDS)) {
controllers.push_back(std::make_unique<PasswordDataTypeController>( controllers.push_back(std::make_unique<PasswordDataTypeController>(
error_callback, sync_client_, dump_stack, sync_client_,
sync_client_->GetPasswordStateChangedCallback(), password_store_)); sync_client_->GetPasswordStateChangedCallback(), password_store_));
} }
...@@ -324,10 +326,11 @@ ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers( ...@@ -324,10 +326,11 @@ ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers(
sync_client_->GetModelTypeStoreService()->GetStoreFactory(), sync_client_->GetModelTypeStoreService()->GetStoreFactory(),
base::BindOnce(&syncer::SyncClient::GetSyncableServiceForType, base::BindOnce(&syncer::SyncClient::GetSyncableServiceForType,
base::Unretained(sync_client_), base::Unretained(sync_client_),
syncer::PREFERENCES))); syncer::PREFERENCES),
dump_stack));
} else { } else {
controllers.push_back(std::make_unique<AsyncDirectoryTypeController>( controllers.push_back(std::make_unique<AsyncDirectoryTypeController>(
syncer::PREFERENCES, error_callback, sync_client_, syncer::GROUP_UI, syncer::PREFERENCES, dump_stack, sync_client_, syncer::GROUP_UI,
ui_thread_)); ui_thread_));
} }
} }
...@@ -341,10 +344,11 @@ ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers( ...@@ -341,10 +344,11 @@ ProfileSyncComponentsFactoryImpl::CreateCommonDataTypeControllers(
sync_client_->GetModelTypeStoreService()->GetStoreFactory(), sync_client_->GetModelTypeStoreService()->GetStoreFactory(),
base::BindOnce(&syncer::SyncClient::GetSyncableServiceForType, base::BindOnce(&syncer::SyncClient::GetSyncableServiceForType,
base::Unretained(sync_client_), base::Unretained(sync_client_),
syncer::PRIORITY_PREFERENCES))); syncer::PRIORITY_PREFERENCES),
dump_stack));
} else { } else {
controllers.push_back(std::make_unique<AsyncDirectoryTypeController>( controllers.push_back(std::make_unique<AsyncDirectoryTypeController>(
syncer::PRIORITY_PREFERENCES, error_callback, sync_client_, syncer::PRIORITY_PREFERENCES, dump_stack, sync_client_,
syncer::GROUP_UI, ui_thread_)); syncer::GROUP_UI, ui_thread_));
} }
} }
......
...@@ -14,13 +14,16 @@ ...@@ -14,13 +14,16 @@
namespace browser_sync { namespace browser_sync {
HistoryDeleteDirectivesModelTypeController:: HistoryDeleteDirectivesModelTypeController::
HistoryDeleteDirectivesModelTypeController(syncer::SyncClient* sync_client) HistoryDeleteDirectivesModelTypeController(
const base::RepeatingClosure& dump_stack,
syncer::SyncClient* sync_client)
: SyncableServiceBasedModelTypeController( : SyncableServiceBasedModelTypeController(
syncer::HISTORY_DELETE_DIRECTIVES, syncer::HISTORY_DELETE_DIRECTIVES,
sync_client->GetModelTypeStoreService()->GetStoreFactory(), sync_client->GetModelTypeStoreService()->GetStoreFactory(),
base::BindOnce(&syncer::SyncClient::GetSyncableServiceForType, base::BindOnce(&syncer::SyncClient::GetSyncableServiceForType,
base::Unretained(sync_client), base::Unretained(sync_client),
syncer::HISTORY_DELETE_DIRECTIVES)), syncer::HISTORY_DELETE_DIRECTIVES),
dump_stack),
sync_client_(sync_client) {} sync_client_(sync_client) {}
HistoryDeleteDirectivesModelTypeController:: HistoryDeleteDirectivesModelTypeController::
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef COMPONENTS_HISTORY_CORE_BROWSER_SYNC_HISTORY_DELETE_DIRECTIVES_MODEL_TYPE_CONTROLLER_H_ #ifndef COMPONENTS_HISTORY_CORE_BROWSER_SYNC_HISTORY_DELETE_DIRECTIVES_MODEL_TYPE_CONTROLLER_H_
#define COMPONENTS_HISTORY_CORE_BROWSER_SYNC_HISTORY_DELETE_DIRECTIVES_MODEL_TYPE_CONTROLLER_H_ #define COMPONENTS_HISTORY_CORE_BROWSER_SYNC_HISTORY_DELETE_DIRECTIVES_MODEL_TYPE_CONTROLLER_H_
#include "base/callback_forward.h"
#include "base/macros.h" #include "base/macros.h"
#include "components/sync/driver/sync_service_observer.h" #include "components/sync/driver/sync_service_observer.h"
#include "components/sync/driver/syncable_service_based_model_type_controller.h" #include "components/sync/driver/syncable_service_based_model_type_controller.h"
...@@ -22,7 +23,8 @@ class HistoryDeleteDirectivesModelTypeController ...@@ -22,7 +23,8 @@ class HistoryDeleteDirectivesModelTypeController
public syncer::SyncServiceObserver { public syncer::SyncServiceObserver {
public: public:
// |sync_client| must not be null and must outlive this object. // |sync_client| must not be null and must outlive this object.
explicit HistoryDeleteDirectivesModelTypeController( HistoryDeleteDirectivesModelTypeController(
const base::RepeatingClosure& dump_stack,
syncer::SyncClient* sync_client); syncer::SyncClient* sync_client);
~HistoryDeleteDirectivesModelTypeController() override; ~HistoryDeleteDirectivesModelTypeController() override;
......
...@@ -22,10 +22,12 @@ class ControllerDelegate : public ModelTypeControllerDelegate { ...@@ -22,10 +22,12 @@ class ControllerDelegate : public ModelTypeControllerDelegate {
ControllerDelegate(ModelType type, ControllerDelegate(ModelType type,
OnceModelTypeStoreFactory store_factory, OnceModelTypeStoreFactory store_factory,
SyncableServiceProvider syncable_service_provider) SyncableServiceProvider syncable_service_provider,
const base::RepeatingClosure& dump_stack)
: type_(type), : type_(type),
store_factory_(std::move(store_factory)), store_factory_(std::move(store_factory)),
syncable_service_provider_(std::move(syncable_service_provider)) { syncable_service_provider_(std::move(syncable_service_provider)),
dump_stack_(dump_stack) {
DCHECK(store_factory_); DCHECK(store_factory_);
DCHECK(syncable_service_provider_); DCHECK(syncable_service_provider_);
} }
...@@ -62,9 +64,8 @@ class ControllerDelegate : public ModelTypeControllerDelegate { ...@@ -62,9 +64,8 @@ class ControllerDelegate : public ModelTypeControllerDelegate {
DCHECK(syncable_service); DCHECK(syncable_service);
bridge_ = std::make_unique<SyncableServiceBasedBridge>( bridge_ = std::make_unique<SyncableServiceBasedBridge>(
type_, std::move(store_factory_), type_, std::move(store_factory_),
std::make_unique<ClientTagBasedModelTypeProcessor>( std::make_unique<ClientTagBasedModelTypeProcessor>(type_,
type_, dump_stack_),
/*dump_stack=*/base::RepeatingClosure()),
syncable_service.get()); syncable_service.get());
} }
return bridge_->change_processor()->GetControllerDelegate().get(); return bridge_->change_processor()->GetControllerDelegate().get();
...@@ -73,6 +74,7 @@ class ControllerDelegate : public ModelTypeControllerDelegate { ...@@ -73,6 +74,7 @@ class ControllerDelegate : public ModelTypeControllerDelegate {
const ModelType type_; const ModelType type_;
OnceModelTypeStoreFactory store_factory_; OnceModelTypeStoreFactory store_factory_;
SyncableServiceProvider syncable_service_provider_; SyncableServiceProvider syncable_service_provider_;
const base::RepeatingClosure dump_stack_;
std::unique_ptr<ModelTypeSyncBridge> bridge_; std::unique_ptr<ModelTypeSyncBridge> bridge_;
DISALLOW_COPY_AND_ASSIGN(ControllerDelegate); DISALLOW_COPY_AND_ASSIGN(ControllerDelegate);
...@@ -84,12 +86,14 @@ SyncableServiceBasedModelTypeController:: ...@@ -84,12 +86,14 @@ SyncableServiceBasedModelTypeController::
SyncableServiceBasedModelTypeController( SyncableServiceBasedModelTypeController(
ModelType type, ModelType type,
OnceModelTypeStoreFactory store_factory, OnceModelTypeStoreFactory store_factory,
SyncableServiceProvider syncable_service_provider) SyncableServiceProvider syncable_service_provider,
const base::RepeatingClosure& dump_stack)
: ModelTypeController(type, : ModelTypeController(type,
std::make_unique<ControllerDelegate>( std::make_unique<ControllerDelegate>(
type, type,
std::move(store_factory), std::move(store_factory),
std::move(syncable_service_provider))) {} std::move(syncable_service_provider),
dump_stack)) {}
SyncableServiceBasedModelTypeController:: SyncableServiceBasedModelTypeController::
~SyncableServiceBasedModelTypeController() {} ~SyncableServiceBasedModelTypeController() {}
......
...@@ -28,7 +28,8 @@ class SyncableServiceBasedModelTypeController : public ModelTypeController { ...@@ -28,7 +28,8 @@ class SyncableServiceBasedModelTypeController : public ModelTypeController {
SyncableServiceBasedModelTypeController( SyncableServiceBasedModelTypeController(
ModelType type, ModelType type,
OnceModelTypeStoreFactory store_factory, OnceModelTypeStoreFactory store_factory,
SyncableServiceProvider syncable_service_provider); SyncableServiceProvider syncable_service_provider,
const base::RepeatingClosure& dump_stack);
~SyncableServiceBasedModelTypeController() override; ~SyncableServiceBasedModelTypeController() override;
private: private:
......
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