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

Side by Side Diff: sync/api/attachments/attachment_store_backend.h

Issue 996473005: Revert of [Sync] Refactor AttachmentStore classes. Introduce concept of referrer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_BACKEND_H_
6 #define SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_BACKEND_H_
7
8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h"
10 #include "sync/api/attachments/attachment.h"
11 #include "sync/api/attachments/attachment_id.h"
12 #include "sync/api/attachments/attachment_store.h"
13 #include "sync/base/sync_export.h"
14
15 namespace base {
16 class SequencedTaskRunner;
17 } // namespace base
18
19 namespace syncer {
20
21 // Interface for AttachmentStore backends.
22 //
23 // AttachmentStoreBackend provides interface for different backends (on-disk,
24 // in-memory). Factory methods in AttachmentStore create corresponding backend
25 // and pass reference to AttachmentStore.
26 // All functions in AttachmentStoreBackend mirror corresponding functions in
27 // AttachmentStore.
28 // All callbacks and result codes are used directly from AttachmentStore.
29 // AttachmentStoreFrontend only passes callbacks and results without modifying
30 // them, there is no need to declare separate set.
31 class SYNC_EXPORT AttachmentStoreBackend {
32 public:
33 explicit AttachmentStoreBackend(
34 const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner);
35 virtual ~AttachmentStoreBackend();
36 virtual void Init(const AttachmentStore::InitCallback& callback) = 0;
37 virtual void Read(const AttachmentIdList& ids,
38 const AttachmentStore::ReadCallback& callback) = 0;
39 virtual void Write(AttachmentStore::AttachmentReferrer referrer,
40 const AttachmentList& attachments,
41 const AttachmentStore::WriteCallback& callback) = 0;
42 virtual void Drop(AttachmentStore::AttachmentReferrer referrer,
43 const AttachmentIdList& ids,
44 const AttachmentStore::DropCallback& callback) = 0;
45 virtual void ReadMetadata(
46 const AttachmentIdList& ids,
47 const AttachmentStore::ReadMetadataCallback& callback) = 0;
48 virtual void ReadAllMetadata(
49 AttachmentStore::AttachmentReferrer referrer,
50 const AttachmentStore::ReadMetadataCallback& callback) = 0;
51
52 protected:
53 // Helper function to post callback on callback_task_runner.
54 void PostCallback(const base::Closure& callback);
55
56 private:
57 scoped_refptr<base::SequencedTaskRunner> callback_task_runner_;
58
59 DISALLOW_COPY_AND_ASSIGN(AttachmentStoreBackend);
60 };
61
62 } // namespace syncer
63
64 #endif // SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_BACKEND_H_
OLDNEW
« no previous file with comments | « sync/api/attachments/attachment_store.cc ('k') | sync/api/attachments/attachment_store_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698