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

Side by Side Diff: sync/internal_api/public/attachments/attachment_service_impl.h

Issue 548373003: Move AttachmentStore ownership to datatype (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Changes after feedback. Created 6 years, 3 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
« no previous file with comments | « sync/internal_api/attachments/attachment_service_impl_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 17 matching lines...) Expand all
28 // must be valid throughout AttachmentService lifetime. 28 // must be valid throughout AttachmentService lifetime.
29 // 29 //
30 // |attachment_uploader| is optional. If null, attachments will never be 30 // |attachment_uploader| is optional. If null, attachments will never be
31 // uploaded to the sync server and |delegate|'s OnAttachmentUploaded will 31 // uploaded to the sync server and |delegate|'s OnAttachmentUploaded will
32 // never be invoked. 32 // never be invoked.
33 // 33 //
34 // |attachment_downloader| is optional. If null, attachments will never be 34 // |attachment_downloader| is optional. If null, attachments will never be
35 // downloaded. Only attachments in |attachment_store| will be returned from 35 // downloaded. Only attachments in |attachment_store| will be returned from
36 // GetOrDownloadAttachments. 36 // GetOrDownloadAttachments.
37 37
38 AttachmentServiceImpl(scoped_ptr<AttachmentStore> attachment_store, 38 AttachmentServiceImpl(scoped_refptr<AttachmentStore> attachment_store,
39 scoped_ptr<AttachmentUploader> attachment_uploader, 39 scoped_ptr<AttachmentUploader> attachment_uploader,
40 scoped_ptr<AttachmentDownloader> attachment_downloader, 40 scoped_ptr<AttachmentDownloader> attachment_downloader,
41 Delegate* delegate); 41 Delegate* delegate);
42 virtual ~AttachmentServiceImpl(); 42 virtual ~AttachmentServiceImpl();
43 43
44 // Create an AttachmentServiceImpl suitable for use in tests. 44 // Create an AttachmentServiceImpl suitable for use in tests.
45 static scoped_ptr<syncer::AttachmentService> CreateForTest(); 45 static scoped_ptr<syncer::AttachmentService> CreateForTest();
46 46
47 // AttachmentService implementation. 47 // AttachmentService implementation.
48 virtual AttachmentStore* GetStore() OVERRIDE; 48 virtual AttachmentStore* GetStore() OVERRIDE;
(...skipping 19 matching lines...) Expand all
68 void DownloadDone(const scoped_refptr<GetOrDownloadState>& state, 68 void DownloadDone(const scoped_refptr<GetOrDownloadState>& state,
69 const AttachmentId& attachment_id, 69 const AttachmentId& attachment_id,
70 const AttachmentDownloader::DownloadResult& result, 70 const AttachmentDownloader::DownloadResult& result,
71 scoped_ptr<Attachment> attachment); 71 scoped_ptr<Attachment> attachment);
72 void ProcessQueuedUploads(); 72 void ProcessQueuedUploads();
73 void ReadDoneNowUpload( 73 void ReadDoneNowUpload(
74 const AttachmentStore::Result& result, 74 const AttachmentStore::Result& result,
75 scoped_ptr<AttachmentMap> attachments, 75 scoped_ptr<AttachmentMap> attachments,
76 scoped_ptr<AttachmentIdList> unavailable_attachment_ids); 76 scoped_ptr<AttachmentIdList> unavailable_attachment_ids);
77 77
78 const scoped_ptr<AttachmentStore> attachment_store_; 78 scoped_refptr<AttachmentStore> attachment_store_;
79 79
80 // May be null. 80 // May be null.
81 const scoped_ptr<AttachmentUploader> attachment_uploader_; 81 const scoped_ptr<AttachmentUploader> attachment_uploader_;
82 82
83 // May be null. 83 // May be null.
84 const scoped_ptr<AttachmentDownloader> attachment_downloader_; 84 const scoped_ptr<AttachmentDownloader> attachment_downloader_;
85 85
86 // May be null. 86 // May be null.
87 Delegate* delegate_; 87 Delegate* delegate_;
88 88
89 // Queue of attachment ids to be uploaded. Every entry in this queue should 89 // Queue of attachment ids to be uploaded. Every entry in this queue should
90 // also exist in ids_in_queue_. 90 // also exist in ids_in_queue_.
91 std::deque<AttachmentId> queue_; 91 std::deque<AttachmentId> queue_;
92 92
93 // Ids of attachments currently being uploaded or queued for upload. 93 // Ids of attachments currently being uploaded or queued for upload.
94 AttachmentIdSet ids_in_queue_; 94 AttachmentIdSet ids_in_queue_;
95 95
96 // Must be last data member. 96 // Must be last data member.
97 base::WeakPtrFactory<AttachmentServiceImpl> weak_ptr_factory_; 97 base::WeakPtrFactory<AttachmentServiceImpl> weak_ptr_factory_;
98 98
99 DISALLOW_COPY_AND_ASSIGN(AttachmentServiceImpl); 99 DISALLOW_COPY_AND_ASSIGN(AttachmentServiceImpl);
100 }; 100 };
101 101
102 } // namespace syncer 102 } // namespace syncer
103 103
104 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ 104 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_
OLDNEW
« no previous file with comments | « sync/internal_api/attachments/attachment_service_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698