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

Unified Diff: components/sync/driver/ui_data_type_controller.cc

Issue 2388163002: [Sync] Move //components/sync to the syncer namespace, take 2. (Closed)
Patch Set: Rebase. Created 4 years, 2 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/driver/ui_data_type_controller.cc
diff --git a/components/sync/driver/ui_data_type_controller.cc b/components/sync/driver/ui_data_type_controller.cc
index 631e82b90785ab8145823016cd106dc86031aee7..cddca830b4d68473775b7cccc01330a4c4a26e4a 100644
--- a/components/sync/driver/ui_data_type_controller.cc
+++ b/components/sync/driver/ui_data_type_controller.cc
@@ -22,21 +22,19 @@
#include "components/sync/driver/sync_client.h"
#include "components/sync/driver/sync_service.h"
-namespace sync_driver {
+namespace syncer {
UIDataTypeController::UIDataTypeController()
- : DirectoryDataTypeController(syncer::UNSPECIFIED,
- base::Closure(),
- nullptr),
+ : DirectoryDataTypeController(UNSPECIFIED, base::Closure(), nullptr),
state_(NOT_RUNNING) {}
-UIDataTypeController::UIDataTypeController(syncer::ModelType type,
+UIDataTypeController::UIDataTypeController(ModelType type,
const base::Closure& dump_stack,
SyncClient* sync_client)
: DirectoryDataTypeController(type, dump_stack, sync_client),
state_(NOT_RUNNING),
processor_factory_(new GenericChangeProcessorFactory()) {
- DCHECK(syncer::IsRealDataType(type));
+ DCHECK(IsRealDataType(type));
}
void UIDataTypeController::SetGenericChangeProcessorFactoryForTest(
@@ -50,12 +48,12 @@ UIDataTypeController::~UIDataTypeController() {}
void UIDataTypeController::LoadModels(
const ModelLoadCallback& model_load_callback) {
DCHECK(CalledOnValidThread());
- DCHECK(syncer::IsRealDataType(type()));
+ DCHECK(IsRealDataType(type()));
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 loaded", type()));
+ model_load_callback.Run(type(),
+ SyncError(FROM_HERE, SyncError::DATATYPE_ERROR,
+ "Model already loaded", type()));
return;
}
// Since we can't be called multiple times before Stop() is called,
@@ -73,7 +71,7 @@ void UIDataTypeController::LoadModels(
}
state_ = MODEL_LOADED;
- model_load_callback_.Run(type(), syncer::SyncError());
+ model_load_callback_.Run(type(), SyncError());
}
void UIDataTypeController::OnModelLoaded() {
@@ -81,7 +79,7 @@ void UIDataTypeController::OnModelLoaded() {
DCHECK_EQ(state_, MODEL_STARTING);
state_ = MODEL_LOADED;
- model_load_callback_.Run(type(), syncer::SyncError());
+ model_load_callback_.Run(type(), SyncError());
}
void UIDataTypeController::StartAssociating(
@@ -112,10 +110,9 @@ void UIDataTypeController::Associate() {
return;
}
- syncer::SyncMergeResult local_merge_result(type());
- syncer::SyncMergeResult syncer_merge_result(type());
- base::WeakPtrFactory<syncer::SyncMergeResult> weak_ptr_factory(
- &syncer_merge_result);
+ SyncMergeResult local_merge_result(type());
+ SyncMergeResult syncer_merge_result(type());
+ base::WeakPtrFactory<SyncMergeResult> weak_ptr_factory(&syncer_merge_result);
// TODO(robliao): Remove ScopedTracker below once https://crbug.com/471403 is
// fixed.
@@ -124,15 +121,15 @@ void UIDataTypeController::Associate() {
"471403 UIDataTypeController::Associate1"));
// Connect |shared_change_processor_| to the syncer and get the
- // syncer::SyncableService associated with type().
+ // SyncableService associated with type().
DCHECK(sync_client_->GetSyncService());
local_service_ = shared_change_processor_->Connect(
sync_client_, processor_factory_.get(),
sync_client_->GetSyncService()->GetUserShare(), CreateErrorHandler(),
weak_ptr_factory.GetWeakPtr());
if (!local_service_.get()) {
- syncer::SyncError error(FROM_HERE, syncer::SyncError::DATATYPE_ERROR,
- "Failed to connect to syncer.", type());
+ SyncError error(FROM_HERE, SyncError::DATATYPE_ERROR,
+ "Failed to connect to syncer.", type());
local_merge_result.set_error(error);
StartDone(ASSOCIATION_FAILED, local_merge_result, syncer_merge_result);
return;
@@ -144,8 +141,7 @@ void UIDataTypeController::Associate() {
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"471403 UIDataTypeController::Associate2"));
if (!shared_change_processor_->CryptoReadyIfNecessary()) {
- syncer::SyncError error(FROM_HERE, syncer::SyncError::CRYPTO_ERROR, "",
- type());
+ SyncError error(FROM_HERE, SyncError::CRYPTO_ERROR, "", type());
local_merge_result.set_error(error);
StartDone(NEEDS_CRYPTO, local_merge_result, syncer_merge_result);
return;
@@ -159,8 +155,8 @@ void UIDataTypeController::Associate() {
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());
+ SyncError error(FROM_HERE, SyncError::UNRECOVERABLE_ERROR,
+ "Failed to load sync nodes", type());
local_merge_result.set_error(error);
StartDone(UNRECOVERABLE_ERROR, local_merge_result, syncer_merge_result);
return;
@@ -169,7 +165,7 @@ void UIDataTypeController::Associate() {
// Scope for |initial_sync_data| which might be expensive, so we don't want
// to keep it in memory longer than necessary.
{
- syncer::SyncDataList initial_sync_data;
+ SyncDataList initial_sync_data;
// TODO(robliao): Remove ScopedTracker below once https://crbug.com/471403
// is fixed.
@@ -177,9 +173,8 @@ void UIDataTypeController::Associate() {
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"471403 UIDataTypeController::Associate4"));
base::TimeTicks start_time = base::TimeTicks::Now();
- syncer::SyncError error =
- shared_change_processor_->GetAllSyncDataReturnError(type(),
- &initial_sync_data);
+ SyncError error = shared_change_processor_->GetAllSyncDataReturnError(
+ type(), &initial_sync_data);
if (error.IsSet()) {
local_merge_result.set_error(error);
StartDone(ASSOCIATION_FAILED, local_merge_result, syncer_merge_result);
@@ -194,7 +189,7 @@ void UIDataTypeController::Associate() {
std::string datatype_context;
if (shared_change_processor_->GetDataTypeContext(&datatype_context)) {
local_service_->UpdateDataTypeContext(
- type(), syncer::SyncChangeProcessor::NO_REFRESH, datatype_context);
+ type(), SyncChangeProcessor::NO_REFRESH, datatype_context);
}
// TODO(robliao): Remove ScopedTracker below once https://crbug.com/471403
@@ -207,9 +202,9 @@ void UIDataTypeController::Associate() {
// Passes a reference to |shared_change_processor_|.
local_merge_result = local_service_->MergeDataAndStartSyncing(
type(), initial_sync_data,
- std::unique_ptr<syncer::SyncChangeProcessor>(
+ std::unique_ptr<SyncChangeProcessor>(
new SharedChangeProcessorRef(shared_change_processor_)),
- std::unique_ptr<syncer::SyncErrorFactory>(
+ std::unique_ptr<SyncErrorFactory>(
new SharedChangeProcessorRef(shared_change_processor_)));
RecordAssociationTime(base::TimeTicks::Now() - start_time);
if (local_merge_result.error().IsSet()) {
@@ -251,8 +246,8 @@ void UIDataTypeController::AbortModelLoad() {
void UIDataTypeController::StartDone(
ConfigureResult start_result,
- const syncer::SyncMergeResult& local_merge_result,
- const syncer::SyncMergeResult& syncer_merge_result) {
+ const SyncMergeResult& local_merge_result,
+ const SyncMergeResult& syncer_merge_result) {
DCHECK(CalledOnValidThread());
// TODO(robliao): Remove ScopedTracker below once https://crbug.com/471403 is
@@ -281,7 +276,7 @@ void UIDataTypeController::StartDone(
void UIDataTypeController::Stop() {
DCHECK(CalledOnValidThread());
- DCHECK(syncer::IsRealDataType(type()));
+ DCHECK(IsRealDataType(type()));
if (state_ == NOT_RUNNING)
return;
@@ -316,31 +311,30 @@ void UIDataTypeController::StopModels() {
// Do nothing by default.
}
-syncer::ModelSafeGroup UIDataTypeController::model_safe_group() const {
- DCHECK(syncer::IsRealDataType(type()));
- return syncer::GROUP_UI;
+ModelSafeGroup UIDataTypeController::model_safe_group() const {
+ DCHECK(IsRealDataType(type()));
+ return GROUP_UI;
}
std::string UIDataTypeController::name() const {
// For logging only.
- return syncer::ModelTypeToString(type());
+ return ModelTypeToString(type());
}
DataTypeController::State UIDataTypeController::state() const {
return state_;
}
-std::unique_ptr<syncer::DataTypeErrorHandler>
+std::unique_ptr<DataTypeErrorHandler>
UIDataTypeController::CreateErrorHandler() {
DCHECK(CalledOnValidThread());
- return base::MakeUnique<syncer::DataTypeErrorHandlerImpl>(
+ return base::MakeUnique<DataTypeErrorHandlerImpl>(
base::ThreadTaskRunnerHandle::Get(), dump_stack_,
base::Bind(&UIDataTypeController::OnUnrecoverableError,
base::AsWeakPtr(this)));
}
-void UIDataTypeController::OnUnrecoverableError(
- const syncer::SyncError& error) {
+void UIDataTypeController::OnUnrecoverableError(const SyncError& error) {
DCHECK(CalledOnValidThread());
DCHECK_EQ(type(), error.model_type());
if (!model_load_callback_.is_null()) {
@@ -359,8 +353,7 @@ void UIDataTypeController::RecordAssociationTime(base::TimeDelta time) {
void UIDataTypeController::RecordStartFailure(ConfigureResult result) {
DCHECK(CalledOnValidThread());
UMA_HISTOGRAM_ENUMERATION("Sync.DataTypeStartFailures",
- ModelTypeToHistogramInt(type()),
- syncer::MODEL_TYPE_COUNT);
+ ModelTypeToHistogramInt(type()), MODEL_TYPE_COUNT);
#define PER_DATA_TYPE_MACRO(type_str) \
UMA_HISTOGRAM_ENUMERATION("Sync." type_str "ConfigureFailure", result, \
MAX_CONFIGURE_RESULT);
@@ -368,4 +361,4 @@ void UIDataTypeController::RecordStartFailure(ConfigureResult result) {
#undef PER_DATA_TYPE_MACRO
}
-} // namespace sync_driver
+} // namespace syncer
« no previous file with comments | « components/sync/driver/ui_data_type_controller.h ('k') | components/sync/driver/ui_data_type_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698