summaryrefslogtreecommitdiffstats
path: root/sync/api
diff options
context:
space:
mode:
authorbnc <bnc@chromium.org>2015-03-09 16:12:55 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-09 23:14:13 +0000
commitcd8db1dfaf165cbca88f38ecf50a5cacc09959b1 (patch)
tree7915be516bf8ddc3d7da0156749f3536e32aa00a /sync/api
parent982eb90bf74535cbe5e21c4eacb759c42ff424d4 (diff)
downloadchromium_src-cd8db1dfaf165cbca88f38ecf50a5cacc09959b1.zip
chromium_src-cd8db1dfaf165cbca88f38ecf50a5cacc09959b1.tar.gz
chromium_src-cd8db1dfaf165cbca88f38ecf50a5cacc09959b1.tar.bz2
Revert of [Sync] Refactor AttachmentStore classes. Introduce concept of referrer. (patchset #2 id:20001 of https://codereview.chromium.org/986743004/)
Reason for revert: I think this CL is responsible for tree closing compile failure https://build.chromium.org/p/chromium.mac/builders/iOS_Device/builds/26672/steps/compile/logs/stdio. Original issue's description: > [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} TBR=maniscalco@chromium.org,cjhopman@chromium.org,pavely@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=457735 Review URL: https://codereview.chromium.org/996473005 Cr-Commit-Position: refs/heads/master@{#319760}
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, 110 insertions, 215 deletions
diff --git a/sync/api/attachments/attachment_store.cc b/sync/api/attachments/attachment_store.cc
index 7cf774e..91b3f95 100644
--- a/sync/api/attachments/attachment_store.cc
+++ b/sync/api/attachments/attachment_store.cc
@@ -10,53 +10,16 @@
#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_frontend.h"
+#include "sync/internal_api/public/attachments/attachment_store_handle.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(
- 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);
-}
+AttachmentStore::AttachmentStore() {}
+AttachmentStore::~AttachmentStore() {}
-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() {
+scoped_refptr<AttachmentStore> AttachmentStore::CreateInMemoryStore() {
// Both frontend and backend of attachment store will live on current thread.
scoped_refptr<base::SingleThreadTaskRunner> runner;
if (base::ThreadTaskRunnerHandle::IsSet()) {
@@ -69,38 +32,34 @@ scoped_ptr<AttachmentStore> AttachmentStore::CreateInMemoryStore() {
}
scoped_ptr<AttachmentStoreBackend> backend(
new InMemoryAttachmentStore(runner));
- scoped_refptr<AttachmentStoreFrontend> frontend(
- new AttachmentStoreFrontend(backend.Pass(), runner));
- scoped_ptr<AttachmentStore> attachment_store(
- new AttachmentStore(frontend, MODEL_TYPE));
- return attachment_store.Pass();
+ return scoped_refptr<AttachmentStore>(
+ new AttachmentStoreHandle(backend.Pass(), runner));
}
-scoped_ptr<AttachmentStore> AttachmentStore::CreateOnDiskStore(
+scoped_refptr<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<AttachmentStoreFrontend> frontend =
- new AttachmentStoreFrontend(backend.Pass(), backend_task_runner);
- scoped_ptr<AttachmentStore> attachment_store(
- new AttachmentStore(frontend, MODEL_TYPE));
- frontend->Init(callback);
+ 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) {
+}
- return attachment_store.Pass();
+AttachmentStoreBackend::~AttachmentStoreBackend() {
}
-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();
+void AttachmentStoreBackend::PostCallback(const base::Closure& callback) {
+ callback_task_runner_->PostTask(FROM_HERE, callback);
}
} // namespace syncer
diff --git a/sync/api/attachments/attachment_store.h b/sync/api/attachments/attachment_store.h
index e8d8f5c..b183de1 100644
--- a/sync/api/attachments/attachment_store.h
+++ b/sync/api/attachments/attachment_store.h
@@ -15,13 +15,14 @@
namespace base {
class FilePath;
+class RefCountedMemory;
class SequencedTaskRunner;
} // namespace base
namespace syncer {
-class AttachmentStoreFrontend;
-class AttachmentStoreBackend;
+class Attachment;
+class AttachmentId;
// AttachmentStore is a place to locally store and access Attachments.
//
@@ -31,7 +32,8 @@ class AttachmentStoreBackend;
// 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 {
+class SYNC_EXPORT AttachmentStore
+ : public base::RefCountedThreadSafe<AttachmentStore> {
public:
// TODO(maniscalco): Consider udpating Read and Write methods to support
// resumable transfers (bug 353292).
@@ -47,14 +49,6 @@ 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>,
@@ -65,7 +59,15 @@ class SYNC_EXPORT AttachmentStore {
scoped_ptr<AttachmentMetadataList>)>
ReadMetadataCallback;
- ~AttachmentStore();
+ 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;
// Asynchronously reads the attachments identified by |ids|.
//
@@ -79,7 +81,8 @@ class SYNC_EXPORT AttachmentStore {
//
// Reads on individual attachments are treated atomically; |callback| will not
// read only part of an attachment.
- void Read(const AttachmentIdList& ids, const ReadCallback& callback);
+ virtual void Read(const AttachmentIdList& ids,
+ const ReadCallback& callback) = 0;
// Asynchronously writes |attachments| to the store.
//
@@ -90,7 +93,8 @@ 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.
- void Write(const AttachmentList& attachments, const WriteCallback& callback);
+ virtual void Write(const AttachmentList& attachments,
+ const WriteCallback& callback) = 0;
// Asynchronously drops |attchments| from this store.
//
@@ -101,7 +105,8 @@ 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.
- void Drop(const AttachmentIdList& ids, const DropCallback& callback);
+ virtual void Drop(const AttachmentIdList& ids,
+ const DropCallback& callback) = 0;
// Asynchronously reads metadata for the attachments identified by |ids|.
//
@@ -109,52 +114,72 @@ 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.
- void ReadMetadata(const AttachmentIdList& ids,
- const ReadMetadataCallback& callback);
+ virtual void ReadMetadata(const AttachmentIdList& ids,
+ const ReadMetadataCallback& callback) = 0;
// 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.
- 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(
+ 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(
const base::FilePath& path,
const scoped_refptr<base::SequencedTaskRunner>& backend_task_runner,
const InitCallback& 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);
+ protected:
+ friend class base::RefCountedThreadSafe<AttachmentStore>;
+ virtual ~AttachmentStore();
+};
- private:
- AttachmentStore(const scoped_refptr<AttachmentStoreFrontend>& frontend,
- AttachmentReferrer referrer);
+// 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);
- scoped_refptr<AttachmentStoreFrontend> frontend_;
- // Modification operations with attachment store will be performed on behalf
- // of |referrer_|.
- const AttachmentReferrer referrer_;
+ private:
+ scoped_refptr<base::SequencedTaskRunner> callback_task_runner_;
- DISALLOW_COPY_AND_ASSIGN(AttachmentStore);
+ DISALLOW_COPY_AND_ASSIGN(AttachmentStoreBackend);
};
} // namespace syncer
diff --git a/sync/api/attachments/attachment_store_backend.cc b/sync/api/attachments/attachment_store_backend.cc
deleted file mode 100644
index 44363cc..0000000
--- a/sync/api/attachments/attachment_store_backend.cc
+++ /dev/null
@@ -1,24 +0,0 @@
-// 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
deleted file mode 100644
index 74859fe..0000000
--- a/sync/api/attachments/attachment_store_backend.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// 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 d2177e9..ec7b90c 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(
- scoped_ptr<AttachmentStore> attachment_store) {
- attachment_store_ = attachment_store.Pass();
+ const scoped_refptr<AttachmentStore>& attachment_store) {
+ attachment_store_ = attachment_store;
}
const AttachmentService* FakeSyncableService::attachment_service() const {
@@ -70,9 +70,8 @@ SyncError FakeSyncableService::ProcessSyncChanges(
return process_sync_changes_error_;
}
-scoped_ptr<AttachmentStore> FakeSyncableService::GetAttachmentStoreForSync() {
- return attachment_store_ ? attachment_store_->CreateAttachmentStoreForSync()
- : scoped_ptr<AttachmentStore>();
+scoped_refptr<AttachmentStore> FakeSyncableService::GetAttachmentStore() {
+ return attachment_store_;
}
void FakeSyncableService::SetAttachmentService(
diff --git a/sync/api/fake_syncable_service.h b/sync/api/fake_syncable_service.h
index 9b75647..7403ef3 100644
--- a/sync/api/fake_syncable_service.h
+++ b/sync/api/fake_syncable_service.h
@@ -23,7 +23,8 @@ class FakeSyncableService : public SyncableService {
void set_process_sync_changes_error(const SyncError& error);
// Setter for AttachmentStore.
- void set_attachment_store(scoped_ptr<AttachmentStore> attachment_store);
+ void set_attachment_store(
+ const scoped_refptr<AttachmentStore>& attachment_store);
// AttachmentService should be set when this syncable service is connected,
// just before MergeDataAndStartSyncing. NULL is returned by default.
@@ -43,7 +44,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_ptr<AttachmentStore> GetAttachmentStoreForSync() override;
+ scoped_refptr<AttachmentStore> GetAttachmentStore() override;
void SetAttachmentService(
scoped_ptr<AttachmentService> attachment_service) override;
@@ -53,7 +54,7 @@ class FakeSyncableService : public SyncableService {
SyncError process_sync_changes_error_;
bool syncing_;
ModelType type_;
- scoped_ptr<AttachmentStore> attachment_store_;
+ scoped_refptr<AttachmentStore> attachment_store_;
scoped_ptr<AttachmentService> attachment_service_;
};
diff --git a/sync/api/syncable_service.cc b/sync/api/syncable_service.cc
index f0cfe67..7b0a973 100644
--- a/sync/api/syncable_service.cc
+++ b/sync/api/syncable_service.cc
@@ -8,8 +8,8 @@ namespace syncer {
SyncableService::~SyncableService() {}
-scoped_ptr<AttachmentStore> SyncableService::GetAttachmentStoreForSync() {
- return scoped_ptr<AttachmentStore>();
+scoped_refptr<AttachmentStore> SyncableService::GetAttachmentStore() {
+ return scoped_refptr<AttachmentStore>();
}
void SyncableService::SetAttachmentService(
diff --git a/sync/api/syncable_service.h b/sync/api/syncable_service.h
index 0d5aae4..f83a017 100644
--- a/sync/api/syncable_service.h
+++ b/sync/api/syncable_service.h
@@ -66,16 +66,15 @@ class SYNC_EXPORT SyncableService
SyncError ProcessSyncChanges(const tracked_objects::Location& from_here,
const SyncChangeList& change_list) override = 0;
- // Returns AttachmentStore for use by sync when uploading or downloading
- // attachments.
+ // Returns AttachmentStore used by datatype. Attachment store is used 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
- // attachments should create attachment store, implement GetAttachmentStore
- // to return result of AttachmentStore::CreateAttachmentStoreForSync() from
- // attachment store object.
- virtual scoped_ptr<AttachmentStore> GetAttachmentStoreForSync();
+ // attachemnts should create attachment store and implement GetAttachmentStore
+ // to return pointer to it.
+ virtual scoped_refptr<AttachmentStore> GetAttachmentStore();
// Called by sync to provide AttachmentService to be used to download
// attachments.