Index: components/sync/driver/non_ui_data_type_controller.cc |
diff --git a/components/sync_driver/non_ui_data_type_controller.cc b/components/sync/driver/non_ui_data_type_controller.cc |
similarity index 81% |
rename from components/sync_driver/non_ui_data_type_controller.cc |
rename to components/sync/driver/non_ui_data_type_controller.cc |
index 7fd331763f6f58c0e830a5209e27f730a1abbc5c..a3e4f6f5cc0a088b40007bd0687eb5901ecfe389 100644 |
--- a/components/sync_driver/non_ui_data_type_controller.cc |
+++ b/components/sync/driver/non_ui_data_type_controller.cc |
@@ -2,7 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "components/sync_driver/non_ui_data_type_controller.h" |
+#include "components/sync/driver/non_ui_data_type_controller.h" |
#include "base/logging.h" |
#include "base/memory/weak_ptr.h" |
@@ -12,16 +12,15 @@ |
#include "components/sync/api/syncable_service.h" |
#include "components/sync/base/data_type_histogram.h" |
#include "components/sync/base/model_type.h" |
-#include "components/sync_driver/generic_change_processor_factory.h" |
-#include "components/sync_driver/shared_change_processor_ref.h" |
-#include "components/sync_driver/sync_api_component_factory.h" |
-#include "components/sync_driver/sync_client.h" |
-#include "components/sync_driver/sync_service.h" |
+#include "components/sync/driver/generic_change_processor_factory.h" |
+#include "components/sync/driver/shared_change_processor_ref.h" |
+#include "components/sync/driver/sync_api_component_factory.h" |
+#include "components/sync/driver/sync_client.h" |
+#include "components/sync/driver/sync_service.h" |
namespace sync_driver { |
-SharedChangeProcessor* |
-NonUIDataTypeController::CreateSharedChangeProcessor() { |
+SharedChangeProcessor* NonUIDataTypeController::CreateSharedChangeProcessor() { |
return new SharedChangeProcessor(); |
} |
@@ -39,11 +38,9 @@ void NonUIDataTypeController::LoadModels( |
DCHECK(ui_thread_->BelongsToCurrentThread()); |
model_load_callback_ = model_load_callback; |
if (state() != NOT_RUNNING) { |
- model_load_callback.Run(type(), |
- syncer::SyncError(FROM_HERE, |
- syncer::SyncError::DATATYPE_ERROR, |
- "Model already running", |
- type())); |
+ model_load_callback.Run( |
+ type(), syncer::SyncError(FROM_HERE, syncer::SyncError::DATATYPE_ERROR, |
+ "Model already running", type())); |
return; |
} |
@@ -94,16 +91,11 @@ void NonUIDataTypeController::StartAssociating( |
start_callback_ = start_callback; |
if (!StartAssociationAsync()) { |
- syncer::SyncError error( |
- FROM_HERE, |
- syncer::SyncError::DATATYPE_ERROR, |
- "Failed to post StartAssociation", |
- type()); |
+ syncer::SyncError error(FROM_HERE, syncer::SyncError::DATATYPE_ERROR, |
+ "Failed to post StartAssociation", type()); |
syncer::SyncMergeResult local_merge_result(type()); |
local_merge_result.set_error(error); |
- StartDoneImpl(ASSOCIATION_FAILED, |
- NOT_RUNNING, |
- local_merge_result, |
+ StartDoneImpl(ASSOCIATION_FAILED, NOT_RUNNING, local_merge_result, |
syncer::SyncMergeResult(type())); |
// StartDoneImpl should have called ClearSharedChangeProcessor(); |
DCHECK(!shared_change_processor_.get()); |
@@ -172,10 +164,9 @@ void NonUIDataTypeController::OnSingleDataTypeUnrecoverableError( |
// TODO(tim): We double-upload some errors. See bug 383480. |
if (!error_callback_.is_null()) |
error_callback_.Run(); |
- ui_thread_->PostTask(error.location(), |
- base::Bind(&NonUIDataTypeController::DisableImpl, |
- this, |
- error)); |
+ ui_thread_->PostTask( |
+ error.location(), |
+ base::Bind(&NonUIDataTypeController::DisableImpl, this, error)); |
} |
NonUIDataTypeController::NonUIDataTypeController() |
@@ -198,13 +189,10 @@ void NonUIDataTypeController::StartDone( |
new_state = (start_result == ASSOCIATION_FAILED ? DISABLED : NOT_RUNNING); |
} |
- ui_thread_->PostTask(FROM_HERE, |
- base::Bind(&NonUIDataTypeController::StartDoneImpl, |
- this, |
- start_result, |
- new_state, |
- local_merge_result, |
- syncer_merge_result)); |
+ ui_thread_->PostTask( |
+ FROM_HERE, |
+ base::Bind(&NonUIDataTypeController::StartDoneImpl, this, start_result, |
+ new_state, local_merge_result, syncer_merge_result)); |
} |
void NonUIDataTypeController::StartDoneImpl( |
@@ -241,7 +229,7 @@ void NonUIDataTypeController::StartDoneImpl( |
void NonUIDataTypeController::RecordAssociationTime(base::TimeDelta time) { |
DCHECK(!ui_thread_->BelongsToCurrentThread()); |
#define PER_DATA_TYPE_MACRO(type_str) \ |
- UMA_HISTOGRAM_TIMES("Sync." type_str "AssociationTime", time); |
+ UMA_HISTOGRAM_TIMES("Sync." type_str "AssociationTime", time); |
SYNC_DATA_TYPE_HISTOGRAM(type()); |
#undef PER_DATA_TYPE_MACRO |
} |
@@ -263,8 +251,7 @@ void NonUIDataTypeController::AbortModelLoad() { |
StopModels(); |
} |
-void NonUIDataTypeController::DisableImpl( |
- const syncer::SyncError& error) { |
+void NonUIDataTypeController::DisableImpl(const syncer::SyncError& error) { |
DCHECK(ui_thread_->BelongsToCurrentThread()); |
UMA_HISTOGRAM_ENUMERATION("Sync.DataTypeRunFailures", |
ModelTypeToHistogramInt(type()), |
@@ -281,8 +268,7 @@ bool NonUIDataTypeController::StartAssociationAsync() { |
FROM_HERE, |
base::Bind( |
&NonUIDataTypeController::StartAssociationWithSharedChangeProcessor, |
- this, |
- shared_change_processor_)); |
+ this, shared_change_processor_)); |
} |
ChangeProcessor* NonUIDataTypeController::GetChangeProcessor() const { |
@@ -295,9 +281,8 @@ ChangeProcessor* NonUIDataTypeController::GetChangeProcessor() const { |
// must either have no side effects outside of the DTC or must be protected |
// by |shared_change_processor|, which is guaranteed to have been Disconnected |
// if the syncer shut down. |
-void NonUIDataTypeController:: |
- StartAssociationWithSharedChangeProcessor( |
- const scoped_refptr<SharedChangeProcessor>& shared_change_processor) { |
+void NonUIDataTypeController::StartAssociationWithSharedChangeProcessor( |
+ const scoped_refptr<SharedChangeProcessor>& shared_change_processor) { |
DCHECK(!ui_thread_->BelongsToCurrentThread()); |
DCHECK(shared_change_processor.get()); |
DCHECK(user_share_); |
@@ -316,39 +301,27 @@ void NonUIDataTypeController:: |
sync_client_, &factory, user_share_, this, type(), |
weak_ptr_factory.GetWeakPtr()); |
if (!local_service_.get()) { |
- syncer::SyncError error(FROM_HERE, |
- syncer::SyncError::DATATYPE_ERROR, |
- "Failed to connect to syncer.", |
- type()); |
+ syncer::SyncError error(FROM_HERE, syncer::SyncError::DATATYPE_ERROR, |
+ "Failed to connect to syncer.", type()); |
local_merge_result.set_error(error); |
- StartDone(ASSOCIATION_FAILED, |
- local_merge_result, |
- syncer_merge_result); |
+ StartDone(ASSOCIATION_FAILED, local_merge_result, syncer_merge_result); |
return; |
} |
if (!shared_change_processor->CryptoReadyIfNecessary()) { |
- syncer::SyncError error(FROM_HERE, |
- syncer::SyncError::CRYPTO_ERROR, |
- "", |
+ syncer::SyncError error(FROM_HERE, syncer::SyncError::CRYPTO_ERROR, "", |
type()); |
local_merge_result.set_error(error); |
- StartDone(NEEDS_CRYPTO, |
- local_merge_result, |
- syncer_merge_result); |
+ StartDone(NEEDS_CRYPTO, local_merge_result, syncer_merge_result); |
return; |
} |
bool sync_has_nodes = false; |
if (!shared_change_processor->SyncModelHasUserCreatedNodes(&sync_has_nodes)) { |
- syncer::SyncError error(FROM_HERE, |
- syncer::SyncError::UNRECOVERABLE_ERROR, |
- "Failed to load sync nodes", |
- type()); |
+ syncer::SyncError error(FROM_HERE, syncer::SyncError::UNRECOVERABLE_ERROR, |
+ "Failed to load sync nodes", type()); |
local_merge_result.set_error(error); |
- StartDone(UNRECOVERABLE_ERROR, |
- local_merge_result, |
- syncer_merge_result); |
+ StartDone(UNRECOVERABLE_ERROR, local_merge_result, syncer_merge_result); |
return; |
} |
@@ -392,8 +365,7 @@ void NonUIDataTypeController:: |
syncer_merge_result.set_num_items_after_association( |
shared_change_processor->GetSyncCount()); |
- StartDone(!sync_has_nodes ? OK_FIRST_RUN : OK, |
- local_merge_result, |
+ StartDone(!sync_has_nodes ? OK_FIRST_RUN : OK, local_merge_result, |
syncer_merge_result); |
} |
@@ -410,8 +382,7 @@ void NonUIDataTypeController::ClearSharedChangeProcessor() { |
void NonUIDataTypeController::StopLocalServiceAsync() { |
DCHECK(ui_thread_->BelongsToCurrentThread()); |
PostTaskOnBackendThread( |
- FROM_HERE, |
- base::Bind(&NonUIDataTypeController::StopLocalService, this)); |
+ FROM_HERE, base::Bind(&NonUIDataTypeController::StopLocalService, this)); |
} |
void NonUIDataTypeController::StopLocalService() { |