OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "sync/api/model_type_service.h" | 5 #include "sync/api/model_type_service.h" |
6 | 6 |
7 namespace syncer_v2 { | 7 namespace syncer_v2 { |
8 | 8 |
9 ModelTypeService::ModelTypeService() {} | 9 ModelTypeService::ModelTypeService() {} |
10 | 10 |
11 ModelTypeService::~ModelTypeService() {} | 11 ModelTypeService::~ModelTypeService() {} |
12 | 12 |
13 ModelTypeChangeProcessor* ModelTypeService::change_processor() const { | 13 ModelTypeChangeProcessor* ModelTypeService::change_processor() const { |
14 return change_processor_.get(); | 14 return change_processor_.get(); |
15 } | 15 } |
16 | 16 |
17 void ModelTypeService::set_change_processor( | 17 ModelTypeChangeProcessor* ModelTypeService::InitializeProcessor( |
18 scoped_ptr<ModelTypeChangeProcessor> change_processor) { | 18 const SharedProcessorFactory& shared_processor_factory) { |
19 DCHECK(!change_processor_); | 19 DCHECK(!change_processor_.get()); |
20 change_processor_.swap(change_processor); | 20 change_processor_.reset(shared_processor_factory.Run(this).release()); |
21 OnChangeProcessorSet(); | 21 OnChangeProcessorSet(); |
| 22 |
| 23 return change_processor_.get(); |
22 } | 24 } |
23 | 25 |
24 void ModelTypeService::clear_change_processor() { | 26 void ModelTypeService::clear_change_processor() { |
25 change_processor_.reset(); | 27 change_processor_.reset(); |
26 } | 28 } |
27 | 29 |
28 } // namespace syncer_v2 | 30 } // namespace syncer_v2 |
OLD | NEW |