OLD | NEW |
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 COMPONENTS_SYNC_MODEL_ATTACHMENTS_ATTACHMENT_STORE_H_ | 5 #ifndef COMPONENTS_SYNC_MODEL_ATTACHMENTS_ATTACHMENT_STORE_H_ |
6 #define COMPONENTS_SYNC_MODEL_ATTACHMENTS_ATTACHMENT_STORE_H_ | 6 #define COMPONENTS_SYNC_MODEL_ATTACHMENTS_ATTACHMENT_STORE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 10; // Size of the Result enum; used for histograms. | 50 10; // Size of the Result enum; used for histograms. |
51 | 51 |
52 // Each attachment can have references from sync or model type. Tracking these | 52 // Each attachment can have references from sync or model type. Tracking these |
53 // references is needed for lifetime management of attachment, it can only be | 53 // references is needed for lifetime management of attachment, it can only be |
54 // deleted from the store when it doesn't have references. | 54 // deleted from the store when it doesn't have references. |
55 enum Component { | 55 enum Component { |
56 MODEL_TYPE, | 56 MODEL_TYPE, |
57 SYNC, | 57 SYNC, |
58 }; | 58 }; |
59 | 59 |
60 typedef base::Callback<void(const Result&)> InitCallback; | 60 using InitCallback = base::Callback<void(const Result&)>; |
61 typedef base::Callback<void(const Result&, | 61 using ReadCallback = base::Callback<void(const Result&, |
62 std::unique_ptr<AttachmentMap>, | 62 std::unique_ptr<AttachmentMap>, |
63 std::unique_ptr<AttachmentIdList>)> | 63 std::unique_ptr<AttachmentIdList>)>; |
64 ReadCallback; | 64 using WriteCallback = base::Callback<void(const Result&)>; |
65 typedef base::Callback<void(const Result&)> WriteCallback; | 65 using DropCallback = base::Callback<void(const Result&)>; |
66 typedef base::Callback<void(const Result&)> DropCallback; | 66 using ReadMetadataCallback = |
67 typedef base::Callback<void(const Result&, | 67 base::Callback<void(const Result&, |
68 std::unique_ptr<AttachmentMetadataList>)> | 68 std::unique_ptr<AttachmentMetadataList>)>; |
69 ReadMetadataCallback; | |
70 | 69 |
71 ~AttachmentStore(); | 70 ~AttachmentStore(); |
72 | 71 |
73 // Asynchronously reads the attachments identified by |ids|. | 72 // Asynchronously reads the attachments identified by |ids|. |
74 // | 73 // |
75 // |callback| will be invoked when finished. AttachmentStore will attempt to | 74 // |callback| will be invoked when finished. AttachmentStore will attempt to |
76 // read all attachments specified in ids. If any of the attachments do not | 75 // read all attachments specified in ids. If any of the attachments do not |
77 // exist or could not be read, |callback|'s Result will be UNSPECIFIED_ERROR. | 76 // exist or could not be read, |callback|'s Result will be UNSPECIFIED_ERROR. |
78 // Callback's AttachmentMap will contain all attachments that were | 77 // Callback's AttachmentMap will contain all attachments that were |
79 // successfully read, AttachmentIdList will contain attachment ids of | 78 // successfully read, AttachmentIdList will contain attachment ids of |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // |sync_component_| is passed to frontend when sync related operations are | 200 // |sync_component_| is passed to frontend when sync related operations are |
202 // perfromed. | 201 // perfromed. |
203 const Component sync_component_; | 202 const Component sync_component_; |
204 | 203 |
205 DISALLOW_COPY_AND_ASSIGN(AttachmentStoreForSync); | 204 DISALLOW_COPY_AND_ASSIGN(AttachmentStoreForSync); |
206 }; | 205 }; |
207 | 206 |
208 } // namespace syncer | 207 } // namespace syncer |
209 | 208 |
210 #endif // COMPONENTS_SYNC_MODEL_ATTACHMENTS_ATTACHMENT_STORE_H_ | 209 #endif // COMPONENTS_SYNC_MODEL_ATTACHMENTS_ATTACHMENT_STORE_H_ |
OLD | NEW |