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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 << " in disabled state."; | 300 << " in disabled state."; |
301 } | 301 } |
302 } | 302 } |
303 } | 303 } |
304 return found_any; | 304 return found_any; |
305 } | 305 } |
306 | 306 |
307 void ModelAssociationManager::AppendToFailedDatatypesAndLogError( | 307 void ModelAssociationManager::AppendToFailedDatatypesAndLogError( |
308 DataTypeController::StartResult result, | 308 DataTypeController::StartResult result, |
309 const syncer::SyncError& error) { | 309 const syncer::SyncError& error) { |
310 failed_data_types_info_[error.type()] = error; | 310 failed_data_types_info_[error.model_type()] = error; |
311 LOG(ERROR) << "Failed to associate models for " | 311 LOG(ERROR) << "Failed to associate models for " |
312 << syncer::ModelTypeToString(error.type()); | 312 << syncer::ModelTypeToString(error.model_type()); |
313 UMA_HISTOGRAM_ENUMERATION("Sync.ConfigureFailed", | 313 UMA_HISTOGRAM_ENUMERATION("Sync.ConfigureFailed", |
314 ModelTypeToHistogramInt(error.type()), | 314 ModelTypeToHistogramInt(error.model_type()), |
315 syncer::MODEL_TYPE_COUNT); | 315 syncer::MODEL_TYPE_COUNT); |
316 } | 316 } |
317 | 317 |
318 void ModelAssociationManager::TypeStartCallback( | 318 void ModelAssociationManager::TypeStartCallback( |
319 DataTypeController::StartResult start_result, | 319 DataTypeController::StartResult start_result, |
320 const syncer::SyncMergeResult& local_merge_result, | 320 const syncer::SyncMergeResult& local_merge_result, |
321 const syncer::SyncMergeResult& syncer_merge_result) { | 321 const syncer::SyncMergeResult& syncer_merge_result) { |
322 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 322 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
323 TRACE_EVENT_END0("sync", "ModelAssociation"); | 323 TRACE_EVENT_END0("sync", "ModelAssociation"); |
324 | 324 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 | 375 |
376 DVLOG(1) << "ModelAssociationManager: type start callback returned " | 376 DVLOG(1) << "ModelAssociationManager: type start callback returned " |
377 << start_result << " so calling LoadModelForNextType"; | 377 << start_result << " so calling LoadModelForNextType"; |
378 LoadModelForNextType(); | 378 LoadModelForNextType(); |
379 return; | 379 return; |
380 } | 380 } |
381 | 381 |
382 // Any other result requires reconfiguration. Pass it on through the callback. | 382 // Any other result requires reconfiguration. Pass it on through the callback. |
383 LOG(ERROR) << "Failed to configure " << started_dtc->name(); | 383 LOG(ERROR) << "Failed to configure " << started_dtc->name(); |
384 DCHECK(local_merge_result.error().IsSet()); | 384 DCHECK(local_merge_result.error().IsSet()); |
385 DCHECK_EQ(started_dtc->type(), local_merge_result.error().type()); | 385 DCHECK_EQ(started_dtc->type(), local_merge_result.error().model_type()); |
386 DataTypeManager::ConfigureStatus configure_status = | 386 DataTypeManager::ConfigureStatus configure_status = |
387 DataTypeManager::ABORTED; | 387 DataTypeManager::ABORTED; |
388 switch (start_result) { | 388 switch (start_result) { |
389 case DataTypeController::ABORTED: | 389 case DataTypeController::ABORTED: |
390 configure_status = DataTypeManager::ABORTED; | 390 configure_status = DataTypeManager::ABORTED; |
391 break; | 391 break; |
392 case DataTypeController::UNRECOVERABLE_ERROR: | 392 case DataTypeController::UNRECOVERABLE_ERROR: |
393 configure_status = DataTypeManager::UNRECOVERABLE_ERROR; | 393 configure_status = DataTypeManager::UNRECOVERABLE_ERROR; |
394 break; | 394 break; |
395 default: | 395 default: |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 } | 556 } |
557 return result; | 557 return result; |
558 } | 558 } |
559 | 559 |
560 base::OneShotTimer<ModelAssociationManager>* | 560 base::OneShotTimer<ModelAssociationManager>* |
561 ModelAssociationManager::GetTimerForTesting() { | 561 ModelAssociationManager::GetTimerForTesting() { |
562 return &timer_; | 562 return &timer_; |
563 } | 563 } |
564 | 564 |
565 } // namespace browser_sync | 565 } // namespace browser_sync |
OLD | NEW |