OLD | NEW |
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 #include "sync/internal_api/public/attachments/attachment_store_frontend.h" | 5 #include "sync/internal_api/public/attachments/attachment_store_frontend.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/sequenced_task_runner.h" | 9 #include "base/sequenced_task_runner.h" |
10 #include "sync/api/attachments/attachment.h" | 10 #include "sync/api/attachments/attachment.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 void AttachmentStoreFrontend::Read( | 49 void AttachmentStoreFrontend::Read( |
50 const AttachmentIdList& ids, | 50 const AttachmentIdList& ids, |
51 const AttachmentStore::ReadCallback& callback) { | 51 const AttachmentStore::ReadCallback& callback) { |
52 DCHECK(CalledOnValidThread()); | 52 DCHECK(CalledOnValidThread()); |
53 backend_task_runner_->PostTask( | 53 backend_task_runner_->PostTask( |
54 FROM_HERE, base::Bind(&AttachmentStoreBackend::Read, | 54 FROM_HERE, base::Bind(&AttachmentStoreBackend::Read, |
55 base::Unretained(backend_.get()), ids, callback)); | 55 base::Unretained(backend_.get()), ids, callback)); |
56 } | 56 } |
57 | 57 |
58 void AttachmentStoreFrontend::Write( | 58 void AttachmentStoreFrontend::Write( |
59 AttachmentStore::AttachmentReferrer referrer, | 59 AttachmentStore::Component component, |
60 const AttachmentList& attachments, | 60 const AttachmentList& attachments, |
61 const AttachmentStore::WriteCallback& callback) { | 61 const AttachmentStore::WriteCallback& callback) { |
62 DCHECK(CalledOnValidThread()); | 62 DCHECK(CalledOnValidThread()); |
63 backend_task_runner_->PostTask( | 63 backend_task_runner_->PostTask( |
64 FROM_HERE, base::Bind(&AttachmentStoreBackend::Write, | 64 FROM_HERE, base::Bind(&AttachmentStoreBackend::Write, |
65 base::Unretained(backend_.get()), referrer, | 65 base::Unretained(backend_.get()), component, |
66 attachments, callback)); | 66 attachments, callback)); |
67 } | 67 } |
68 | 68 |
69 void AttachmentStoreFrontend::Drop( | 69 void AttachmentStoreFrontend::SetReference(AttachmentStore::Component component, |
70 AttachmentStore::AttachmentReferrer referrer, | 70 const AttachmentIdList& ids) { |
| 71 DCHECK(CalledOnValidThread()); |
| 72 backend_task_runner_->PostTask( |
| 73 FROM_HERE, base::Bind(&AttachmentStoreBackend::SetReference, |
| 74 base::Unretained(backend_.get()), component, ids)); |
| 75 } |
| 76 |
| 77 void AttachmentStoreFrontend::DropReference( |
| 78 AttachmentStore::Component component, |
71 const AttachmentIdList& ids, | 79 const AttachmentIdList& ids, |
72 const AttachmentStore::DropCallback& callback) { | 80 const AttachmentStore::DropCallback& callback) { |
73 DCHECK(CalledOnValidThread()); | 81 DCHECK(CalledOnValidThread()); |
74 backend_task_runner_->PostTask( | 82 backend_task_runner_->PostTask( |
75 FROM_HERE, | 83 FROM_HERE, |
76 base::Bind(&AttachmentStoreBackend::Drop, | 84 base::Bind(&AttachmentStoreBackend::DropReference, |
77 base::Unretained(backend_.get()), referrer, ids, callback)); | 85 base::Unretained(backend_.get()), component, ids, callback)); |
78 } | 86 } |
79 | 87 |
80 void AttachmentStoreFrontend::ReadMetadata( | 88 void AttachmentStoreFrontend::ReadMetadata( |
81 const AttachmentIdList& ids, | 89 const AttachmentIdList& ids, |
82 const AttachmentStore::ReadMetadataCallback& callback) { | 90 const AttachmentStore::ReadMetadataCallback& callback) { |
83 DCHECK(CalledOnValidThread()); | 91 DCHECK(CalledOnValidThread()); |
84 backend_task_runner_->PostTask( | 92 backend_task_runner_->PostTask( |
85 FROM_HERE, base::Bind(&AttachmentStoreBackend::ReadMetadata, | 93 FROM_HERE, base::Bind(&AttachmentStoreBackend::ReadMetadata, |
86 base::Unretained(backend_.get()), ids, callback)); | 94 base::Unretained(backend_.get()), ids, callback)); |
87 } | 95 } |
88 | 96 |
89 void AttachmentStoreFrontend::ReadAllMetadata( | 97 void AttachmentStoreFrontend::ReadAllMetadata( |
90 AttachmentStore::AttachmentReferrer referrer, | 98 AttachmentStore::Component component, |
91 const AttachmentStore::ReadMetadataCallback& callback) { | 99 const AttachmentStore::ReadMetadataCallback& callback) { |
92 DCHECK(CalledOnValidThread()); | 100 DCHECK(CalledOnValidThread()); |
93 backend_task_runner_->PostTask( | 101 backend_task_runner_->PostTask( |
94 FROM_HERE, | 102 FROM_HERE, |
95 base::Bind(&AttachmentStoreBackend::ReadAllMetadata, | 103 base::Bind(&AttachmentStoreBackend::ReadAllMetadata, |
96 base::Unretained(backend_.get()), referrer, callback)); | 104 base::Unretained(backend_.get()), component, callback)); |
97 } | 105 } |
98 | 106 |
99 } // namespace syncer | 107 } // namespace syncer |
OLD | NEW |