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_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ |
6 #define SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // must be valid throughout AttachmentService lifetime. | 43 // must be valid throughout AttachmentService lifetime. |
44 // | 44 // |
45 // |initial_backoff_delay| the initial delay between upload attempts. This | 45 // |initial_backoff_delay| the initial delay between upload attempts. This |
46 // class automatically retries failed uploads. After the first failure, it | 46 // class automatically retries failed uploads. After the first failure, it |
47 // will wait this amount of time until it tries again. After each failure, | 47 // will wait this amount of time until it tries again. After each failure, |
48 // the delay is doubled until the |max_backoff_delay| is reached. A | 48 // the delay is doubled until the |max_backoff_delay| is reached. A |
49 // successful upload clears the delay. | 49 // successful upload clears the delay. |
50 // | 50 // |
51 // |max_backoff_delay| the maxmium delay between upload attempts when backed | 51 // |max_backoff_delay| the maxmium delay between upload attempts when backed |
52 // off. | 52 // off. |
53 AttachmentServiceImpl(scoped_ptr<AttachmentStore> attachment_store, | 53 AttachmentServiceImpl(scoped_ptr<AttachmentStoreForSync> attachment_store, |
54 scoped_ptr<AttachmentUploader> attachment_uploader, | 54 scoped_ptr<AttachmentUploader> attachment_uploader, |
55 scoped_ptr<AttachmentDownloader> attachment_downloader, | 55 scoped_ptr<AttachmentDownloader> attachment_downloader, |
56 Delegate* delegate, | 56 Delegate* delegate, |
57 const base::TimeDelta& initial_backoff_delay, | 57 const base::TimeDelta& initial_backoff_delay, |
58 const base::TimeDelta& max_backoff_delay); | 58 const base::TimeDelta& max_backoff_delay); |
59 ~AttachmentServiceImpl() override; | 59 ~AttachmentServiceImpl() override; |
60 | 60 |
61 // Create an AttachmentServiceImpl suitable for use in tests. | 61 // Create an AttachmentServiceImpl suitable for use in tests. |
62 static scoped_ptr<syncer::AttachmentService> CreateForTest(); | 62 static scoped_ptr<syncer::AttachmentService> CreateForTest(); |
63 | 63 |
(...skipping 26 matching lines...) Expand all Loading... |
90 void DownloadDone(const scoped_refptr<GetOrDownloadState>& state, | 90 void DownloadDone(const scoped_refptr<GetOrDownloadState>& state, |
91 const AttachmentId& attachment_id, | 91 const AttachmentId& attachment_id, |
92 const AttachmentDownloader::DownloadResult& result, | 92 const AttachmentDownloader::DownloadResult& result, |
93 scoped_ptr<Attachment> attachment); | 93 scoped_ptr<Attachment> attachment); |
94 void BeginUpload(const AttachmentId& attachment_id); | 94 void BeginUpload(const AttachmentId& attachment_id); |
95 void ReadDoneNowUpload( | 95 void ReadDoneNowUpload( |
96 const AttachmentStore::Result& result, | 96 const AttachmentStore::Result& result, |
97 scoped_ptr<AttachmentMap> attachments, | 97 scoped_ptr<AttachmentMap> attachments, |
98 scoped_ptr<AttachmentIdList> unavailable_attachment_ids); | 98 scoped_ptr<AttachmentIdList> unavailable_attachment_ids); |
99 | 99 |
100 scoped_ptr<AttachmentStore> attachment_store_; | 100 scoped_ptr<AttachmentStoreForSync> attachment_store_; |
101 | 101 |
102 // May be null. | 102 // May be null. |
103 const scoped_ptr<AttachmentUploader> attachment_uploader_; | 103 const scoped_ptr<AttachmentUploader> attachment_uploader_; |
104 | 104 |
105 // May be null. | 105 // May be null. |
106 const scoped_ptr<AttachmentDownloader> attachment_downloader_; | 106 const scoped_ptr<AttachmentDownloader> attachment_downloader_; |
107 | 107 |
108 // May be null. | 108 // May be null. |
109 Delegate* delegate_; | 109 Delegate* delegate_; |
110 | 110 |
111 scoped_ptr<TaskQueue<AttachmentId> > upload_task_queue_; | 111 scoped_ptr<TaskQueue<AttachmentId> > upload_task_queue_; |
112 | 112 |
113 // Must be last data member. | 113 // Must be last data member. |
114 base::WeakPtrFactory<AttachmentServiceImpl> weak_ptr_factory_; | 114 base::WeakPtrFactory<AttachmentServiceImpl> weak_ptr_factory_; |
115 | 115 |
116 DISALLOW_COPY_AND_ASSIGN(AttachmentServiceImpl); | 116 DISALLOW_COPY_AND_ASSIGN(AttachmentServiceImpl); |
117 }; | 117 }; |
118 | 118 |
119 } // namespace syncer | 119 } // namespace syncer |
120 | 120 |
121 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ | 121 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ |
OLD | NEW |