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/data_type_manager.h" | 5 #include "components/sync_driver/data_type_manager.h" |
6 #include "components/sync_driver/data_type_status_table.h" | 6 #include "components/sync_driver/data_type_status_table.h" |
7 | 7 |
8 namespace sync_driver { | 8 namespace sync_driver { |
9 | 9 |
10 namespace { | 10 namespace { |
11 | 11 |
12 syncer::ModelTypeSet GetTypesFromErrorMap( | 12 syncer::ModelTypeSet GetTypesFromErrorMap( |
13 const DataTypeStatusTable::TypeErrorMap& errors) { | 13 const DataTypeStatusTable::TypeErrorMap& errors) { |
14 syncer::ModelTypeSet result; | 14 syncer::ModelTypeSet result; |
15 for (DataTypeStatusTable::TypeErrorMap::const_iterator it = errors.begin(); | 15 for (DataTypeStatusTable::TypeErrorMap::const_iterator it = errors.begin(); |
16 it != errors.end(); ++it) { | 16 it != errors.end(); ++it) { |
17 DCHECK(!result.Has(it->first)); | 17 DCHECK(!result.Has(it->first)); |
18 result.Put(it->first); | 18 result.Put(it->first); |
19 } | 19 } |
20 return result; | 20 return result; |
21 } | 21 } |
22 | 22 |
23 } // namespace | 23 } // namespace |
24 | 24 |
25 DataTypeStatusTable::DataTypeStatusTable() { | 25 DataTypeStatusTable::DataTypeStatusTable() { |
26 } | 26 } |
27 | 27 |
| 28 DataTypeStatusTable::DataTypeStatusTable(const DataTypeStatusTable& other) = |
| 29 default; |
| 30 |
28 DataTypeStatusTable::~DataTypeStatusTable() { | 31 DataTypeStatusTable::~DataTypeStatusTable() { |
29 } | 32 } |
30 | 33 |
31 void DataTypeStatusTable::UpdateFailedDataTypes(const TypeErrorMap& errors) { | 34 void DataTypeStatusTable::UpdateFailedDataTypes(const TypeErrorMap& errors) { |
32 DVLOG(1) << "Setting " << errors.size() << " new failed types."; | 35 DVLOG(1) << "Setting " << errors.size() << " new failed types."; |
33 | 36 |
34 for (TypeErrorMap::const_iterator iter = errors.begin(); iter != errors.end(); | 37 for (TypeErrorMap::const_iterator iter = errors.begin(); iter != errors.end(); |
35 ++iter) { | 38 ++iter) { |
36 syncer::SyncError::ErrorType failure_type = iter->second.error_type(); | 39 syncer::SyncError::ErrorType failure_type = iter->second.error_type(); |
37 switch (failure_type) { | 40 switch (failure_type) { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 syncer::SyncError DataTypeStatusTable::GetUnrecoverableError() const { | 140 syncer::SyncError DataTypeStatusTable::GetUnrecoverableError() const { |
138 // Just return the first one. It is assumed all the unrecoverable errors | 141 // Just return the first one. It is assumed all the unrecoverable errors |
139 // have the same cause. The others are just tracked to know which types | 142 // have the same cause. The others are just tracked to know which types |
140 // were involved. | 143 // were involved. |
141 return (unrecoverable_errors_.empty() | 144 return (unrecoverable_errors_.empty() |
142 ? syncer::SyncError() | 145 ? syncer::SyncError() |
143 : unrecoverable_errors_.begin()->second); | 146 : unrecoverable_errors_.begin()->second); |
144 } | 147 } |
145 | 148 |
146 } // namespace sync_driver | 149 } // namespace sync_driver |
OLD | NEW |