| Index: components/sync/driver/frontend_data_type_controller.cc
|
| diff --git a/components/sync_driver/frontend_data_type_controller.cc b/components/sync/driver/frontend_data_type_controller.cc
|
| similarity index 86%
|
| rename from components/sync_driver/frontend_data_type_controller.cc
|
| rename to components/sync/driver/frontend_data_type_controller.cc
|
| index ab7dffd4f336f9804fed3b8c4702b6b14819360c..fbd9f8e6dbd5932251ed904984b6fd4dd8a5ce81 100644
|
| --- a/components/sync_driver/frontend_data_type_controller.cc
|
| +++ b/components/sync/driver/frontend_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/frontend_data_type_controller.h"
|
| +#include "components/sync/driver/frontend_data_type_controller.h"
|
|
|
| #include "base/logging.h"
|
| #include "base/threading/thread_task_runner_handle.h"
|
| @@ -10,10 +10,10 @@
|
| #include "components/sync/api/sync_merge_result.h"
|
| #include "components/sync/base/data_type_histogram.h"
|
| #include "components/sync/base/model_type.h"
|
| -#include "components/sync_driver/change_processor.h"
|
| -#include "components/sync_driver/model_associator.h"
|
| -#include "components/sync_driver/sync_client.h"
|
| -#include "components/sync_driver/sync_service.h"
|
| +#include "components/sync/driver/change_processor.h"
|
| +#include "components/sync/driver/model_associator.h"
|
| +#include "components/sync/driver/sync_client.h"
|
| +#include "components/sync/driver/sync_service.h"
|
|
|
| namespace browser_sync {
|
|
|
| @@ -34,11 +34,9 @@ void FrontendDataTypeController::LoadModels(
|
| 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;
|
| }
|
|
|
| @@ -72,7 +70,7 @@ void FrontendDataTypeController::StartAssociating(
|
| state_ = ASSOCIATING;
|
|
|
| base::ThreadTaskRunnerHandle::Get()->PostTask(
|
| - FROM_HERE, base::Bind(&FrontendDataTypeController::Associate, this));
|
| + FROM_HERE, base::Bind(&FrontendDataTypeController::Associate, this));
|
| }
|
|
|
| void FrontendDataTypeController::Stop() {
|
| @@ -106,8 +104,7 @@ void FrontendDataTypeController::Stop() {
|
| state_ = NOT_RUNNING;
|
| }
|
|
|
| -syncer::ModelSafeGroup FrontendDataTypeController::model_safe_group()
|
| - const {
|
| +syncer::ModelSafeGroup FrontendDataTypeController::model_safe_group() const {
|
| return syncer::GROUP_UI;
|
| }
|
|
|
| @@ -129,8 +126,7 @@ void FrontendDataTypeController::OnSingleDataTypeUnrecoverableError(
|
| syncer::SyncMergeResult local_merge_result(type());
|
| local_merge_result.set_error(error);
|
| base::ThreadTaskRunnerHandle::Get()->PostTask(
|
| - FROM_HERE,
|
| - base::Bind(model_load_callback_, type(), error));
|
| + FROM_HERE, base::Bind(model_load_callback_, type(), error));
|
| }
|
| }
|
|
|
| @@ -155,8 +151,7 @@ void FrontendDataTypeController::RecordUnrecoverableError(
|
| const tracked_objects::Location& from_here,
|
| const std::string& message) {
|
| DVLOG(1) << "Datatype Controller failed for type "
|
| - << ModelTypeToString(type()) << " "
|
| - << message << " at location "
|
| + << ModelTypeToString(type()) << " " << message << " at location "
|
| << from_here.ToString();
|
| UMA_HISTOGRAM_ENUMERATION("Sync.DataTypeRunFailures",
|
| ModelTypeToHistogramInt(type()),
|
| @@ -183,10 +178,8 @@ void FrontendDataTypeController::Associate() {
|
|
|
| bool sync_has_nodes = false;
|
| if (!model_associator()->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);
|
| return;
|
| @@ -195,9 +188,8 @@ void FrontendDataTypeController::Associate() {
|
| // TODO(zea): Have AssociateModels fill the local and syncer merge results.
|
| base::TimeTicks start_time = base::TimeTicks::Now();
|
| syncer::SyncError error;
|
| - error = model_associator()->AssociateModels(
|
| - &local_merge_result,
|
| - &syncer_merge_result);
|
| + error = model_associator()->AssociateModels(&local_merge_result,
|
| + &syncer_merge_result);
|
| // TODO(lipalani): crbug.com/122690 - handle abort.
|
| RecordAssociationTime(base::TimeTicks::Now() - start_time);
|
| if (error.IsSet()) {
|
| @@ -210,8 +202,7 @@ void FrontendDataTypeController::Associate() {
|
| // FinishStart() invokes the DataTypeManager callback, which can lead to a
|
| // call to Stop() if one of the other data types being started generates an
|
| // error.
|
| - 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);
|
| }
|
|
|
| @@ -255,7 +246,7 @@ void FrontendDataTypeController::StartDone(
|
| void FrontendDataTypeController::RecordAssociationTime(base::TimeDelta time) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| #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
|
| }
|
|
|