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

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

Issue 1866243002: Convert //sync from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_STORE_FRONTEND_H_ 5 #ifndef SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_STORE_FRONTEND_H_
6 #define SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_STORE_FRONTEND_H_ 6 #define SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_STORE_FRONTEND_H_
7 7
8 #include <memory>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/threading/non_thread_safe.h" 12 #include "base/threading/non_thread_safe.h"
12 #include "sync/api/attachments/attachment_store.h" 13 #include "sync/api/attachments/attachment_store.h"
13 14
14 namespace base { 15 namespace base {
15 class SequencedTaskRunner; 16 class SequencedTaskRunner;
16 } // namespace base 17 } // namespace base
17 18
18 namespace syncer { 19 namespace syncer {
19 20
20 class AttachmentStoreBackend; 21 class AttachmentStoreBackend;
21 22
22 // AttachmentStoreFrontend is helper to post AttachmentStore calls to backend on 23 // AttachmentStoreFrontend is helper to post AttachmentStore calls to backend on
23 // different thread. Backend is expected to know on which thread to post 24 // different thread. Backend is expected to know on which thread to post
24 // callbacks with results. 25 // callbacks with results.
25 // AttachmentStoreFrontend takes ownership of backend. Backend is deleted on 26 // AttachmentStoreFrontend takes ownership of backend. Backend is deleted on
26 // backend thread. 27 // backend thread.
27 // AttachmentStoreFrontend is not thread safe, it should only be accessed from 28 // AttachmentStoreFrontend is not thread safe, it should only be accessed from
28 // model thread. 29 // model thread.
29 // Method signatures of AttachmentStoreFrontend match exactly methods of 30 // Method signatures of AttachmentStoreFrontend match exactly methods of
30 // AttachmentStoreBackend. 31 // AttachmentStoreBackend.
31 class SYNC_EXPORT AttachmentStoreFrontend 32 class SYNC_EXPORT AttachmentStoreFrontend
32 : public base::RefCounted<AttachmentStoreFrontend>, 33 : public base::RefCounted<AttachmentStoreFrontend>,
33 public base::NonThreadSafe { 34 public base::NonThreadSafe {
34 public: 35 public:
35 AttachmentStoreFrontend( 36 AttachmentStoreFrontend(
36 scoped_ptr<AttachmentStoreBackend> backend, 37 std::unique_ptr<AttachmentStoreBackend> backend,
37 const scoped_refptr<base::SequencedTaskRunner>& backend_task_runner); 38 const scoped_refptr<base::SequencedTaskRunner>& backend_task_runner);
38 39
39 void Init(const AttachmentStore::InitCallback& callback); 40 void Init(const AttachmentStore::InitCallback& callback);
40 41
41 void Read(AttachmentStore::Component component, 42 void Read(AttachmentStore::Component component,
42 const AttachmentIdList& ids, 43 const AttachmentIdList& ids,
43 const AttachmentStore::ReadCallback& callback); 44 const AttachmentStore::ReadCallback& callback);
44 45
45 void Write(AttachmentStore::Component component, 46 void Write(AttachmentStore::Component component,
46 const AttachmentList& attachments, 47 const AttachmentList& attachments,
47 const AttachmentStore::WriteCallback& callback); 48 const AttachmentStore::WriteCallback& callback);
48 void SetReference(AttachmentStore::Component component, 49 void SetReference(AttachmentStore::Component component,
49 const AttachmentIdList& ids); 50 const AttachmentIdList& ids);
50 void DropReference(AttachmentStore::Component component, 51 void DropReference(AttachmentStore::Component component,
51 const AttachmentIdList& ids, 52 const AttachmentIdList& ids,
52 const AttachmentStore::DropCallback& callback); 53 const AttachmentStore::DropCallback& callback);
53 54
54 void ReadMetadataById(AttachmentStore::Component component, 55 void ReadMetadataById(AttachmentStore::Component component,
55 const AttachmentIdList& ids, 56 const AttachmentIdList& ids,
56 const AttachmentStore::ReadMetadataCallback& callback); 57 const AttachmentStore::ReadMetadataCallback& callback);
57 58
58 void ReadMetadata(AttachmentStore::Component component, 59 void ReadMetadata(AttachmentStore::Component component,
59 const AttachmentStore::ReadMetadataCallback& callback); 60 const AttachmentStore::ReadMetadataCallback& callback);
60 61
61 private: 62 private:
62 friend class base::RefCounted<AttachmentStoreFrontend>; 63 friend class base::RefCounted<AttachmentStoreFrontend>;
63 virtual ~AttachmentStoreFrontend(); 64 virtual ~AttachmentStoreFrontend();
64 65
65 scoped_ptr<AttachmentStoreBackend> backend_; 66 std::unique_ptr<AttachmentStoreBackend> backend_;
66 scoped_refptr<base::SequencedTaskRunner> backend_task_runner_; 67 scoped_refptr<base::SequencedTaskRunner> backend_task_runner_;
67 68
68 DISALLOW_COPY_AND_ASSIGN(AttachmentStoreFrontend); 69 DISALLOW_COPY_AND_ASSIGN(AttachmentStoreFrontend);
69 }; 70 };
70 71
71 } // namespace syncer 72 } // namespace syncer
72 73
73 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_STORE_FRONTEND_H_ 74 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_STORE_FRONTEND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698