Skip to content

Commit

Permalink
[Sync] Add empty ModelTypeService and ModelTypeChangeProcessor interf…
Browse files Browse the repository at this point in the history
…aces.

BUG=536895

Review URL: https://codereview.chromium.org/1395393003

Cr-Commit-Position: refs/heads/master@{#353787}
  • Loading branch information
maxbogue authored and Commit bot committed Oct 13, 2015
1 parent c870f4c commit 9a31ed8
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 2 deletions.
4 changes: 4 additions & 0 deletions sync/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
13 changes: 13 additions & 0 deletions sync/api/model_type_change_processor.cc
Original file line number Diff line number Diff line change
@@ -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
22 changes: 22 additions & 0 deletions sync/api/model_type_change_processor.h
Original file line number Diff line number Diff line change
@@ -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_
13 changes: 13 additions & 0 deletions sync/api/model_type_service.cc
Original file line number Diff line number Diff line change
@@ -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
23 changes: 23 additions & 0 deletions sync/api/model_type_service.h
Original file line number Diff line number Diff line change
@@ -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_
7 changes: 5 additions & 2 deletions sync/internal_api/public/shared_model_type_processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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<ModelTypeStore> store);
Expand Down
4 changes: 4 additions & 0 deletions sync/sync.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 9a31ed8

Please sign in to comment.