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 SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_H_ | 5 #ifndef SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_H_ |
6 #define SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_H_ | 6 #define SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_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 "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 15 matching lines...) Expand all Loading... | |
26 | 26 |
27 // A place to locally store and access Attachments. | 27 // A place to locally store and access Attachments. |
28 // | 28 // |
29 // Destroying this object does not necessarily cancel outstanding async | 29 // Destroying this object does not necessarily cancel outstanding async |
30 // operations. If you need cancel like semantics, use WeakPtr in the callbacks. | 30 // operations. If you need cancel like semantics, use WeakPtr in the callbacks. |
31 class SYNC_EXPORT AttachmentStoreBase { | 31 class SYNC_EXPORT AttachmentStoreBase { |
32 public: | 32 public: |
33 // TODO(maniscalco): Consider udpating Read and Write methods to support | 33 // TODO(maniscalco): Consider udpating Read and Write methods to support |
34 // resumable transfers (bug 353292). | 34 // resumable transfers (bug 353292). |
35 | 35 |
36 // The result status of an attachment store operation. | |
37 // Do not re-order or delete these entries; they are used in a UMA histogram. | |
36 enum Result { | 38 enum Result { |
37 SUCCESS, // No error, all completed successfully. | 39 SUCCESS, // No error, all completed successfully. |
38 UNSPECIFIED_ERROR, // An unspecified error occurred for one or more items. | 40 UNSPECIFIED_ERROR, // An unspecified error occurred for one or more items. |
39 STORE_INITIALIZATION_FAILED, // AttachmentStore initialization failed. | 41 STORE_INITIALIZATION_FAILED, // AttachmentStore initialization failed. |
42 // When adding a value here, you must increment RESULT_SIZE below. | |
40 }; | 43 }; |
44 const int RESULT_SIZE = 3; // Size of the Result enum; used for histograms. | |
pavely
2014/12/10 22:48:34
Ok, let's assign explicit values to constants so t
| |
41 | 45 |
42 typedef base::Callback<void(const Result&)> InitCallback; | 46 typedef base::Callback<void(const Result&)> InitCallback; |
43 typedef base::Callback<void(const Result&, | 47 typedef base::Callback<void(const Result&, |
44 scoped_ptr<AttachmentMap>, | 48 scoped_ptr<AttachmentMap>, |
45 scoped_ptr<AttachmentIdList>)> ReadCallback; | 49 scoped_ptr<AttachmentIdList>)> ReadCallback; |
46 typedef base::Callback<void(const Result&)> WriteCallback; | 50 typedef base::Callback<void(const Result&)> WriteCallback; |
47 typedef base::Callback<void(const Result&)> DropCallback; | 51 typedef base::Callback<void(const Result&)> DropCallback; |
48 typedef base::Callback<void(const Result&, | 52 typedef base::Callback<void(const Result&, |
49 scoped_ptr<AttachmentMetadataList>)> | 53 scoped_ptr<AttachmentMetadataList>)> |
50 ReadMetadataCallback; | 54 ReadMetadataCallback; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
140 const InitCallback& callback); | 144 const InitCallback& callback); |
141 | 145 |
142 protected: | 146 protected: |
143 friend class base::RefCountedThreadSafe<AttachmentStore>; | 147 friend class base::RefCountedThreadSafe<AttachmentStore>; |
144 ~AttachmentStore() override; | 148 ~AttachmentStore() override; |
145 }; | 149 }; |
146 | 150 |
147 } // namespace syncer | 151 } // namespace syncer |
148 | 152 |
149 #endif // SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_H_ | 153 #endif // SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_H_ |
OLD | NEW |