Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Side by Side Diff: sync/internal_api/public/attachments/in_memory_attachment_store.h

Issue 986743004: [Sync] Refactor AttachmentStore classes. Introduce concept of referrer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_INTERNAL_API_PUBLIC_ATTACHMENTS_IN_MEMORY_ATTACHMENT_STORE_H_ 5 #ifndef SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_IN_MEMORY_ATTACHMENT_STORE_H_
6 #define SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_IN_MEMORY_ATTACHMENT_STORE_H_ 6 #define SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_IN_MEMORY_ATTACHMENT_STORE_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/threading/non_thread_safe.h" 9 #include "base/threading/non_thread_safe.h"
10 #include "sync/api/attachments/attachment.h" 10 #include "sync/api/attachments/attachment.h"
11 #include "sync/api/attachments/attachment_id.h" 11 #include "sync/api/attachments/attachment_id.h"
12 #include "sync/api/attachments/attachment_store.h" 12 #include "sync/api/attachments/attachment_store.h"
13 #include "sync/api/attachments/attachment_store_backend.h"
13 #include "sync/base/sync_export.h" 14 #include "sync/base/sync_export.h"
14 15
15 namespace base { 16 namespace base {
16 class SequencedTaskRunner; 17 class SequencedTaskRunner;
17 } // namespace base 18 } // namespace base
18 19
19 namespace syncer { 20 namespace syncer {
20 21
21 // An in-memory implementation of AttachmentStore used for testing. 22 // An in-memory implementation of AttachmentStore used for testing.
22 // InMemoryAttachmentStore is not threadsafe, it lives on backend thread and 23 // InMemoryAttachmentStore is not threadsafe, it lives on backend thread and
23 // posts callbacks with results on |callback_task_runner|. 24 // posts callbacks with results on |callback_task_runner|.
24 class SYNC_EXPORT InMemoryAttachmentStore : public AttachmentStoreBackend, 25 class SYNC_EXPORT InMemoryAttachmentStore : public AttachmentStoreBackend,
25 public base::NonThreadSafe { 26 public base::NonThreadSafe {
26 public: 27 public:
27 InMemoryAttachmentStore( 28 InMemoryAttachmentStore(
28 const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner); 29 const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner);
29 ~InMemoryAttachmentStore() override; 30 ~InMemoryAttachmentStore() override;
30 31
31 // AttachmentStoreBackend implementation. 32 // AttachmentStoreBackend implementation.
32 void Init(const AttachmentStore::InitCallback& callback) override; 33 void Init(const AttachmentStore::InitCallback& callback) override;
33 void Read(const AttachmentIdList& ids, 34 void Read(const AttachmentIdList& ids,
34 const AttachmentStore::ReadCallback& callback) override; 35 const AttachmentStore::ReadCallback& callback) override;
35 void Write(const AttachmentList& attachments, 36 void Write(AttachmentStore::AttachmentReferrer referrer,
37 const AttachmentList& attachments,
36 const AttachmentStore::WriteCallback& callback) override; 38 const AttachmentStore::WriteCallback& callback) override;
37 void Drop(const AttachmentIdList& ids, 39 void Drop(AttachmentStore::AttachmentReferrer referrer,
40 const AttachmentIdList& ids,
38 const AttachmentStore::DropCallback& callback) override; 41 const AttachmentStore::DropCallback& callback) override;
39 void ReadMetadata( 42 void ReadMetadata(
40 const AttachmentIdList& ids, 43 const AttachmentIdList& ids,
41 const AttachmentStore::ReadMetadataCallback& callback) override; 44 const AttachmentStore::ReadMetadataCallback& callback) override;
42 void ReadAllMetadata( 45 void ReadAllMetadata(
46 AttachmentStore::AttachmentReferrer referrer,
43 const AttachmentStore::ReadMetadataCallback& callback) override; 47 const AttachmentStore::ReadMetadataCallback& callback) override;
44 48
45 private: 49 private:
46 AttachmentMap attachments_; 50 AttachmentMap attachments_;
47 51
48 DISALLOW_COPY_AND_ASSIGN(InMemoryAttachmentStore); 52 DISALLOW_COPY_AND_ASSIGN(InMemoryAttachmentStore);
49 }; 53 };
50 54
51 } // namespace syncer 55 } // namespace syncer
52 56
53 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_IN_MEMORY_ATTACHMENT_STORE_H_ 57 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_IN_MEMORY_ATTACHMENT_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698