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_type_controller.h" | 5 #include "components/sync/driver/model_type_controller.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
14 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
15 #include "components/sync/api/data_type_error_handler_impl.h" | |
16 #include "components/sync/api/model_type_change_processor.h" | |
17 #include "components/sync/api/model_type_service.h" | |
18 #include "components/sync/api/sync_error.h" | |
19 #include "components/sync/api/sync_merge_result.h" | |
20 #include "components/sync/base/bind_to_task_runner.h" | 15 #include "components/sync/base/bind_to_task_runner.h" |
21 #include "components/sync/base/data_type_histogram.h" | 16 #include "components/sync/base/data_type_histogram.h" |
22 #include "components/sync/core/activation_context.h" | 17 #include "components/sync/core/activation_context.h" |
23 #include "components/sync/driver/backend_data_type_configurer.h" | 18 #include "components/sync/driver/backend_data_type_configurer.h" |
24 #include "components/sync/driver/sync_client.h" | 19 #include "components/sync/driver/sync_client.h" |
| 20 #include "components/sync/model/data_type_error_handler_impl.h" |
| 21 #include "components/sync/model/model_type_change_processor.h" |
| 22 #include "components/sync/model/model_type_service.h" |
| 23 #include "components/sync/model/sync_error.h" |
| 24 #include "components/sync/model/sync_merge_result.h" |
25 | 25 |
26 namespace syncer { | 26 namespace syncer { |
27 | 27 |
28 namespace { | 28 namespace { |
29 | 29 |
30 SharedModelTypeProcessor* GetProcessorFromService( | 30 SharedModelTypeProcessor* GetProcessorFromService( |
31 const base::WeakPtr<ModelTypeService>& service) { | 31 const base::WeakPtr<ModelTypeService>& service) { |
32 if (!service.get()) { | 32 if (!service.get()) { |
33 LOG(WARNING) << "ModelTypeService destroyed before DTC was stopped."; | 33 LOG(WARNING) << "ModelTypeService destroyed before DTC was stopped."; |
34 return nullptr; | 34 return nullptr; |
35 } | 35 } |
36 // TODO(gangwu): Casting should happen "near" where the processor factory has | 36 // TODO(gangwu): Casting should happen "near" where the processor factory has |
37 // code that instantiates a new processor. | 37 // code that instantiates a new processor. |
38 SharedModelTypeProcessor* processor = | 38 SharedModelTypeProcessor* processor = |
39 (SharedModelTypeProcessor*)service->change_processor(); | 39 static_cast<SharedModelTypeProcessor*>(service->change_processor()); |
40 if (!processor) { | 40 if (!processor) { |
41 LOG(WARNING) | 41 LOG(WARNING) |
42 << "SharedModelTypeProcessor destroyed before DTC was stopped."; | 42 << "SharedModelTypeProcessor destroyed before DTC was stopped."; |
43 return nullptr; | 43 return nullptr; |
44 } | 44 } |
45 return processor; | 45 return processor; |
46 } | 46 } |
47 | 47 |
48 // This function should only be run on model thread | 48 // This function should only be run on model thread |
49 void CallProcessorGetAllNodes( | 49 void CallProcessorGetAllNodes( |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 UMA_HISTOGRAM_ENUMERATION("Sync.DataTypeStartFailures", | 263 UMA_HISTOGRAM_ENUMERATION("Sync.DataTypeStartFailures", |
264 ModelTypeToHistogramInt(type()), MODEL_TYPE_COUNT); | 264 ModelTypeToHistogramInt(type()), MODEL_TYPE_COUNT); |
265 #define PER_DATA_TYPE_MACRO(type_str) \ | 265 #define PER_DATA_TYPE_MACRO(type_str) \ |
266 UMA_HISTOGRAM_ENUMERATION("Sync." type_str "ConfigureFailure", result, \ | 266 UMA_HISTOGRAM_ENUMERATION("Sync." type_str "ConfigureFailure", result, \ |
267 MAX_CONFIGURE_RESULT); | 267 MAX_CONFIGURE_RESULT); |
268 SYNC_DATA_TYPE_HISTOGRAM(type()); | 268 SYNC_DATA_TYPE_HISTOGRAM(type()); |
269 #undef PER_DATA_TYPE_MACRO | 269 #undef PER_DATA_TYPE_MACRO |
270 } | 270 } |
271 | 271 |
272 } // namespace syncer | 272 } // namespace syncer |
OLD | NEW |