Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Unified Diff: components/sync/driver/model_type_controller.cc

Issue 2412193002: [Sync] Move SharedModelTypeProcessor to model_impl/. (Closed)
Patch Set: Address comment from Sky. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/sync/driver/model_type_controller.cc
diff --git a/components/sync/driver/model_type_controller.cc b/components/sync/driver/model_type_controller.cc
index ec09ccad50d504fe78d0bf609c001e581fa1b3b7..b549af5c697fd884e1f54a0db75962498f9599e5 100644
--- a/components/sync/driver/model_type_controller.cc
+++ b/components/sync/driver/model_type_controller.cc
@@ -19,54 +19,13 @@
#include "components/sync/driver/sync_client.h"
#include "components/sync/model/data_type_error_handler_impl.h"
#include "components/sync/model/model_type_change_processor.h"
+#include "components/sync/model/model_type_debug_info.h"
#include "components/sync/model/model_type_service.h"
#include "components/sync/model/sync_error.h"
#include "components/sync/model/sync_merge_result.h"
namespace syncer {
-namespace {
-
-SharedModelTypeProcessor* GetProcessorFromService(
- const base::WeakPtr<ModelTypeService>& service) {
- if (!service.get()) {
- LOG(WARNING) << "ModelTypeService destroyed before DTC was stopped.";
- return nullptr;
- }
- // TODO(gangwu): Casting should happen "near" where the processor factory has
- // code that instantiates a new processor.
- SharedModelTypeProcessor* processor =
- static_cast<SharedModelTypeProcessor*>(service->change_processor());
- if (!processor) {
- LOG(WARNING)
- << "SharedModelTypeProcessor destroyed before DTC was stopped.";
- return nullptr;
- }
- return processor;
-}
-
-// This function should only be run on model thread
-void CallProcessorGetAllNodes(
- const base::WeakPtr<ModelTypeService>& service,
- const ModelTypeController::AllNodesCallback& callback) {
- SharedModelTypeProcessor* processor = GetProcessorFromService(service);
- if (processor) {
- processor->GetAllNodes(callback);
- }
-}
-
-// This function should only be run on model thread
-void CallProcessorGetStatusCounters(
- const base::WeakPtr<ModelTypeService>& service,
- const ModelTypeController::StatusCountersCallback& callback) {
- SharedModelTypeProcessor* processor = GetProcessorFromService(service);
- if (processor) {
- processor->GetStatusCounters(callback);
- }
-}
-
-} // namespace
-
ModelTypeController::ModelTypeController(
ModelType type,
const base::Closure& dump_stack,
@@ -119,7 +78,7 @@ void ModelTypeController::GetAllNodes(const AllNodesCallback& callback) {
base::WeakPtr<ModelTypeService> service =
sync_client_->GetModelTypeServiceForType(type());
model_thread_->PostTask(FROM_HERE,
- base::Bind(&CallProcessorGetAllNodes, service,
+ base::Bind(&ModelTypeDebugInfo::GetAllNodes, service,
BindToCurrentThread(callback)));
}
@@ -127,8 +86,9 @@ void ModelTypeController::GetStatusCounters(
const StatusCountersCallback& callback) {
base::WeakPtr<ModelTypeService> service =
sync_client_->GetModelTypeServiceForType(type());
- model_thread_->PostTask(FROM_HERE, base::Bind(&CallProcessorGetStatusCounters,
- service, callback));
+ model_thread_->PostTask(
+ FROM_HERE,
+ base::Bind(&ModelTypeDebugInfo::GetStatusCounters, service, callback));
}
void ModelTypeController::LoadModelsDone(ConfigureResult result,

Powered by Google App Engine
This is Rietveld 408576698