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" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 | 14 #include "sync/internal_api/public/base/model_type.h" |
15 | 15 |
16 using content::BrowserThread; | 16 using content::BrowserThread; |
17 using syncer::ModelTypeSet; | 17 using syncer::ModelTypeSet; |
18 | 18 |
19 namespace browser_sync { | 19 namespace browser_sync { |
20 // The amount of time we wait for a datatype to load. If the type has | 20 // The amount of time we wait for a datatype to load. If the type has |
21 // not finished loading we move on to the next type. Once this type | 21 // not finished loading we move on to the next type. Once this type |
22 // finishes loading we will do a configure to associate this type. Note | 22 // finishes loading we will do a configure to associate this type. Note |
23 // that in most cases types finish loading before this timeout. | 23 // that in most cases types finish loading before this timeout. |
24 const int64 kDataTypeLoadWaitTimeInSeconds = 120; | 24 const int64 kDataTypeLoadWaitTimeInSeconds = 120; |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 return found_any; | 293 return found_any; |
294 } | 294 } |
295 | 295 |
296 void ModelAssociationManager::AppendToFailedDatatypesAndLogError( | 296 void ModelAssociationManager::AppendToFailedDatatypesAndLogError( |
297 DataTypeController::StartResult result, | 297 DataTypeController::StartResult result, |
298 const syncer::SyncError& error) { | 298 const syncer::SyncError& error) { |
299 failed_datatypes_info_.push_back(error); | 299 failed_datatypes_info_.push_back(error); |
300 LOG(ERROR) << "Failed to associate models for " | 300 LOG(ERROR) << "Failed to associate models for " |
301 << syncer::ModelTypeToString(error.type()); | 301 << syncer::ModelTypeToString(error.type()); |
302 UMA_HISTOGRAM_ENUMERATION("Sync.ConfigureFailed", | 302 UMA_HISTOGRAM_ENUMERATION("Sync.ConfigureFailed", |
303 error.type(), | 303 ModelTypeToHistogramInt(error.type()), |
304 syncer::MODEL_TYPE_COUNT); | 304 syncer::MODEL_TYPE_COUNT); |
305 } | 305 } |
306 | 306 |
307 void ModelAssociationManager::TypeStartCallback( | 307 void ModelAssociationManager::TypeStartCallback( |
308 DataTypeController::StartResult start_result, | 308 DataTypeController::StartResult start_result, |
309 const syncer::SyncMergeResult& local_merge_result, | 309 const syncer::SyncMergeResult& local_merge_result, |
310 const syncer::SyncMergeResult& syncer_merge_result) { | 310 const syncer::SyncMergeResult& syncer_merge_result) { |
311 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 311 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
312 TRACE_EVENT_END0("sync", "ModelAssociation"); | 312 TRACE_EVENT_END0("sync", "ModelAssociation"); |
313 | 313 |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 } | 551 } |
552 return result; | 552 return result; |
553 } | 553 } |
554 | 554 |
555 base::OneShotTimer<ModelAssociationManager>* | 555 base::OneShotTimer<ModelAssociationManager>* |
556 ModelAssociationManager::GetTimerForTesting() { | 556 ModelAssociationManager::GetTimerForTesting() { |
557 return &timer_; | 557 return &timer_; |
558 } | 558 } |
559 | 559 |
560 } // namespace browser_sync | 560 } // namespace browser_sync |
OLD | NEW |