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

Unified Diff: sync/internal_api/attachments/attachment_store_frontend.cc

Issue 986743004: [Sync] Refactor AttachmentStore classes. Introduce concept of referrer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: sync/internal_api/attachments/attachment_store_frontend.cc
diff --git a/sync/internal_api/attachments/attachment_store_handle.cc b/sync/internal_api/attachments/attachment_store_frontend.cc
similarity index 52%
rename from sync/internal_api/attachments/attachment_store_handle.cc
rename to sync/internal_api/attachments/attachment_store_frontend.cc
index 5e3591b7e4dfaf7c7a730008b827e0f4b13cd876..97547de734af6fd0e1d4316cbb2518d3c36e719d 100644
--- a/sync/internal_api/attachments/attachment_store_handle.cc
+++ b/sync/internal_api/attachments/attachment_store_frontend.cc
@@ -1,26 +1,27 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "sync/internal_api/public/attachments/attachment_store_handle.h"
+#include "sync/internal_api/public/attachments/attachment_store_frontend.h"
#include "base/bind.h"
#include "base/location.h"
#include "base/sequenced_task_runner.h"
#include "sync/api/attachments/attachment.h"
+#include "sync/api/attachments/attachment_store_backend.h"
namespace syncer {
namespace {
-// NoOp is needed to bind base::Passed(backend) in AttachmentStoreHandle dtor.
+// NoOp is needed to bind base::Passed(backend) in AttachmentStoreFrontend dtor.
// It doesn't need to do anything.
void NoOp(scoped_ptr<AttachmentStoreBackend> backend) {
}
} // namespace
-AttachmentStoreHandle::AttachmentStoreHandle(
+AttachmentStoreFrontend::AttachmentStoreFrontend(
scoped_ptr<AttachmentStoreBackend> backend,
const scoped_refptr<base::SequencedTaskRunner>& backend_task_runner)
: backend_(backend.Pass()), backend_task_runner_(backend_task_runner) {
@@ -28,61 +29,71 @@ AttachmentStoreHandle::AttachmentStoreHandle(
DCHECK(backend_task_runner_.get());
}
-AttachmentStoreHandle::~AttachmentStoreHandle() {
+AttachmentStoreFrontend::~AttachmentStoreFrontend() {
DCHECK(backend_);
// To delete backend post task that doesn't do anything, but binds backend
// through base::Passed. This way backend will be deleted regardless whether
// task runs or not.
- backend_task_runner_->PostTask(
- FROM_HERE, base::Bind(&NoOp, base::Passed(&backend_)));
+ backend_task_runner_->PostTask(FROM_HERE,
+ base::Bind(&NoOp, base::Passed(&backend_)));
}
-void AttachmentStoreHandle::Init(const InitCallback& callback) {
+void AttachmentStoreFrontend::Init(
+ const AttachmentStore::InitCallback& callback) {
DCHECK(CalledOnValidThread());
backend_task_runner_->PostTask(
FROM_HERE, base::Bind(&AttachmentStoreBackend::Init,
base::Unretained(backend_.get()), callback));
}
-void AttachmentStoreHandle::Read(const AttachmentIdList& ids,
- const ReadCallback& callback) {
+void AttachmentStoreFrontend::Read(
+ const AttachmentIdList& ids,
+ const AttachmentStore::ReadCallback& callback) {
DCHECK(CalledOnValidThread());
backend_task_runner_->PostTask(
FROM_HERE, base::Bind(&AttachmentStoreBackend::Read,
base::Unretained(backend_.get()), ids, callback));
}
-void AttachmentStoreHandle::Write(const AttachmentList& attachments,
- const WriteCallback& callback) {
+void AttachmentStoreFrontend::Write(
+ AttachmentStore::AttachmentReferrer referrer,
+ const AttachmentList& attachments,
+ const AttachmentStore::WriteCallback& callback) {
DCHECK(CalledOnValidThread());
backend_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&AttachmentStoreBackend::Write,
- base::Unretained(backend_.get()), attachments, callback));
+ FROM_HERE, base::Bind(&AttachmentStoreBackend::Write,
+ base::Unretained(backend_.get()), referrer,
+ attachments, callback));
}
-void AttachmentStoreHandle::Drop(const AttachmentIdList& ids,
- const DropCallback& callback) {
+void AttachmentStoreFrontend::Drop(
+ AttachmentStore::AttachmentReferrer referrer,
+ const AttachmentIdList& ids,
+ const AttachmentStore::DropCallback& callback) {
DCHECK(CalledOnValidThread());
backend_task_runner_->PostTask(
- FROM_HERE, base::Bind(&AttachmentStoreBackend::Drop,
- base::Unretained(backend_.get()), ids, callback));
+ FROM_HERE,
+ base::Bind(&AttachmentStoreBackend::Drop,
+ base::Unretained(backend_.get()), referrer, ids, callback));
}
-void AttachmentStoreHandle::ReadMetadata(const AttachmentIdList& ids,
- const ReadMetadataCallback& callback) {
+void AttachmentStoreFrontend::ReadMetadata(
+ const AttachmentIdList& ids,
+ const AttachmentStore::ReadMetadataCallback& callback) {
DCHECK(CalledOnValidThread());
backend_task_runner_->PostTask(
FROM_HERE, base::Bind(&AttachmentStoreBackend::ReadMetadata,
base::Unretained(backend_.get()), ids, callback));
}
-void AttachmentStoreHandle::ReadAllMetadata(
- const ReadMetadataCallback& callback) {
+void AttachmentStoreFrontend::ReadAllMetadata(
+ AttachmentStore::AttachmentReferrer referrer,
+ const AttachmentStore::ReadMetadataCallback& callback) {
DCHECK(CalledOnValidThread());
backend_task_runner_->PostTask(
- FROM_HERE, base::Bind(&AttachmentStoreBackend::ReadAllMetadata,
- base::Unretained(backend_.get()), callback));
+ FROM_HERE,
+ base::Bind(&AttachmentStoreBackend::ReadAllMetadata,
+ base::Unretained(backend_.get()), referrer, callback));
}
} // namespace syncer

Powered by Google App Engine
This is Rietveld 408576698