From 9a31ed87f911535f60a5fad92e222ddaee114e2e Mon Sep 17 00:00:00 2001 From: maxbogue Date: Tue, 13 Oct 2015 11:15:37 -0700 Subject: [PATCH] [Sync] Add empty ModelTypeService and ModelTypeChangeProcessor interfaces. BUG=536895 Review URL: https://codereview.chromium.org/1395393003 Cr-Commit-Position: refs/heads/master@{#353787} --- sync/BUILD.gn | 4 ++++ sync/api/model_type_change_processor.cc | 13 +++++++++++ sync/api/model_type_change_processor.h | 22 ++++++++++++++++++ sync/api/model_type_service.cc | 13 +++++++++++ sync/api/model_type_service.h | 23 +++++++++++++++++++ .../public/shared_model_type_processor.h | 7 ++++-- sync/sync.gyp | 4 ++++ 7 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 sync/api/model_type_change_processor.cc create mode 100644 sync/api/model_type_change_processor.h create mode 100644 sync/api/model_type_service.cc create mode 100644 sync/api/model_type_service.h diff --git a/sync/BUILD.gn b/sync/BUILD.gn index 9fdc65f431ab40..d1ea271d56a3da 100644 --- a/sync/BUILD.gn +++ b/sync/BUILD.gn @@ -25,6 +25,10 @@ source_set("sync_core") { "api/attachments/attachment_store.h", "api/attachments/attachment_store_backend.cc", "api/attachments/attachment_store_backend.h", + "api/model_type_change_processor.cc", + "api/model_type_change_processor.h", + "api/model_type_service.cc", + "api/model_type_service.h", "api/model_type_store.cc", "api/model_type_store.h", "api/string_ordinal.h", diff --git a/sync/api/model_type_change_processor.cc b/sync/api/model_type_change_processor.cc new file mode 100644 index 00000000000000..4e74065da49176 --- /dev/null +++ b/sync/api/model_type_change_processor.cc @@ -0,0 +1,13 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "sync/api/model_type_change_processor.h" + +namespace syncer_v2 { + +ModelTypeChangeProcessor::ModelTypeChangeProcessor() {} + +ModelTypeChangeProcessor::~ModelTypeChangeProcessor() {} + +} // namespace syncer_v2 diff --git a/sync/api/model_type_change_processor.h b/sync/api/model_type_change_processor.h new file mode 100644 index 00000000000000..85f8d16120b126 --- /dev/null +++ b/sync/api/model_type_change_processor.h @@ -0,0 +1,22 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYNC_API_MODEL_TYPE_CHANGE_PROCESSOR_H_ +#define SYNC_API_MODEL_TYPE_CHANGE_PROCESSOR_H_ + +#include "sync/base/sync_export.h" + +namespace syncer_v2 { + +// Interface used by the ModelTypeService to inform sync of local +// changes. +class SYNC_EXPORT ModelTypeChangeProcessor { + public: + ModelTypeChangeProcessor(); + virtual ~ModelTypeChangeProcessor(); +}; + +} // namespace syncer_v2 + +#endif // SYNC_API_MODEL_TYPE_CHANGE_PROCESSOR_H_ diff --git a/sync/api/model_type_service.cc b/sync/api/model_type_service.cc new file mode 100644 index 00000000000000..61ea8600805bd1 --- /dev/null +++ b/sync/api/model_type_service.cc @@ -0,0 +1,13 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "sync/api/model_type_service.h" + +namespace syncer_v2 { + +ModelTypeService::ModelTypeService() {} + +ModelTypeService::~ModelTypeService() {} + +} // namespace syncer_v2 diff --git a/sync/api/model_type_service.h b/sync/api/model_type_service.h new file mode 100644 index 00000000000000..d01dc87181f3ca --- /dev/null +++ b/sync/api/model_type_service.h @@ -0,0 +1,23 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SYNC_API_MODEL_TYPE_SERVICE_H_ +#define SYNC_API_MODEL_TYPE_SERVICE_H_ + +#include "sync/base/sync_export.h" + +namespace syncer_v2 { + +// Interface implemented by model types to receive updates from sync via the +// SharedModelTypeProcessor. Provides a way for sync to update the data and +// metadata for entities, as well as the model type state. +class SYNC_EXPORT ModelTypeService { + public: + ModelTypeService(); + virtual ~ModelTypeService(); +}; + +} // namespace syncer_v2 + +#endif // SYNC_API_MODEL_TYPE_SERVICE_H_ diff --git a/sync/internal_api/public/shared_model_type_processor.h b/sync/internal_api/public/shared_model_type_processor.h index d8a7e2b763aaef..86638a1701706c 100644 --- a/sync/internal_api/public/shared_model_type_processor.h +++ b/sync/internal_api/public/shared_model_type_processor.h @@ -9,6 +9,7 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/threading/non_thread_safe.h" +#include "sync/api/model_type_change_processor.h" #include "sync/base/sync_export.h" #include "sync/internal_api/public/base/model_type.h" #include "sync/internal_api/public/model_type_processor.h" @@ -23,8 +24,10 @@ class ModelTypeStore; // A sync component embedded on the synced type's thread that helps to handle // communication between sync and model type threads. -class SYNC_EXPORT_PRIVATE SharedModelTypeProcessor : public ModelTypeProcessor, - base::NonThreadSafe { +class SYNC_EXPORT_PRIVATE SharedModelTypeProcessor + : public ModelTypeProcessor, + public ModelTypeChangeProcessor, + base::NonThreadSafe { public: SharedModelTypeProcessor(syncer::ModelType type, base::WeakPtr store); diff --git a/sync/sync.gyp b/sync/sync.gyp index 4ad6b36d35720c..1a1a089fe63010 100644 --- a/sync/sync.gyp +++ b/sync/sync.gyp @@ -76,6 +76,10 @@ 'api/attachments/attachment_store.h', 'api/attachments/attachment_store_backend.cc', 'api/attachments/attachment_store_backend.h', + 'api/model_type_change_processor.cc', + 'api/model_type_change_processor.h', + 'api/model_type_service.cc', + 'api/model_type_service.h', 'api/model_type_store.cc', 'api/model_type_store.h', 'api/string_ordinal.h',