diff options
author | maxbogue <maxbogue@chromium.org> | 2015-11-20 11:42:43 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-20 19:43:45 +0000 |
commit | bccc5c48c5345726cf02863e19f80151af95bfc4 (patch) | |
tree | 4d758b1cf8f5620f240c1e2449f335f260bdf0a1 | |
parent | 38152e7ee5c9daace6e192d9478ad01740defaee (diff) | |
download | chromium_src-bccc5c48c5345726cf02863e19f80151af95bfc4.zip chromium_src-bccc5c48c5345726cf02863e19f80151af95bfc4.tar.gz chromium_src-bccc5c48c5345726cf02863e19f80151af95bfc4.tar.bz2 |
[Sync] Adding USS interfaces for processor-service communication.
Copying Sky's patch since he's out.
BUG=536895,543405
patch from issue 1444083002 at patchset 20001 (http://crrev.com/1444083002#ps20001)
Review URL: https://codereview.chromium.org/1462233002
Cr-Commit-Position: refs/heads/master@{#360885}
-rw-r--r-- | components/sync_driver/device_info_service.cc | 73 | ||||
-rw-r--r-- | components/sync_driver/device_info_service.h | 31 | ||||
-rw-r--r-- | sync/BUILD.gn | 3 | ||||
-rw-r--r-- | sync/api/data_batch.h | 21 | ||||
-rw-r--r-- | sync/api/entity_data.h | 1 | ||||
-rw-r--r-- | sync/api/metadata_batch.h | 21 | ||||
-rw-r--r-- | sync/api/metadata_changes.h | 21 | ||||
-rw-r--r-- | sync/api/model_type_change_processor.h | 20 | ||||
-rw-r--r-- | sync/api/model_type_service.cc | 14 | ||||
-rw-r--r-- | sync/api/model_type_service.h | 61 | ||||
-rw-r--r-- | sync/internal_api/public/model_type_processor.h | 4 | ||||
-rw-r--r-- | sync/internal_api/public/shared_model_type_processor.h | 43 | ||||
-rw-r--r-- | sync/internal_api/shared_model_type_processor.cc | 30 | ||||
-rw-r--r-- | sync/internal_api/shared_model_type_processor_unittest.cc | 6 | ||||
-rw-r--r-- | sync/sync.gyp | 3 |
15 files changed, 247 insertions, 105 deletions
diff --git a/components/sync_driver/device_info_service.cc b/components/sync_driver/device_info_service.cc index b257518..fb45112 100644 --- a/components/sync_driver/device_info_service.cc +++ b/components/sync_driver/device_info_service.cc @@ -4,6 +4,8 @@ #include "components/sync_driver/device_info_service.h" +#include <vector> + #include "base/bind.h" #include "sync/api/model_type_change_processor.h" #include "sync/api/sync_error.h" @@ -32,69 +34,42 @@ DeviceInfoService::DeviceInfoService( DeviceInfoService::~DeviceInfoService() {} -syncer::SyncError DeviceInfoService::ApplySyncChanges() { - // TODO(skym): For every model change, if not local, apply to memory + disk. - // TODO(skym): For ever entity metadata change, apply to disk. - // TODO(skym): Apply type metadata to disk. - return syncer::SyncError(); -} - -syncer::SyncError DeviceInfoService::LoadMetadata() { - // TODO(skym): Read out metadata from disk. - return syncer::SyncError(); -} - -syncer::SyncError DeviceInfoService::UpdateMetadata() { - // TODO(skym): Persist metadata to disk. - return syncer::SyncError(); +syncer_v2::MetadataChanges* DeviceInfoService::CreateMetadataChanges() { + // TODO(skym): Implementation. + return nullptr; } -syncer::SyncError DeviceInfoService::GetData() { - // TODO(skym): This is tricky. We're currently indexing data in memory by - // cache_guid, not client tags. And we cannot change this, because they're not - // equal on old clients. So maybe O(n*m) iterating through our map for every - // peice of data we were asked for? Alternative we could make a set, and do - // O(n + m). Another approach would to have two maps, which one ruling - // ownership. Or we could just read out of disk for this, instead of memory. +syncer::SyncError DeviceInfoService::MergeSyncData( + syncer_v2::MetadataChanges* metadata_changes, + syncer_v2::EntityDataList entity_data_list) { + // TODO(skym): Implementation. return syncer::SyncError(); } -syncer::SyncError DeviceInfoService::GetAllData() { - // TODO(skym): Return all data from memory, unless we're not initialized. +syncer::SyncError DeviceInfoService::ApplySyncChanges( + syncer_v2::MetadataChanges* metadata_changes, + syncer_v2::EntityDataList entity_data_list) { + // TODO(skym): Implementation. return syncer::SyncError(); } -syncer::SyncError DeviceInfoService::ClearMetadata() { - // We act a little differently than most sync services here. All functionality - // is to be shutdown and stopped, and all data is to be deleted. - - bool was_syncing = IsSyncing(); - - all_data_.clear(); - clear_local_device_backup_time(); - clear_change_processor(); - - if (was_syncing) { - NotifyObservers(); - } - - // TODO(skym): Remove all data that's been persisted to storage. - // TODO(skym): Somehow remember we're no longer intialize. - - return syncer::SyncError(); +void DeviceInfoService::LoadMetadata(MetadataCallback callback) { + // TODO(skym): Implementation. } -syncer_v2::ModelTypeChangeProcessor* DeviceInfoService::get_change_processor() { - return change_processor_.get(); +void DeviceInfoService::GetData(ClientKeyList client_keys, + DataCallback callback) { + // TODO(skym): Implementation. } -void DeviceInfoService::set_change_processor( - scoped_ptr<syncer_v2::ModelTypeChangeProcessor> change_processor) { - change_processor_.swap(change_processor); +void DeviceInfoService::GetAllData(DataCallback callback) { + // TODO(skym): Implementation. } -void DeviceInfoService::clear_change_processor() { - change_processor_.reset(); +std::string DeviceInfoService::GetClientTag( + const syncer_v2::EntityData* entity_data) { + // TODO(skym): Implementation. + return ""; } bool DeviceInfoService::IsSyncing() const { diff --git a/components/sync_driver/device_info_service.h b/components/sync_driver/device_info_service.h index 47d334a..af57d3c 100644 --- a/components/sync_driver/device_info_service.h +++ b/components/sync_driver/device_info_service.h @@ -6,11 +6,11 @@ #define COMPONENTS_SYNC_DRIVER_DEVICE_INFO_SERVICE_H_ #include <string> +#include <vector> #include "base/containers/scoped_ptr_map.h" #include "base/macros.h" #include "base/memory/scoped_ptr.h" -#include "base/memory/scoped_vector.h" #include "base/observer_list.h" #include "components/sync_driver/device_info_tracker.h" #include "components/sync_driver/local_device_info_provider.h" @@ -30,8 +30,6 @@ class DeviceInfoSpecifics; namespace sync_driver_v2 { -class ModelTypeChangeProcessor; - // USS service implementation for DEVICE_INFO model type. Handles storage of // device info and associated sync metadata, applying/merging foreign changes, // and allows public read access. @@ -42,19 +40,18 @@ class DeviceInfoService : public syncer_v2::ModelTypeService, sync_driver::LocalDeviceInfoProvider* local_device_info_provider); ~DeviceInfoService() override; - // TODO(skym): Update once these are added to ModelTypeService interface. // ModelTypeService implementation. - syncer::SyncError ApplySyncChanges(); - syncer::SyncError LoadMetadata(); - syncer::SyncError UpdateMetadata(); - syncer::SyncError GetData(); - syncer::SyncError GetAllData(); - syncer::SyncError ClearMetadata(); - // TODO(skym): See crbug/547087, do we need all these accessors? - syncer_v2::ModelTypeChangeProcessor* get_change_processor(); - void set_change_processor( - scoped_ptr<syncer_v2::ModelTypeChangeProcessor> change_processor); - void clear_change_processor(); + syncer_v2::MetadataChanges* CreateMetadataChanges() override; + syncer::SyncError MergeSyncData( + syncer_v2::MetadataChanges* metadata_changes, + syncer_v2::EntityDataList entity_data_list) override; + syncer::SyncError ApplySyncChanges( + syncer_v2::MetadataChanges* metadata_changes, + syncer_v2::EntityDataList entity_data_list) override; + void LoadMetadata(MetadataCallback callback) override; + void GetData(ClientKeyList client_keys, DataCallback callback) override; + void GetAllData(DataCallback callback) override; + std::string GetClientTag(const syncer_v2::EntityData* entity_data) override; // DeviceInfoTracker implementation. bool IsSyncing() const override; @@ -84,6 +81,7 @@ class DeviceInfoService : public syncer_v2::ModelTypeService, void StoreSpecifics(scoped_ptr<sync_pb::DeviceInfoSpecifics> specifics); // Delete SyncData from the cache. void DeleteSpecifics(const std::string& client_id); + // Notify all registered observers. void NotifyObservers(); @@ -107,9 +105,6 @@ class DeviceInfoService : public syncer_v2::ModelTypeService, // |local_device_info_provider_| isn't owned. const sync_driver::LocalDeviceInfoProvider* const local_device_info_provider_; - // Recieves ownership in set_change_processor(...). - scoped_ptr<syncer_v2::ModelTypeChangeProcessor> change_processor_; - // TODO(skym): Switch to use client tag hash instead of cache guid as key. // Cache of all syncable and local data, stored by device cache guid. typedef base::ScopedPtrMap<std::string, diff --git a/sync/BUILD.gn b/sync/BUILD.gn index 9f064b5..48de0de 100644 --- a/sync/BUILD.gn +++ b/sync/BUILD.gn @@ -25,8 +25,11 @@ source_set("sync_core") { "api/attachments/attachment_store.h", "api/attachments/attachment_store_backend.cc", "api/attachments/attachment_store_backend.h", + "api/data_batch.h", "api/entity_data.cc", "api/entity_data.h", + "api/metadata_batch.h", + "api/metadata_changes.h", "api/model_type_change_processor.cc", "api/model_type_change_processor.h", "api/model_type_service.cc", diff --git a/sync/api/data_batch.h b/sync/api/data_batch.h new file mode 100644 index 0000000..63359cf --- /dev/null +++ b/sync/api/data_batch.h @@ -0,0 +1,21 @@ +// 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_DATA_BATCH_H_ +#define SYNC_API_DATA_BATCH_H_ + +#include "sync/base/sync_export.h" + +namespace syncer_v2 { + +// Interface used by the processor and service to communicate about data. +class SYNC_EXPORT DataBatch { + public: + DataBatch() {} + virtual ~DataBatch() {} +}; + +} // namespace syncer_v2 + +#endif // SYNC_API_DATA_BATCH_H_ diff --git a/sync/api/entity_data.h b/sync/api/entity_data.h index 66a6a99..4fe88510 100644 --- a/sync/api/entity_data.h +++ b/sync/api/entity_data.h @@ -25,6 +25,7 @@ struct SYNC_EXPORT EntityDataTraits { }; typedef syncer::ProtoValuePtr<EntityData, EntityDataTraits> EntityDataPtr; +typedef std::vector<EntityDataPtr> EntityDataList; // A light-weight container for sync entity data which represents either // local data created on the ModelTypeService side or remote data created diff --git a/sync/api/metadata_batch.h b/sync/api/metadata_batch.h new file mode 100644 index 0000000..56ffffb --- /dev/null +++ b/sync/api/metadata_batch.h @@ -0,0 +1,21 @@ +// 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_METADATA_BATCH_H_ +#define SYNC_API_METADATA_BATCH_H_ + +#include "sync/base/sync_export.h" + +namespace syncer_v2 { + +// Interface used by the processor and service to communicate about metadata. +class SYNC_EXPORT MetadataBatch { + public: + MetadataBatch() {} + virtual ~MetadataBatch() {} +}; + +} // namespace syncer_v2 + +#endif // SYNC_API_METADATA_BATCH_H_ diff --git a/sync/api/metadata_changes.h b/sync/api/metadata_changes.h new file mode 100644 index 0000000..a3d4d3b --- /dev/null +++ b/sync/api/metadata_changes.h @@ -0,0 +1,21 @@ +// 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_METADATA_CHANGES_H_ +#define SYNC_API_METADATA_CHANGES_H_ + +#include "sync/base/sync_export.h" + +namespace syncer_v2 { + +// Interface used by the processor and service to communicate about metadata. +class SYNC_EXPORT MetadataChanges { + public: + MetadataChanges() {} + virtual ~MetadataChanges() {} +}; + +} // namespace syncer_v2 + +#endif // SYNC_API_METADATA_CHANGES_H_ diff --git a/sync/api/model_type_change_processor.h b/sync/api/model_type_change_processor.h index 85f8d16..7781a0e 100644 --- a/sync/api/model_type_change_processor.h +++ b/sync/api/model_type_change_processor.h @@ -5,16 +5,36 @@ #ifndef SYNC_API_MODEL_TYPE_CHANGE_PROCESSOR_H_ #define SYNC_API_MODEL_TYPE_CHANGE_PROCESSOR_H_ +#include <string> + +#include "base/memory/scoped_ptr.h" +#include "sync/api/entity_data.h" #include "sync/base/sync_export.h" +namespace syncer { +class SyncError; +} // namespace syncer + namespace syncer_v2 { +class MetadataChanges; + // Interface used by the ModelTypeService to inform sync of local // changes. class SYNC_EXPORT ModelTypeChangeProcessor { public: ModelTypeChangeProcessor(); virtual ~ModelTypeChangeProcessor(); + + // Inform the processor of a new or updated entity. + virtual void Put(const std::string& client_key, + const std::string& non_unique_name, + const sync_pb::EntitySpecifics& specifics, + MetadataChanges* metadata_changes) = 0; + + // Inform the processor of a deleted entity. + virtual void Delete(const std::string& client_key, + MetadataChanges* metadata_changes) = 0; }; } // namespace syncer_v2 diff --git a/sync/api/model_type_service.cc b/sync/api/model_type_service.cc index 61ea860..759860a 100644 --- a/sync/api/model_type_service.cc +++ b/sync/api/model_type_service.cc @@ -10,4 +10,18 @@ ModelTypeService::ModelTypeService() {} ModelTypeService::~ModelTypeService() {} +syncer_v2::ModelTypeChangeProcessor* ModelTypeService::change_processor() { + return change_processor_.get(); +} + +void ModelTypeService::set_change_processor( + scoped_ptr<syncer_v2::ModelTypeChangeProcessor> change_processor) { + DCHECK(!change_processor_); + change_processor_.swap(change_processor); +} + +void ModelTypeService::clear_change_processor() { + change_processor_.reset(); +} + } // namespace syncer_v2 diff --git a/sync/api/model_type_service.h b/sync/api/model_type_service.h index d01dc87..473c9c1 100644 --- a/sync/api/model_type_service.h +++ b/sync/api/model_type_service.h @@ -5,17 +5,78 @@ #ifndef SYNC_API_MODEL_TYPE_SERVICE_H_ #define SYNC_API_MODEL_TYPE_SERVICE_H_ +#include <string> +#include <vector> + +#include "base/callback.h" +#include "base/memory/scoped_ptr.h" +#include "sync/api/entity_data.h" +#include "sync/api/model_type_change_processor.h" #include "sync/base/sync_export.h" +namespace syncer { +class SyncError; +} // namespace syncer + namespace syncer_v2 { +class DataBatch; +class MetadataBatch; +class MetadataChanges; + // 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: + typedef base::Callback<void(syncer::SyncError, scoped_ptr<DataBatch>)> + DataCallback; + typedef base::Callback<void(syncer::SyncError, scoped_ptr<MetadataBatch>)> + MetadataCallback; + typedef std::vector<std::string> ClientKeyList; + ModelTypeService(); + virtual ~ModelTypeService(); + + // Creates an object used to communicate changes in the sync metadata to the + // model type store. + virtual MetadataChanges* CreateMetadataChanges() = 0; + + // Perform the initial merge of data from the sync server. Should only need + // to be called when sync is first turned on, not on every restart. + virtual syncer::SyncError MergeSyncData(MetadataChanges* metadata_changes, + EntityDataList entity_data_list) = 0; + + // Apply changes from the sync server locally. + // TODO(skym): The change type should be in here somehow. + virtual syncer::SyncError ApplySyncChanges( + MetadataChanges* metadata_changes, + EntityDataList entity_data_list) = 0; + + // Asynchronously retrieve the sync metadata. + virtual void LoadMetadata(MetadataCallback callback) = 0; + + // Asynchronously retrieve the corresponding sync data for |client_keys|. + virtual void GetData(ClientKeyList client_keys, DataCallback callback) = 0; + + // Asynchronously retrieve all of the local sync data. + virtual void GetAllData(DataCallback callback) = 0; + + // Get or generate a client tag for |entity_data|. + virtual std::string GetClientTag(const EntityData* entity_data) = 0; + + // TODO(skym): See crbug/547087, do we need all these accessors? + syncer_v2::ModelTypeChangeProcessor* change_processor(); + + void set_change_processor( + scoped_ptr<syncer_v2::ModelTypeChangeProcessor> change_processor); + + void clear_change_processor(); + + private: + // Recieves ownership in set_change_processor(...). + scoped_ptr<syncer_v2::ModelTypeChangeProcessor> change_processor_; }; } // namespace syncer_v2 diff --git a/sync/internal_api/public/model_type_processor.h b/sync/internal_api/public/model_type_processor.h index 0f1971e..c4ac343 100644 --- a/sync/internal_api/public/model_type_processor.h +++ b/sync/internal_api/public/model_type_processor.h @@ -18,7 +18,7 @@ class SYNC_EXPORT_PRIVATE ModelTypeProcessor { ModelTypeProcessor(); virtual ~ModelTypeProcessor(); - // Callback used to process the handshake response. + // Callback used to process the handshake response from the worker. virtual void OnConnect(scoped_ptr<CommitQueue> commit_queue) = 0; // Informs this object that some of its commit requests have been @@ -35,6 +35,6 @@ class SYNC_EXPORT_PRIVATE ModelTypeProcessor { const UpdateResponseDataList& pending_updates) = 0; }; -} // namespace syncer +} // namespace syncer_v2 #endif // SYNC_INTERNAL_API_PUBLIC_MODEL_TYPE_PROCESSOR_H_ diff --git a/sync/internal_api/public/shared_model_type_processor.h b/sync/internal_api/public/shared_model_type_processor.h index 6b700785..1c61a00 100644 --- a/sync/internal_api/public/shared_model_type_processor.h +++ b/sync/internal_api/public/shared_model_type_processor.h @@ -2,8 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef SYNC_INTERNAL_API_PUBLIC_MODEL_TYPE_SYNC_PROXY_IMPL_H_ -#define SYNC_INTERNAL_API_PUBLIC_MODEL_TYPE_SYNC_PROXY_IMPL_H_ +#ifndef SYNC_INTERNAL_API_PUBLIC_SHARED_MODEL_TYPE_PROCESSOR_H_ +#define SYNC_INTERNAL_API_PUBLIC_SHARED_MODEL_TYPE_PROCESSOR_H_ + +#include <string> #include "base/containers/scoped_ptr_map.h" #include "base/memory/scoped_ptr.h" @@ -60,29 +62,16 @@ class SYNC_EXPORT_PRIVATE SharedModelTypeProcessor // Another call to Enable() can be used to re-establish this connection. void Disable(); - // Callback used to process the handshake response from the sync thread. - void OnConnect(scoped_ptr<CommitQueue> worker) override; - // Returns true if the handshake with sync thread is complete. bool IsConnected() const; - // Requests that an item be stored in sync. - void Put(const std::string& client_tag, - const sync_pb::EntitySpecifics& specifics); - - // Deletes an item from sync. - void Delete(const std::string& client_tag); - - // Informs this object that some of its commit requests have been - // successfully serviced. - void OnCommitCompleted(const DataTypeState& type_state, - const CommitResponseDataList& response_list) override; - - // Informs this object that there are some incoming updates is should - // handle. - void OnUpdateReceived(const DataTypeState& type_state, - const UpdateResponseDataList& response_list, - const UpdateResponseDataList& pending_updates) override; + // ModelTypeChangeProcessor implementation. + void Put(const std::string& client_key, + const std::string& non_unique_name, + const sync_pb::EntitySpecifics& specifics, + MetadataChanges* metadata_changes) override; + void Delete(const std::string& client_key, + MetadataChanges* metadata_changes) override; // Returns the list of pending updates. // @@ -96,6 +85,14 @@ class SYNC_EXPORT_PRIVATE SharedModelTypeProcessor // ProfileSyncService. base::WeakPtr<SharedModelTypeProcessor> AsWeakPtrForUI(); + // ModelTypeProcessor implementation. + void OnConnect(scoped_ptr<CommitQueue> worker) override; + void OnCommitCompleted(const DataTypeState& type_state, + const CommitResponseDataList& response_list) override; + void OnUpdateReceived(const DataTypeState& type_state, + const UpdateResponseDataList& response_list, + const UpdateResponseDataList& pending_updates) override; + private: typedef base::ScopedPtrMap<std::string, scoped_ptr<ModelTypeEntity>> EntityMap; @@ -155,4 +152,4 @@ class SYNC_EXPORT_PRIVATE SharedModelTypeProcessor } // namespace syncer_v2 -#endif // SYNC_INTERNAL_API_PUBLIC_MODEL_TYPE_SYNC_PROXY_IMPL_H_ +#endif // SYNC_INTERNAL_API_PUBLIC_SHARED_MODEL_TYPE_PROCESSOR_H_ diff --git a/sync/internal_api/shared_model_type_processor.cc b/sync/internal_api/shared_model_type_processor.cc index df96e01..01e43c0 100644 --- a/sync/internal_api/shared_model_type_processor.cc +++ b/sync/internal_api/shared_model_type_processor.cc @@ -85,7 +85,7 @@ void SharedModelTypeProcessor::Start(StartCallback callback) { is_enabled_ = true; - // TODO: At some point, this should be loaded from storage. + // TODO(stanisc): At some point, this should be loaded from storage. data_type_state_.progress_marker.set_data_type_id( GetSpecificsFieldNumberFromModelType(type_)); @@ -145,8 +145,14 @@ void SharedModelTypeProcessor::OnConnect(scoped_ptr<CommitQueue> worker) { FlushPendingCommitRequests(); } -void SharedModelTypeProcessor::Put(const std::string& client_tag, - const sync_pb::EntitySpecifics& specifics) { +void SharedModelTypeProcessor::Put( + const std::string& client_tag, + const std::string& non_unique_name, + const sync_pb::EntitySpecifics& specifics, + MetadataChanges* metadata_changes) { + // TODO(skym): Update for new approach. Different objects, different caching, + // different loopups, metadat_changes, etc. + DCHECK_EQ(type_, syncer::GetModelTypeFromSpecifics(specifics)); const std::string client_tag_hash( @@ -165,16 +171,20 @@ void SharedModelTypeProcessor::Put(const std::string& client_tag, FlushPendingCommitRequests(); } -void SharedModelTypeProcessor::Delete(const std::string& client_tag) { +void SharedModelTypeProcessor::Delete(const std::string& client_key, + MetadataChanges* metadata_changes) { + // TODO(skym): Update for new approach. Different caching, different lookup, + // metadata changes. + const std::string client_tag_hash( - syncer::syncable::GenerateSyncableHash(type_, client_tag)); + syncer::syncable::GenerateSyncableHash(type_, client_key)); EntityMap::const_iterator it = entities_.find(client_tag_hash); if (it == entities_.end()) { // That's unusual, but not necessarily a bad thing. // Missing is as good as deleted as far as the model is concerned. DLOG(WARNING) << "Attempted to delete missing item." - << " client tag: " << client_tag; + << " client tag: " << client_key; } else { ModelTypeEntity* entity = it->second; entity->Delete(); @@ -266,7 +276,7 @@ void SharedModelTypeProcessor::OnUpdateReceived( response_data.response_version, data.is_deleted(), data.specifics, data.modification_time, response_data.encryption_key_name); - // TODO: Do something special when conflicts are detected. + // TODO(rlarocque): Do something special when conflicts are detected. } // If the received entity has out of date encryption, we schedule another @@ -313,8 +323,8 @@ void SharedModelTypeProcessor::OnUpdateReceived( // We may have new reasons to commit by the time this function is done. FlushPendingCommitRequests(); - // TODO: Inform the model of the new or updated data. - // TODO: Persist the new data on disk. + // TODO(rlarocque): Inform the model of the new or updated data. + // TODO(rlarocque): Persist the new data on disk. } UpdateResponseDataList SharedModelTypeProcessor::GetPendingUpdates() { @@ -342,4 +352,4 @@ void SharedModelTypeProcessor::ClearSyncState() { data_type_state_ = DataTypeState(); } -} // namespace syncer +} // namespace syncer_v2 diff --git a/sync/internal_api/shared_model_type_processor_unittest.cc b/sync/internal_api/shared_model_type_processor_unittest.cc index 54475bb..2b5bc64 100644 --- a/sync/internal_api/shared_model_type_processor_unittest.cc +++ b/sync/internal_api/shared_model_type_processor_unittest.cc @@ -201,12 +201,12 @@ void SharedModelTypeProcessorTest::StartDone( void SharedModelTypeProcessorTest::WriteItem(const std::string& tag, const std::string& value) { - const std::string tag_hash = GenerateTagHash(tag); - type_processor_->Put(tag, GenerateSpecifics(tag, value)); + sync_pb::EntitySpecifics specifics = GenerateSpecifics(tag, value); + type_processor_->Put(tag, std::string(), specifics, nullptr); } void SharedModelTypeProcessorTest::DeleteItem(const std::string& tag) { - type_processor_->Delete(tag); + type_processor_->Delete(tag, nullptr); } void SharedModelTypeProcessorTest::OnInitialSyncDone() { diff --git a/sync/sync.gyp b/sync/sync.gyp index 8633479..0690495 100644 --- a/sync/sync.gyp +++ b/sync/sync.gyp @@ -76,8 +76,11 @@ 'api/attachments/attachment_store.h', 'api/attachments/attachment_store_backend.cc', 'api/attachments/attachment_store_backend.h', + 'api/data_batch.h', 'api/entity_data.cc', 'api/entity_data.h', + 'api/metadata_batch.h', + 'api/metadata_changes.h', 'api/model_type_change_processor.cc', 'api/model_type_change_processor.h', 'api/model_type_service.cc', |