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

Side by Side Diff: sync/internal_api/attachments/attachment_store_proxy.cc

Issue 601553004: Refactor FakeAttachmentStore (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "sync/internal_api/public/attachments/attachment_store_proxy.h"
6
7 #include "base/bind.h"
8 #include "base/location.h"
9 #include "base/sequenced_task_runner.h"
10 #include "sync/api/attachments/attachment.h"
11
12 namespace syncer {
13
14 AttachmentStoreProxy::AttachmentStoreProxy(
15 scoped_ptr<AttachmentStoreBase> backend,
16 const scoped_refptr<base::SequencedTaskRunner>& backend_task_runner)
17 : backend_(backend.Pass()), backend_task_runner_(backend_task_runner) {
18 DCHECK(backend_);
maniscalco 2014/09/29 20:57:52 DCHECK on task runner as well?
pavely 2014/09/29 23:27:08 Done.
19 }
20
21 AttachmentStoreProxy::~AttachmentStoreProxy() {
22 DCHECK(backend_);
23 backend_task_runner_->DeleteSoon(FROM_HERE, backend_.release());
24 }
25
26 void AttachmentStoreProxy::Read(const AttachmentIdList& ids,
27 const ReadCallback& callback) {
28 DCHECK(CalledOnValidThread());
29 DCHECK(backend_);
maniscalco 2014/09/29 20:57:52 Since the ctor guarantees backend_ starts off as n
pavely 2014/09/29 23:27:08 Done.
30 backend_task_runner_->PostTask(FROM_HERE,
31 base::Bind(&AttachmentStoreBase::Read,
32 base::Unretained(backend_.get()),
33 ids,
34 callback));
35 }
36
37 void AttachmentStoreProxy::Write(const AttachmentList& attachments,
38 const WriteCallback& callback) {
39 DCHECK(CalledOnValidThread());
40 DCHECK(backend_);
41 backend_task_runner_->PostTask(FROM_HERE,
42 base::Bind(&AttachmentStoreBase::Write,
43 base::Unretained(backend_.get()),
44 attachments,
45 callback));
46 }
47
48 void AttachmentStoreProxy::Drop(const AttachmentIdList& ids,
49 const DropCallback& callback) {
50 DCHECK(CalledOnValidThread());
51 DCHECK(backend_);
52 backend_task_runner_->PostTask(FROM_HERE,
53 base::Bind(&AttachmentStoreBase::Drop,
54 base::Unretained(backend_.get()),
55 ids,
56 callback));
57 }
58
59 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698