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

Side by Side Diff: components/sync/api/attachments/attachment_store.h

Issue 2240613002: [Sync] Convert sync to a static library. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Try getting rid of sync_core source set. Created 4 years, 4 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 COMPONENTS_SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_H_ 5 #ifndef COMPONENTS_SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_H_
6 #define COMPONENTS_SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_H_ 6 #define COMPONENTS_SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "components/sync/api/attachments/attachment.h" 13 #include "components/sync/api/attachments/attachment.h"
14 #include "components/sync/api/attachments/attachment_id.h" 14 #include "components/sync/api/attachments/attachment_id.h"
15 #include "components/sync/api/attachments/attachment_metadata.h" 15 #include "components/sync/api/attachments/attachment_metadata.h"
16 #include "components/sync/base/sync_export.h"
17 16
18 namespace base { 17 namespace base {
19 class FilePath; 18 class FilePath;
20 class SequencedTaskRunner; 19 class SequencedTaskRunner;
21 } // namespace base 20 } // namespace base
22 21
23 namespace syncer { 22 namespace syncer {
24 23
25 class AttachmentStoreBackend; 24 class AttachmentStoreBackend;
26 class AttachmentStoreForSync; 25 class AttachmentStoreForSync;
27 class AttachmentStoreFrontend; 26 class AttachmentStoreFrontend;
28 27
29 // AttachmentStore is a place to locally store and access Attachments. 28 // AttachmentStore is a place to locally store and access Attachments.
30 // 29 //
31 // AttachmentStore class is an interface exposed to data type and 30 // AttachmentStore class is an interface exposed to data type and
32 // AttachmentService code. 31 // AttachmentService code.
33 // It also contains factory methods for default attachment store 32 // It also contains factory methods for default attachment store
34 // implementations. 33 // implementations.
35 // Destroying this object does not necessarily cancel outstanding async 34 // Destroying this object does not necessarily cancel outstanding async
36 // operations. If you need cancel like semantics, use WeakPtr in the callbacks. 35 // operations. If you need cancel like semantics, use WeakPtr in the callbacks.
37 class SYNC_EXPORT AttachmentStore { 36 class AttachmentStore {
38 public: 37 public:
39 // TODO(maniscalco): Consider udpating Read and Write methods to support 38 // TODO(maniscalco): Consider udpating Read and Write methods to support
40 // resumable transfers (bug 353292). 39 // resumable transfers (bug 353292).
41 40
42 // The result status of an attachment store operation. 41 // The result status of an attachment store operation.
43 // Do not re-order or delete these entries; they are used in a UMA histogram. 42 // Do not re-order or delete these entries; they are used in a UMA histogram.
44 enum Result { 43 enum Result {
45 SUCCESS = 0, // No error, all completed successfully. 44 SUCCESS = 0, // No error, all completed successfully.
46 UNSPECIFIED_ERROR = 1, // An unspecified error occurred for >= 1 item. 45 UNSPECIFIED_ERROR = 1, // An unspecified error occurred for >= 1 item.
47 STORE_INITIALIZATION_FAILED = 2, // AttachmentStore initialization failed. 46 STORE_INITIALIZATION_FAILED = 2, // AttachmentStore initialization failed.
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 const Component component_; 163 const Component component_;
165 164
166 DISALLOW_COPY_AND_ASSIGN(AttachmentStore); 165 DISALLOW_COPY_AND_ASSIGN(AttachmentStore);
167 }; 166 };
168 167
169 // AttachmentStoreForSync extends AttachmentStore and provides additional 168 // AttachmentStoreForSync extends AttachmentStore and provides additional
170 // functions necessary for AttachmentService. These are needed when 169 // functions necessary for AttachmentService. These are needed when
171 // AttachmentService writes attachment on behalf of model type after download 170 // AttachmentService writes attachment on behalf of model type after download
172 // and takes reference on attachment for the duration of upload. 171 // and takes reference on attachment for the duration of upload.
173 // Model type implementation shouldn't use this interface. 172 // Model type implementation shouldn't use this interface.
174 class SYNC_EXPORT AttachmentStoreForSync : public AttachmentStore { 173 class AttachmentStoreForSync : public AttachmentStore {
175 public: 174 public:
176 ~AttachmentStoreForSync(); 175 ~AttachmentStoreForSync();
177 176
178 // Asynchronously adds reference from sync to attachments. 177 // Asynchronously adds reference from sync to attachments.
179 void SetSyncReference(const AttachmentIdList& ids); 178 void SetSyncReference(const AttachmentIdList& ids);
180 179
181 // Asynchronously adds reference from model type to attachments. 180 // Asynchronously adds reference from model type to attachments.
182 // Needed in GetOrDownloadAttachments when attachment is in local store but 181 // Needed in GetOrDownloadAttachments when attachment is in local store but
183 // doesn't have model type reference. 182 // doesn't have model type reference.
184 void SetModelTypeReference(const AttachmentIdList& ids); 183 void SetModelTypeReference(const AttachmentIdList& ids);
(...skipping 17 matching lines...) Expand all
202 // |sync_component_| is passed to frontend when sync related operations are 201 // |sync_component_| is passed to frontend when sync related operations are
203 // perfromed. 202 // perfromed.
204 const Component sync_component_; 203 const Component sync_component_;
205 204
206 DISALLOW_COPY_AND_ASSIGN(AttachmentStoreForSync); 205 DISALLOW_COPY_AND_ASSIGN(AttachmentStoreForSync);
207 }; 206 };
208 207
209 } // namespace syncer 208 } // namespace syncer
210 209
211 #endif // COMPONENTS_SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_H_ 210 #endif // COMPONENTS_SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_H_
OLDNEW
« no previous file with comments | « components/sync/api/attachments/attachment_metadata.h ('k') | components/sync/api/attachments/attachment_store_backend.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698