Index: chrome/browser/sync/glue/data_type_manager_impl.cc |
=================================================================== |
--- chrome/browser/sync/glue/data_type_manager_impl.cc (revision 94142) |
+++ chrome/browser/sync/glue/data_type_manager_impl.cc (working copy) |
@@ -130,8 +130,7 @@ |
// If we're already configured and the types haven't changed, we can exit |
// out early. |
NotifyStart(); |
- ConfigureResult result(OK, last_requested_types_); |
- NotifyDone(result); |
+ NotifyDone(OK, FROM_HERE); |
return; |
} |
@@ -222,7 +221,7 @@ |
DCHECK(state_ == DOWNLOAD_PENDING); |
if (!success) { |
- Abort(UNRECOVERABLE_ERROR, FROM_HERE, needs_start_[0]->type()); |
+ NotifyDone(UNRECOVERABLE_ERROR, FROM_HERE); |
return; |
} |
@@ -277,8 +276,7 @@ |
// If no more data types need starting, we're done. |
state_ = CONFIGURED; |
- ConfigureResult result(OK, last_requested_types_); |
- NotifyDone(result); |
+ NotifyDone(OK, FROM_HERE); |
} |
void DataTypeManagerImpl::TypeStartCallback( |
@@ -293,7 +291,7 @@ |
// DataTypeManager::Stop() was called while the current data type |
// was starting. Now that it has finished starting, we can finish |
// stopping the DataTypeManager. This is considered an ABORT. |
- Abort(ABORTED, location, needs_start_[0]->type()); |
+ FinishStopAndNotify(ABORTED, FROM_HERE); |
return; |
} else if (state_ == STOPPED) { |
// If our state_ is STOPPED, we have already stopped all of the data |
@@ -308,6 +306,8 @@ |
DCHECK_EQ(needs_start_[0], started_dtc); |
needs_start_.erase(needs_start_.begin()); |
+ if (result == DataTypeController::NEEDS_CRYPTO) { |
+ } |
// If the type started normally, continue to the next type. |
// If the type is waiting for the cryptographer, continue to the next type. |
// Once the cryptographer is ready, we'll attempt to restart this type. |
@@ -322,29 +322,22 @@ |
// managed to start up to this point and pass the result to the |
// callback. |
VLOG(0) << "Failed " << started_dtc->name(); |
- ConfigureStatus configure_status = DataTypeManager::ABORTED; |
+ ConfigureResult configure_result = DataTypeManager::ABORTED; |
switch (result) { |
case DataTypeController::ABORTED: |
- configure_status = DataTypeManager::ABORTED; |
+ configure_result = DataTypeManager::ABORTED; |
break; |
case DataTypeController::ASSOCIATION_FAILED: |
- configure_status = DataTypeManager::ASSOCIATION_FAILED; |
+ configure_result = DataTypeManager::ASSOCIATION_FAILED; |
break; |
case DataTypeController::UNRECOVERABLE_ERROR: |
- configure_status = DataTypeManager::UNRECOVERABLE_ERROR; |
+ configure_result = DataTypeManager::UNRECOVERABLE_ERROR; |
break; |
default: |
NOTREACHED(); |
break; |
} |
- |
- // TODO(sync): We currently only specify the last attempted type as the failed |
- // type. At some point we should allow a datatype to fail without preventing |
- // other datatypes from continuing. In that case we'll have to support |
- // multiple types failing. |
- Abort(configure_status, |
- location, |
- started_dtc->type()); |
+ FinishStopAndNotify(configure_result, location); |
} |
void DataTypeManagerImpl::Stop() { |
@@ -375,10 +368,7 @@ |
// If Stop() is called while waiting for download, cancel all |
// outstanding tasks. |
weak_ptr_factory_.InvalidateWeakPtrs(); |
- syncable::ModelType type = syncable::UNSPECIFIED; |
- if (needs_start_.size() > 0) |
- type = needs_start_[0]->type(); |
- Abort(ABORTED, FROM_HERE, type); |
+ FinishStopAndNotify(ABORTED, FROM_HERE); |
return; |
} |
@@ -400,20 +390,10 @@ |
state_ = STOPPED; |
} |
-void DataTypeManagerImpl::Abort( |
- ConfigureStatus status, |
- const tracked_objects::Location& location, |
- syncable::ModelType last_attempted_type) { |
- DCHECK_NE(OK, status); |
+void DataTypeManagerImpl::FinishStopAndNotify(ConfigureResult result, |
+ const tracked_objects::Location& location) { |
FinishStop(); |
- TypeSet attempted_types; |
- if (syncable::IsRealDataType(last_attempted_type)) |
- attempted_types.insert(last_attempted_type); |
- ConfigureResult result(status, |
- last_requested_types_, |
- attempted_types, |
- location); |
- NotifyDone(result); |
+ NotifyDone(result, location); |
} |
void DataTypeManagerImpl::NotifyStart() { |
@@ -423,12 +403,14 @@ |
NotificationService::NoDetails()); |
} |
-void DataTypeManagerImpl::NotifyDone(const ConfigureResult& result) { |
+void DataTypeManagerImpl::NotifyDone(ConfigureResult result, |
+ const tracked_objects::Location& location) { |
+ ConfigureResultWithErrorLocation result_with_location(result, location, |
+ last_requested_types_); |
AddToConfigureTime(); |
- |
VLOG(1) << "Total time spent configuring: " |
<< configure_time_delta_.InSecondsF() << "s"; |
- switch (result.status) { |
+ switch (result) { |
case DataTypeManager::OK: |
VLOG(1) << "NotifyDone called with result: OK"; |
UMA_HISTOGRAM_TIMES("Sync.ConfigureTime.OK", |
@@ -456,7 +438,7 @@ |
NotificationService::current()->Notify( |
chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, |
Source<DataTypeManager>(this), |
- Details<const ConfigureResult>(&result)); |
+ Details<ConfigureResultWithErrorLocation>(&result_with_location)); |
} |
const DataTypeController::TypeMap& DataTypeManagerImpl::controllers() { |