OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/sync/glue/model_association_manager.h" | 5 #include "chrome/browser/sync/glue/model_association_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 | 9 |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 << " in disabled state."; | 304 << " in disabled state."; |
305 } | 305 } |
306 } | 306 } |
307 } | 307 } |
308 return found_any; | 308 return found_any; |
309 } | 309 } |
310 | 310 |
311 void ModelAssociationManager::AppendToFailedDatatypesAndLogError( | 311 void ModelAssociationManager::AppendToFailedDatatypesAndLogError( |
312 DataTypeController::StartResult result, | 312 DataTypeController::StartResult result, |
313 const syncer::SyncError& error) { | 313 const syncer::SyncError& error) { |
314 failed_data_types_info_[error.type()] = error; | 314 failed_data_types_info_[error.model_type()] = error; |
315 LOG(ERROR) << "Failed to associate models for " | 315 LOG(ERROR) << "Failed to associate models for " |
316 << syncer::ModelTypeToString(error.type()); | 316 << syncer::ModelTypeToString(error.model_type()); |
317 UMA_HISTOGRAM_ENUMERATION("Sync.ConfigureFailed", | 317 UMA_HISTOGRAM_ENUMERATION("Sync.ConfigureFailed", |
318 ModelTypeToHistogramInt(error.type()), | 318 ModelTypeToHistogramInt(error.model_type()), |
319 syncer::MODEL_TYPE_COUNT); | 319 syncer::MODEL_TYPE_COUNT); |
320 } | 320 } |
321 | 321 |
322 void ModelAssociationManager::TypeStartCallback( | 322 void ModelAssociationManager::TypeStartCallback( |
323 DataTypeController::StartResult start_result, | 323 DataTypeController::StartResult start_result, |
324 const syncer::SyncMergeResult& local_merge_result, | 324 const syncer::SyncMergeResult& local_merge_result, |
325 const syncer::SyncMergeResult& syncer_merge_result) { | 325 const syncer::SyncMergeResult& syncer_merge_result) { |
326 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 326 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
327 TRACE_EVENT_END0("sync", "ModelAssociation"); | 327 TRACE_EVENT_END0("sync", "ModelAssociation"); |
328 | 328 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 379 |
380 DVLOG(1) << "ModelAssociationManager: type start callback returned " | 380 DVLOG(1) << "ModelAssociationManager: type start callback returned " |
381 << start_result << " so calling LoadModelForNextType"; | 381 << start_result << " so calling LoadModelForNextType"; |
382 LoadModelForNextType(); | 382 LoadModelForNextType(); |
383 return; | 383 return; |
384 } | 384 } |
385 | 385 |
386 // Any other result requires reconfiguration. Pass it on through the callback. | 386 // Any other result requires reconfiguration. Pass it on through the callback. |
387 LOG(ERROR) << "Failed to configure " << started_dtc->name(); | 387 LOG(ERROR) << "Failed to configure " << started_dtc->name(); |
388 DCHECK(local_merge_result.error().IsSet()); | 388 DCHECK(local_merge_result.error().IsSet()); |
389 DCHECK_EQ(started_dtc->type(), local_merge_result.error().type()); | 389 DCHECK_EQ(started_dtc->type(), local_merge_result.error().model_type()); |
390 DataTypeManager::ConfigureStatus configure_status = | 390 DataTypeManager::ConfigureStatus configure_status = |
391 DataTypeManager::ABORTED; | 391 DataTypeManager::ABORTED; |
392 switch (start_result) { | 392 switch (start_result) { |
393 case DataTypeController::ABORTED: | 393 case DataTypeController::ABORTED: |
394 configure_status = DataTypeManager::ABORTED; | 394 configure_status = DataTypeManager::ABORTED; |
395 break; | 395 break; |
396 case DataTypeController::UNRECOVERABLE_ERROR: | 396 case DataTypeController::UNRECOVERABLE_ERROR: |
397 configure_status = DataTypeManager::UNRECOVERABLE_ERROR; | 397 configure_status = DataTypeManager::UNRECOVERABLE_ERROR; |
398 break; | 398 break; |
399 default: | 399 default: |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 } | 560 } |
561 return result; | 561 return result; |
562 } | 562 } |
563 | 563 |
564 base::OneShotTimer<ModelAssociationManager>* | 564 base::OneShotTimer<ModelAssociationManager>* |
565 ModelAssociationManager::GetTimerForTesting() { | 565 ModelAssociationManager::GetTimerForTesting() { |
566 return &timer_; | 566 return &timer_; |
567 } | 567 } |
568 | 568 |
569 } // namespace browser_sync | 569 } // namespace browser_sync |
OLD | NEW |