Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(396)

Unified Diff: components/sync/device_info/device_info_data_type_controller.cc

Issue 2289143003: [Sync] Convert DTCs to be not RefCounted and NonThreadSafe. (Closed)
Patch Set: Rebase. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/sync/device_info/device_info_data_type_controller.cc
diff --git a/components/sync/device_info/device_info_data_type_controller.cc b/components/sync/device_info/device_info_data_type_controller.cc
index e0e4b859ce832394f811c10a881644c48fdd9624..ef58cff95395781a7692b533739827033e2dee76 100644
--- a/components/sync/device_info/device_info_data_type_controller.cc
+++ b/components/sync/device_info/device_info_data_type_controller.cc
@@ -10,35 +10,35 @@
namespace sync_driver {
DeviceInfoDataTypeController::DeviceInfoDataTypeController(
- const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread,
- const base::Closure& error_callback,
+ const base::Closure& dump_stack,
SyncClient* sync_client,
LocalDeviceInfoProvider* local_device_info_provider)
- : UIDataTypeController(ui_thread,
- error_callback,
- syncer::DEVICE_INFO,
- sync_client),
+ : UIDataTypeController(syncer::DEVICE_INFO, dump_stack, sync_client),
local_device_info_provider_(local_device_info_provider) {}
DeviceInfoDataTypeController::~DeviceInfoDataTypeController() {}
bool DeviceInfoDataTypeController::StartModels() {
+ DCHECK(CalledOnValidThread());
// Start the data type as soon as the local device info gets available.
if (local_device_info_provider_->GetLocalDeviceInfo()) {
return true;
}
subscription_ = local_device_info_provider_->RegisterOnInitializedCallback(
- base::Bind(&DeviceInfoDataTypeController::OnLocalDeviceInfoLoaded, this));
+ base::Bind(&DeviceInfoDataTypeController::OnLocalDeviceInfoLoaded,
+ base::AsWeakPtr(this)));
return false;
}
void DeviceInfoDataTypeController::StopModels() {
+ DCHECK(CalledOnValidThread());
subscription_.reset();
}
void DeviceInfoDataTypeController::OnLocalDeviceInfoLoaded() {
+ DCHECK(CalledOnValidThread());
DCHECK_EQ(state_, MODEL_STARTING);
DCHECK(local_device_info_provider_->GetLocalDeviceInfo());

Powered by Google App Engine
This is Rietveld 408576698