| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/frontend_data_type_controller.h" | 5 #include "chrome/browser/sync/glue/frontend_data_type_controller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/sync/api/sync_error.h" | 9 #include "chrome/browser/sync/api/sync_error.h" |
| 10 #include "chrome/browser/sync/glue/change_processor.h" | 10 #include "chrome/browser/sync/glue/change_processor.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 base::TimeTicks start_time = base::TimeTicks::Now(); | 95 base::TimeTicks start_time = base::TimeTicks::Now(); |
| 96 SyncError error; | 96 SyncError error; |
| 97 bool merge_success = model_associator()->AssociateModels(&error); | 97 bool merge_success = model_associator()->AssociateModels(&error); |
| 98 RecordAssociationTime(base::TimeTicks::Now() - start_time); | 98 RecordAssociationTime(base::TimeTicks::Now() - start_time); |
| 99 if (!merge_success) { | 99 if (!merge_success) { |
| 100 StartFailed(ASSOCIATION_FAILED, error); | 100 StartFailed(ASSOCIATION_FAILED, error); |
| 101 return false; | 101 return false; |
| 102 } | 102 } |
| 103 | 103 |
| 104 sync_service_->ActivateDataType(type(), model_safe_group(), | 104 sync_service_->ActivateDataType(type(), model_safe_group(), |
| 105 change_processor_.get()); | 105 change_processor()); |
| 106 state_ = RUNNING; | 106 state_ = RUNNING; |
| 107 // FinishStart() invokes the DataTypeManager callback, which can lead to a | 107 // FinishStart() invokes the DataTypeManager callback, which can lead to a |
| 108 // call to Stop() if one of the other data types being started generates an | 108 // call to Stop() if one of the other data types being started generates an |
| 109 // error. | 109 // error. |
| 110 FinishStart(!sync_has_nodes ? OK_FIRST_RUN : OK); | 110 FinishStart(!sync_has_nodes ? OK_FIRST_RUN : OK); |
| 111 // Return false if we're not in the RUNNING state (due to Stop() being called | 111 // Return false if we're not in the RUNNING state (due to Stop() being called |
| 112 // from FinishStart()). | 112 // from FinishStart()). |
| 113 // TODO(zea/atwilson): Should we maybe move the call to FinishStart() out of | 113 // TODO(zea/atwilson): Should we maybe move the call to FinishStart() out of |
| 114 // Associate() and into Start(), so we don't need this logic here? It seems | 114 // Associate() and into Start(), so we don't need this logic here? It seems |
| 115 // cleaner to call FinishStart() from Start(). | 115 // cleaner to call FinishStart() from Start(). |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 ChangeProcessor* FrontendDataTypeController::change_processor() const { | 207 ChangeProcessor* FrontendDataTypeController::change_processor() const { |
| 208 return change_processor_.get(); | 208 return change_processor_.get(); |
| 209 } | 209 } |
| 210 | 210 |
| 211 void FrontendDataTypeController::set_change_processor( | 211 void FrontendDataTypeController::set_change_processor( |
| 212 ChangeProcessor* change_processor) { | 212 ChangeProcessor* change_processor) { |
| 213 change_processor_.reset(change_processor); | 213 change_processor_.reset(change_processor); |
| 214 } | 214 } |
| 215 | 215 |
| 216 } // namespace browser_sync | 216 } // namespace browser_sync |
| OLD | NEW |