summaryrefslogtreecommitdiffstats
path: root/sync/api
diff options
context:
space:
mode:
authorpavely <pavely@chromium.org>2015-03-10 18:18:51 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-11 01:20:02 +0000
commitbe7169cf3591e428d0b4056a2c23c8ace14f6169 (patch)
treebbf117b5a420dad356ed489612ce0ef446174623 /sync/api
parent26b51a09bfdd04ad4e11b99d7acf9446aa98e752 (diff)
downloadchromium_src-be7169cf3591e428d0b4056a2c23c8ace14f6169.zip
chromium_src-be7169cf3591e428d0b4056a2c23c8ace14f6169.tar.gz
chromium_src-be7169cf3591e428d0b4056a2c23c8ace14f6169.tar.bz2
[Sync] Refactor AttachmentStore classes. Introduce concept of referrer.
In this change: - Move towards following class hierarchy: http://www.plantuml.com:80/plantuml/png/ZPBTJiCm38NlynIvv4TzWsaI525nCI5jkw-on1EZQHmvwQG9U7TC4-ZeKiITvNm-EiSExbv1Hxc6VOszYs24mDHQeG6xFNcGRqBAknYLVkd0nKr40l7nmqrU1deDeRUHYrfPkrEw3LmJx848YCkWqODfkECZBIOAZuHin9abWxUo9b0Hdjt38RGJyEhwZ4YZI9kJq_mmRp0pAPKnd7pGgG8t6usTHyVe7_FPtY3mbOth9ghGDjGxTnwlaEq-ySjv-KmCwZflxvVyE5bSIa4Mw7ZGyDHvAyHurPkgkhZgz9PuoNp75tDhAUZcJ68cwkATHyfXnFWn4_PFDsKuNLuKLrFodGS-0G00 - Remove AttachmenService::GetStore. Now attachment store is owned by model type, there is no need to get it from AttachmentService - Introduce AttachmentReferrer. There is no functionality behind it yet and interface is not complete for it. These will come in the next change. BUG=457735 R=maniscalco@chromium.org TEST=Not exposed in chrome. Only unit tests available (sync_unit_tests) Committed: https://crrev.com/6adcada8a799057c31c0f17550c9e2747a8df847 Cr-Commit-Position: refs/heads/master@{#319733} Review URL: https://codereview.chromium.org/986743004 Cr-Commit-Position: refs/heads/master@{#320015}
Diffstat (limited to 'sync/api')
-rw-r--r--sync/api/attachments/attachment_store.cc83
-rw-r--r--sync/api/attachments/attachment_store.h123
-rw-r--r--sync/api/attachments/attachment_store_backend.cc24
-rw-r--r--sync/api/attachments/attachment_store_backend.h64
-rw-r--r--sync/api/fake_syncable_service.cc9
-rw-r--r--sync/api/fake_syncable_service.h7
-rw-r--r--sync/api/syncable_service.cc4
-rw-r--r--sync/api/syncable_service.h11
8 files changed, 215 insertions, 110 deletions
diff --git a/sync/api/attachments/attachment_store.cc b/sync/api/attachments/attachment_store.cc
index 91b3f95..7cf774e 100644
--- a/sync/api/attachments/attachment_store.cc
+++ b/sync/api/attachments/attachment_store.cc
@@ -10,16 +10,53 @@
#include "base/message_loop/message_loop.h"
#include "base/sequenced_task_runner.h"
#include "base/thread_task_runner_handle.h"
-#include "sync/internal_api/public/attachments/attachment_store_handle.h"
+#include "sync/internal_api/public/attachments/attachment_store_frontend.h"
#include "sync/internal_api/public/attachments/in_memory_attachment_store.h"
#include "sync/internal_api/public/attachments/on_disk_attachment_store.h"
namespace syncer {
-AttachmentStore::AttachmentStore() {}
-AttachmentStore::~AttachmentStore() {}
+AttachmentStore::AttachmentStore(
+ const scoped_refptr<AttachmentStoreFrontend>& frontend,
+ AttachmentReferrer referrer)
+ : frontend_(frontend), referrer_(referrer) {
+}
+
+AttachmentStore::~AttachmentStore() {
+}
+
+void AttachmentStore::Read(const AttachmentIdList& ids,
+ const ReadCallback& callback) {
+ frontend_->Read(ids, callback);
+}
-scoped_refptr<AttachmentStore> AttachmentStore::CreateInMemoryStore() {
+void AttachmentStore::Write(const AttachmentList& attachments,
+ const WriteCallback& callback) {
+ frontend_->Write(referrer_, attachments, callback);
+}
+
+void AttachmentStore::Drop(const AttachmentIdList& ids,
+ const DropCallback& callback) {
+ frontend_->Drop(referrer_, ids, callback);
+}
+
+void AttachmentStore::ReadMetadata(const AttachmentIdList& ids,
+ const ReadMetadataCallback& callback) {
+ frontend_->ReadMetadata(ids, callback);
+}
+
+void AttachmentStore::ReadAllMetadata(const ReadMetadataCallback& callback) {
+ frontend_->ReadAllMetadata(referrer_, callback);
+}
+
+scoped_ptr<AttachmentStore> AttachmentStore::CreateAttachmentStoreForSync()
+ const {
+ scoped_ptr<AttachmentStore> attachment_store(
+ new AttachmentStore(frontend_, SYNC));
+ return attachment_store.Pass();
+}
+
+scoped_ptr<AttachmentStore> AttachmentStore::CreateInMemoryStore() {
// Both frontend and backend of attachment store will live on current thread.
scoped_refptr<base::SingleThreadTaskRunner> runner;
if (base::ThreadTaskRunnerHandle::IsSet()) {
@@ -32,34 +69,38 @@ scoped_refptr<AttachmentStore> AttachmentStore::CreateInMemoryStore() {
}
scoped_ptr<AttachmentStoreBackend> backend(
new InMemoryAttachmentStore(runner));
- return scoped_refptr<AttachmentStore>(
- new AttachmentStoreHandle(backend.Pass(), runner));
+ scoped_refptr<AttachmentStoreFrontend> frontend(
+ new AttachmentStoreFrontend(backend.Pass(), runner));
+ scoped_ptr<AttachmentStore> attachment_store(
+ new AttachmentStore(frontend, MODEL_TYPE));
+ return attachment_store.Pass();
}
-scoped_refptr<AttachmentStore> AttachmentStore::CreateOnDiskStore(
+scoped_ptr<AttachmentStore> AttachmentStore::CreateOnDiskStore(
const base::FilePath& path,
const scoped_refptr<base::SequencedTaskRunner>& backend_task_runner,
const InitCallback& callback) {
scoped_ptr<OnDiskAttachmentStore> backend(
new OnDiskAttachmentStore(base::ThreadTaskRunnerHandle::Get(), path));
- scoped_refptr<AttachmentStore> attachment_store =
- new AttachmentStoreHandle(backend.Pass(), backend_task_runner);
- attachment_store->Init(callback);
-
- return attachment_store;
-}
-
-AttachmentStoreBackend::AttachmentStoreBackend(
- const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner)
- : callback_task_runner_(callback_task_runner) {
-}
+ scoped_refptr<AttachmentStoreFrontend> frontend =
+ new AttachmentStoreFrontend(backend.Pass(), backend_task_runner);
+ scoped_ptr<AttachmentStore> attachment_store(
+ new AttachmentStore(frontend, MODEL_TYPE));
+ frontend->Init(callback);
-AttachmentStoreBackend::~AttachmentStoreBackend() {
+ return attachment_store.Pass();
}
-void AttachmentStoreBackend::PostCallback(const base::Closure& callback) {
- callback_task_runner_->PostTask(FROM_HERE, callback);
+scoped_ptr<AttachmentStore> AttachmentStore::CreateMockStoreForTest(
+ scoped_ptr<AttachmentStoreBackend> backend) {
+ scoped_refptr<base::SingleThreadTaskRunner> runner =
+ base::ThreadTaskRunnerHandle::Get();
+ scoped_refptr<AttachmentStoreFrontend> attachment_store_frontend(
+ new AttachmentStoreFrontend(backend.Pass(), runner));
+ scoped_ptr<AttachmentStore> attachment_store(
+ new AttachmentStore(attachment_store_frontend, MODEL_TYPE));
+ return attachment_store.Pass();
}
} // namespace syncer
diff --git a/sync/api/attachments/attachment_store.h b/sync/api/attachments/attachment_store.h
index b183de1..e8d8f5c 100644
--- a/sync/api/attachments/attachment_store.h
+++ b/sync/api/attachments/attachment_store.h
@@ -15,14 +15,13 @@
namespace base {
class FilePath;
-class RefCountedMemory;
class SequencedTaskRunner;
} // namespace base
namespace syncer {
-class Attachment;
-class AttachmentId;
+class AttachmentStoreFrontend;
+class AttachmentStoreBackend;
// AttachmentStore is a place to locally store and access Attachments.
//
@@ -32,8 +31,7 @@ class AttachmentId;
// implementations.
// Destroying this object does not necessarily cancel outstanding async
// operations. If you need cancel like semantics, use WeakPtr in the callbacks.
-class SYNC_EXPORT AttachmentStore
- : public base::RefCountedThreadSafe<AttachmentStore> {
+class SYNC_EXPORT AttachmentStore {
public:
// TODO(maniscalco): Consider udpating Read and Write methods to support
// resumable transfers (bug 353292).
@@ -49,6 +47,14 @@ class SYNC_EXPORT AttachmentStore
static const int RESULT_SIZE =
10; // Size of the Result enum; used for histograms.
+ // Each attachment can have references from sync or model type. Tracking these
+ // references is needed for lifetime management of attachment, it can only be
+ // deleted from the store when it doesn't have references.
+ enum AttachmentReferrer {
+ MODEL_TYPE,
+ SYNC,
+ };
+
typedef base::Callback<void(const Result&)> InitCallback;
typedef base::Callback<void(const Result&,
scoped_ptr<AttachmentMap>,
@@ -59,15 +65,7 @@ class SYNC_EXPORT AttachmentStore
scoped_ptr<AttachmentMetadataList>)>
ReadMetadataCallback;
- AttachmentStore();
-
- // Asynchronously initializes attachment store.
- //
- // This method should not be called by consumer of this interface. It is
- // called by factory methods in AttachmentStore class. When initialization is
- // complete |callback| is invoked with result, in case of failure result is
- // UNSPECIFIED_ERROR.
- virtual void Init(const InitCallback& callback) = 0;
+ ~AttachmentStore();
// Asynchronously reads the attachments identified by |ids|.
//
@@ -81,8 +79,7 @@ class SYNC_EXPORT AttachmentStore
//
// Reads on individual attachments are treated atomically; |callback| will not
// read only part of an attachment.
- virtual void Read(const AttachmentIdList& ids,
- const ReadCallback& callback) = 0;
+ void Read(const AttachmentIdList& ids, const ReadCallback& callback);
// Asynchronously writes |attachments| to the store.
//
@@ -93,8 +90,7 @@ class SYNC_EXPORT AttachmentStore
// not be written |callback|'s Result will be UNSPECIFIED_ERROR. When this
// happens, some or none of the attachments may have been written
// successfully.
- virtual void Write(const AttachmentList& attachments,
- const WriteCallback& callback) = 0;
+ void Write(const AttachmentList& attachments, const WriteCallback& callback);
// Asynchronously drops |attchments| from this store.
//
@@ -105,8 +101,7 @@ class SYNC_EXPORT AttachmentStore
// could not be dropped, |callback|'s Result will be UNSPECIFIED_ERROR. When
// this happens, some or none of the attachments may have been dropped
// successfully.
- virtual void Drop(const AttachmentIdList& ids,
- const DropCallback& callback) = 0;
+ void Drop(const AttachmentIdList& ids, const DropCallback& callback);
// Asynchronously reads metadata for the attachments identified by |ids|.
//
@@ -114,72 +109,52 @@ class SYNC_EXPORT AttachmentStore
// read metadata for all attachments specified in ids. If any of the
// metadata entries do not exist or could not be read, |callback|'s Result
// will be UNSPECIFIED_ERROR.
- virtual void ReadMetadata(const AttachmentIdList& ids,
- const ReadMetadataCallback& callback) = 0;
+ void ReadMetadata(const AttachmentIdList& ids,
+ const ReadMetadataCallback& callback);
// Asynchronously reads metadata for all attachments in the store.
//
// |callback| will be invoked when finished. If any of the metadata entries
// could not be read, |callback|'s Result will be UNSPECIFIED_ERROR.
- virtual void ReadAllMetadata(const ReadMetadataCallback& callback) = 0;
-
- // Creates an AttachmentStoreHandle backed by in-memory implementation of
- // attachment store. For now frontend lives on the same thread as backend.
- static scoped_refptr<AttachmentStore> CreateInMemoryStore();
-
- // Creates an AttachmentStoreHandle backed by on-disk implementation of
- // attachment store. Opens corresponding leveldb database located at |path|.
- // All backend operations are scheduled to |backend_task_runner|. Opening
- // attachment store is asynchronous, once it finishes |callback| will be
- // called on the thread that called CreateOnDiskStore. Calling Read/Write/Drop
- // before initialization completed is allowed. Later if initialization fails
- // these operations will fail with STORE_INITIALIZATION_FAILED error.
- static scoped_refptr<AttachmentStore> CreateOnDiskStore(
+ void ReadAllMetadata(const ReadMetadataCallback& callback);
+
+ // Given current AttachmentStore (this) creates separate AttachmentStore that
+ // will be used by sync components (AttachmentService). Resulting
+ // AttachmentStore is backed by the same frontend/backend.
+ scoped_ptr<AttachmentStore> CreateAttachmentStoreForSync() const;
+
+ // Creates an AttachmentStore backed by in-memory implementation of attachment
+ // store. For now frontend lives on the same thread as backend.
+ static scoped_ptr<AttachmentStore> CreateInMemoryStore();
+
+ // Creates an AttachmentStore backed by on-disk implementation of attachment
+ // store. Opens corresponding leveldb database located at |path|. All backend
+ // operations are scheduled to |backend_task_runner|. Opening attachment store
+ // is asynchronous, once it finishes |callback| will be called on the thread
+ // that called CreateOnDiskStore. Calling Read/Write/Drop before
+ // initialization completed is allowed. Later if initialization fails these
+ // operations will fail with STORE_INITIALIZATION_FAILED error.
+ static scoped_ptr<AttachmentStore> CreateOnDiskStore(
const base::FilePath& path,
const scoped_refptr<base::SequencedTaskRunner>& backend_task_runner,
const InitCallback& callback);
- protected:
- friend class base::RefCountedThreadSafe<AttachmentStore>;
- virtual ~AttachmentStore();
-};
-
-// Interface for AttachmentStore backends.
-//
-// AttachmentStoreBackend provides interface for different backends (on-disk,
-// in-memory). Factory methods in AttachmentStore create corresponding backend
-// and pass reference to AttachmentStoreHandle.
-// All functions in AttachmentStoreBackend mirror corresponding functions in
-// AttachmentStore.
-// All callbacks and result codes are used directly from AttachmentStore.
-// AttachmentStoreHandle only passes callbacks and results, there is no need to
-// declare separate set.
-class SYNC_EXPORT AttachmentStoreBackend {
- public:
- explicit AttachmentStoreBackend(
- const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner);
- virtual ~AttachmentStoreBackend();
- virtual void Init(const AttachmentStore::InitCallback& callback) = 0;
- virtual void Read(const AttachmentIdList& ids,
- const AttachmentStore::ReadCallback& callback) = 0;
- virtual void Write(const AttachmentList& attachments,
- const AttachmentStore::WriteCallback& callback) = 0;
- virtual void Drop(const AttachmentIdList& ids,
- const AttachmentStore::DropCallback& callback) = 0;
- virtual void ReadMetadata(
- const AttachmentIdList& ids,
- const AttachmentStore::ReadMetadataCallback& callback) = 0;
- virtual void ReadAllMetadata(
- const AttachmentStore::ReadMetadataCallback& callback) = 0;
-
- protected:
- // Helper function to post callback on callback_task_runner.
- void PostCallback(const base::Closure& callback);
+ // Creates set of AttachmentStore/AttachmentStoreFrontend instances for tests
+ // that provide their own implementation of AttachmentstoreBackend for
+ // mocking.
+ static scoped_ptr<AttachmentStore> CreateMockStoreForTest(
+ scoped_ptr<AttachmentStoreBackend> backend);
private:
- scoped_refptr<base::SequencedTaskRunner> callback_task_runner_;
+ AttachmentStore(const scoped_refptr<AttachmentStoreFrontend>& frontend,
+ AttachmentReferrer referrer);
+
+ scoped_refptr<AttachmentStoreFrontend> frontend_;
+ // Modification operations with attachment store will be performed on behalf
+ // of |referrer_|.
+ const AttachmentReferrer referrer_;
- DISALLOW_COPY_AND_ASSIGN(AttachmentStoreBackend);
+ DISALLOW_COPY_AND_ASSIGN(AttachmentStore);
};
} // namespace syncer
diff --git a/sync/api/attachments/attachment_store_backend.cc b/sync/api/attachments/attachment_store_backend.cc
new file mode 100644
index 0000000..44363cc
--- /dev/null
+++ b/sync/api/attachments/attachment_store_backend.cc
@@ -0,0 +1,24 @@
+// 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/attachments/attachment_store_backend.h"
+
+#include "base/location.h"
+#include "base/sequenced_task_runner.h"
+
+namespace syncer {
+
+AttachmentStoreBackend::AttachmentStoreBackend(
+ const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner)
+ : callback_task_runner_(callback_task_runner) {
+}
+
+AttachmentStoreBackend::~AttachmentStoreBackend() {
+}
+
+void AttachmentStoreBackend::PostCallback(const base::Closure& callback) {
+ callback_task_runner_->PostTask(FROM_HERE, callback);
+}
+
+} // namespace syncer
diff --git a/sync/api/attachments/attachment_store_backend.h b/sync/api/attachments/attachment_store_backend.h
new file mode 100644
index 0000000..74859fe
--- /dev/null
+++ b/sync/api/attachments/attachment_store_backend.h
@@ -0,0 +1,64 @@
+// 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_ATTACHMENTS_ATTACHMENT_STORE_BACKEND_H_
+#define SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_BACKEND_H_
+
+#include "base/callback.h"
+#include "base/memory/ref_counted.h"
+#include "sync/api/attachments/attachment.h"
+#include "sync/api/attachments/attachment_id.h"
+#include "sync/api/attachments/attachment_store.h"
+#include "sync/base/sync_export.h"
+
+namespace base {
+class SequencedTaskRunner;
+} // namespace base
+
+namespace syncer {
+
+// Interface for AttachmentStore backends.
+//
+// AttachmentStoreBackend provides interface for different backends (on-disk,
+// in-memory). Factory methods in AttachmentStore create corresponding backend
+// and pass reference to AttachmentStore.
+// All functions in AttachmentStoreBackend mirror corresponding functions in
+// AttachmentStore.
+// All callbacks and result codes are used directly from AttachmentStore.
+// AttachmentStoreFrontend only passes callbacks and results without modifying
+// them, there is no need to declare separate set.
+class SYNC_EXPORT AttachmentStoreBackend {
+ public:
+ explicit AttachmentStoreBackend(
+ const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner);
+ virtual ~AttachmentStoreBackend();
+ virtual void Init(const AttachmentStore::InitCallback& callback) = 0;
+ virtual void Read(const AttachmentIdList& ids,
+ const AttachmentStore::ReadCallback& callback) = 0;
+ virtual void Write(AttachmentStore::AttachmentReferrer referrer,
+ const AttachmentList& attachments,
+ const AttachmentStore::WriteCallback& callback) = 0;
+ virtual void Drop(AttachmentStore::AttachmentReferrer referrer,
+ const AttachmentIdList& ids,
+ const AttachmentStore::DropCallback& callback) = 0;
+ virtual void ReadMetadata(
+ const AttachmentIdList& ids,
+ const AttachmentStore::ReadMetadataCallback& callback) = 0;
+ virtual void ReadAllMetadata(
+ AttachmentStore::AttachmentReferrer referrer,
+ const AttachmentStore::ReadMetadataCallback& callback) = 0;
+
+ protected:
+ // Helper function to post callback on callback_task_runner.
+ void PostCallback(const base::Closure& callback);
+
+ private:
+ scoped_refptr<base::SequencedTaskRunner> callback_task_runner_;
+
+ DISALLOW_COPY_AND_ASSIGN(AttachmentStoreBackend);
+};
+
+} // namespace syncer
+
+#endif // SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_BACKEND_H_
diff --git a/sync/api/fake_syncable_service.cc b/sync/api/fake_syncable_service.cc
index ec7b90c..d2177e9 100644
--- a/sync/api/fake_syncable_service.cc
+++ b/sync/api/fake_syncable_service.cc
@@ -26,8 +26,8 @@ void FakeSyncableService::set_process_sync_changes_error(
}
void FakeSyncableService::set_attachment_store(
- const scoped_refptr<AttachmentStore>& attachment_store) {
- attachment_store_ = attachment_store;
+ scoped_ptr<AttachmentStore> attachment_store) {
+ attachment_store_ = attachment_store.Pass();
}
const AttachmentService* FakeSyncableService::attachment_service() const {
@@ -70,8 +70,9 @@ SyncError FakeSyncableService::ProcessSyncChanges(
return process_sync_changes_error_;
}
-scoped_refptr<AttachmentStore> FakeSyncableService::GetAttachmentStore() {
- return attachment_store_;
+scoped_ptr<AttachmentStore> FakeSyncableService::GetAttachmentStoreForSync() {
+ return attachment_store_ ? attachment_store_->CreateAttachmentStoreForSync()
+ : scoped_ptr<AttachmentStore>();
}
void FakeSyncableService::SetAttachmentService(
diff --git a/sync/api/fake_syncable_service.h b/sync/api/fake_syncable_service.h
index 7403ef3..9b75647 100644
--- a/sync/api/fake_syncable_service.h
+++ b/sync/api/fake_syncable_service.h
@@ -23,8 +23,7 @@ class FakeSyncableService : public SyncableService {
void set_process_sync_changes_error(const SyncError& error);
// Setter for AttachmentStore.
- void set_attachment_store(
- const scoped_refptr<AttachmentStore>& attachment_store);
+ void set_attachment_store(scoped_ptr<AttachmentStore> attachment_store);
// AttachmentService should be set when this syncable service is connected,
// just before MergeDataAndStartSyncing. NULL is returned by default.
@@ -44,7 +43,7 @@ class FakeSyncableService : public SyncableService {
SyncDataList GetAllSyncData(ModelType type) const override;
SyncError ProcessSyncChanges(const tracked_objects::Location& from_here,
const SyncChangeList& change_list) override;
- scoped_refptr<AttachmentStore> GetAttachmentStore() override;
+ scoped_ptr<AttachmentStore> GetAttachmentStoreForSync() override;
void SetAttachmentService(
scoped_ptr<AttachmentService> attachment_service) override;
@@ -54,7 +53,7 @@ class FakeSyncableService : public SyncableService {
SyncError process_sync_changes_error_;
bool syncing_;
ModelType type_;
- scoped_refptr<AttachmentStore> attachment_store_;
+ scoped_ptr<AttachmentStore> attachment_store_;
scoped_ptr<AttachmentService> attachment_service_;
};
diff --git a/sync/api/syncable_service.cc b/sync/api/syncable_service.cc
index 7b0a973..f0cfe67 100644
--- a/sync/api/syncable_service.cc
+++ b/sync/api/syncable_service.cc
@@ -8,8 +8,8 @@ namespace syncer {
SyncableService::~SyncableService() {}
-scoped_refptr<AttachmentStore> SyncableService::GetAttachmentStore() {
- return scoped_refptr<AttachmentStore>();
+scoped_ptr<AttachmentStore> SyncableService::GetAttachmentStoreForSync() {
+ return scoped_ptr<AttachmentStore>();
}
void SyncableService::SetAttachmentService(
diff --git a/sync/api/syncable_service.h b/sync/api/syncable_service.h
index f83a017..0d5aae4 100644
--- a/sync/api/syncable_service.h
+++ b/sync/api/syncable_service.h
@@ -66,15 +66,16 @@ class SYNC_EXPORT SyncableService
SyncError ProcessSyncChanges(const tracked_objects::Location& from_here,
const SyncChangeList& change_list) override = 0;
- // Returns AttachmentStore used by datatype. Attachment store is used by sync
- // when uploading or downloading attachments.
+ // Returns AttachmentStore for use by sync when uploading or downloading
+ // attachments.
// GetAttachmentStore is called right before MergeDataAndStartSyncing. If at
// that time GetAttachmentStore returns NULL then datatype is considered not
// using attachments and all attempts to upload/download attachments will
// fail. Default implementation returns NULL. Datatype that uses sync
- // attachemnts should create attachment store and implement GetAttachmentStore
- // to return pointer to it.
- virtual scoped_refptr<AttachmentStore> GetAttachmentStore();
+ // attachments should create attachment store, implement GetAttachmentStore
+ // to return result of AttachmentStore::CreateAttachmentStoreForSync() from
+ // attachment store object.
+ virtual scoped_ptr<AttachmentStore> GetAttachmentStoreForSync();
// Called by sync to provide AttachmentService to be used to download
// attachments.