| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_BACKEND_H_ | 5 #ifndef SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_BACKEND_H_ |
| 6 #define SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_BACKEND_H_ | 6 #define SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_BACKEND_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "sync/api/attachments/attachment.h" | 10 #include "sync/api/attachments/attachment.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // AttachmentStoreFrontend only passes callbacks and results without modifying | 29 // AttachmentStoreFrontend only passes callbacks and results without modifying |
| 30 // them, there is no need to declare separate set. | 30 // them, there is no need to declare separate set. |
| 31 class SYNC_EXPORT AttachmentStoreBackend { | 31 class SYNC_EXPORT AttachmentStoreBackend { |
| 32 public: | 32 public: |
| 33 explicit AttachmentStoreBackend( | 33 explicit AttachmentStoreBackend( |
| 34 const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner); | 34 const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner); |
| 35 virtual ~AttachmentStoreBackend(); | 35 virtual ~AttachmentStoreBackend(); |
| 36 virtual void Init(const AttachmentStore::InitCallback& callback) = 0; | 36 virtual void Init(const AttachmentStore::InitCallback& callback) = 0; |
| 37 virtual void Read(const AttachmentIdList& ids, | 37 virtual void Read(const AttachmentIdList& ids, |
| 38 const AttachmentStore::ReadCallback& callback) = 0; | 38 const AttachmentStore::ReadCallback& callback) = 0; |
| 39 virtual void Write(AttachmentStore::AttachmentReferrer referrer, | 39 virtual void Write(AttachmentStore::Component component, |
| 40 const AttachmentList& attachments, | 40 const AttachmentList& attachments, |
| 41 const AttachmentStore::WriteCallback& callback) = 0; | 41 const AttachmentStore::WriteCallback& callback) = 0; |
| 42 virtual void Drop(AttachmentStore::AttachmentReferrer referrer, | 42 virtual void SetReference(AttachmentStore::Component component, |
| 43 const AttachmentIdList& ids, | 43 const AttachmentIdList& ids) = 0; |
| 44 const AttachmentStore::DropCallback& callback) = 0; | 44 virtual void DropReference(AttachmentStore::Component component, |
| 45 const AttachmentIdList& ids, |
| 46 const AttachmentStore::DropCallback& callback) = 0; |
| 45 virtual void ReadMetadata( | 47 virtual void ReadMetadata( |
| 46 const AttachmentIdList& ids, | 48 const AttachmentIdList& ids, |
| 47 const AttachmentStore::ReadMetadataCallback& callback) = 0; | 49 const AttachmentStore::ReadMetadataCallback& callback) = 0; |
| 48 virtual void ReadAllMetadata( | 50 virtual void ReadAllMetadata( |
| 49 AttachmentStore::AttachmentReferrer referrer, | 51 AttachmentStore::Component component, |
| 50 const AttachmentStore::ReadMetadataCallback& callback) = 0; | 52 const AttachmentStore::ReadMetadataCallback& callback) = 0; |
| 51 | 53 |
| 52 protected: | 54 protected: |
| 53 // Helper function to post callback on callback_task_runner. | 55 // Helper function to post callback on callback_task_runner. |
| 54 void PostCallback(const base::Closure& callback); | 56 void PostCallback(const base::Closure& callback); |
| 55 | 57 |
| 56 private: | 58 private: |
| 57 scoped_refptr<base::SequencedTaskRunner> callback_task_runner_; | 59 scoped_refptr<base::SequencedTaskRunner> callback_task_runner_; |
| 58 | 60 |
| 59 DISALLOW_COPY_AND_ASSIGN(AttachmentStoreBackend); | 61 DISALLOW_COPY_AND_ASSIGN(AttachmentStoreBackend); |
| 60 }; | 62 }; |
| 61 | 63 |
| 62 } // namespace syncer | 64 } // namespace syncer |
| 63 | 65 |
| 64 #endif // SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_BACKEND_H_ | 66 #endif // SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_BACKEND_H_ |
| OLD | NEW |