| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/sync_driver/model_association_manager.h" | 5 #include "components/sync_driver/model_association_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
| 7 #include <algorithm> | 10 #include <algorithm> |
| 8 #include <functional> | 11 #include <functional> |
| 9 | 12 |
| 10 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/macros.h" |
| 11 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 12 #include "base/metrics/histogram_macros.h" | 16 #include "base/metrics/histogram_macros.h" |
| 13 #include "base/trace_event/trace_event.h" | 17 #include "base/trace_event/trace_event.h" |
| 14 #include "sync/api/sync_merge_result.h" | 18 #include "sync/api/sync_merge_result.h" |
| 15 #include "sync/internal_api/public/base/model_type.h" | 19 #include "sync/internal_api/public/base/model_type.h" |
| 16 | 20 |
| 17 using syncer::ModelTypeSet; | 21 using syncer::ModelTypeSet; |
| 18 | 22 |
| 19 namespace sync_driver { | 23 namespace sync_driver { |
| 20 | 24 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 }; | 69 }; |
| 66 | 70 |
| 67 static_assert(arraysize(kStartOrder) == | 71 static_assert(arraysize(kStartOrder) == |
| 68 syncer::MODEL_TYPE_COUNT - syncer::FIRST_REAL_MODEL_TYPE, | 72 syncer::MODEL_TYPE_COUNT - syncer::FIRST_REAL_MODEL_TYPE, |
| 69 "kStartOrder must have MODEL_TYPE_COUNT - " | 73 "kStartOrder must have MODEL_TYPE_COUNT - " |
| 70 "FIRST_REAL_MODEL_TYPE elements"); | 74 "FIRST_REAL_MODEL_TYPE elements"); |
| 71 | 75 |
| 72 // The amount of time we wait for association to finish. If some types haven't | 76 // The amount of time we wait for association to finish. If some types haven't |
| 73 // finished association by the time, DataTypeManager is notified of the | 77 // finished association by the time, DataTypeManager is notified of the |
| 74 // unfinished types. | 78 // unfinished types. |
| 75 const int64 kAssociationTimeOutInSeconds = 600; | 79 const int64_t kAssociationTimeOutInSeconds = 600; |
| 76 | 80 |
| 77 syncer::DataTypeAssociationStats BuildAssociationStatsFromMergeResults( | 81 syncer::DataTypeAssociationStats BuildAssociationStatsFromMergeResults( |
| 78 const syncer::SyncMergeResult& local_merge_result, | 82 const syncer::SyncMergeResult& local_merge_result, |
| 79 const syncer::SyncMergeResult& syncer_merge_result, | 83 const syncer::SyncMergeResult& syncer_merge_result, |
| 80 const base::TimeDelta& association_wait_time, | 84 const base::TimeDelta& association_wait_time, |
| 81 const base::TimeDelta& association_time) { | 85 const base::TimeDelta& association_time) { |
| 82 DCHECK_EQ(local_merge_result.model_type(), syncer_merge_result.model_type()); | 86 DCHECK_EQ(local_merge_result.model_type(), syncer_merge_result.model_type()); |
| 83 syncer::DataTypeAssociationStats stats; | 87 syncer::DataTypeAssociationStats stats; |
| 84 stats.had_error = local_merge_result.error().IsSet() || | 88 stats.had_error = local_merge_result.error().IsSet() || |
| 85 syncer_merge_result.error().IsSet(); | 89 syncer_merge_result.error().IsSet(); |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 state_ = new_state; | 421 state_ = new_state; |
| 418 | 422 |
| 419 delegate_->OnModelAssociationDone(result); | 423 delegate_->OnModelAssociationDone(result); |
| 420 } | 424 } |
| 421 | 425 |
| 422 base::OneShotTimer* ModelAssociationManager::GetTimerForTesting() { | 426 base::OneShotTimer* ModelAssociationManager::GetTimerForTesting() { |
| 423 return &timer_; | 427 return &timer_; |
| 424 } | 428 } |
| 425 | 429 |
| 426 } // namespace sync_driver | 430 } // namespace sync_driver |
| OLD | NEW |