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

Unified Diff: sync/api/attachments/attachment_service_proxy.cc

Issue 213003004: Replace calls to 3-arg SyncData::CreateLocalData with 5-arg version. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@syncapi
Patch Set: Apply feedback from review Created 6 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 side-by-side diff with in-line comments
Download patch
Index: sync/api/attachments/attachment_service_proxy.cc
diff --git a/sync/api/attachments/attachment_service_proxy.cc b/sync/api/attachments/attachment_service_proxy.cc
index 065f467b54688c60edf42effc0494320285fe03a..b95a41faa38d367acffb69f52f6ffb0c47458370 100644
--- a/sync/api/attachments/attachment_service_proxy.cc
+++ b/sync/api/attachments/attachment_service_proxy.cc
@@ -36,16 +36,26 @@ void ProxyDropCallback(
} // namespace
-AttachmentServiceProxy::AttachmentServiceProxy() {}
+AttachmentServiceProxy::AttachmentServiceProxy() {
+}
AttachmentServiceProxy::AttachmentServiceProxy(
const scoped_refptr<base::SequencedTaskRunner>& wrapped_task_runner,
- base::WeakPtr<syncer::AttachmentService> wrapped)
- : wrapped_task_runner_(wrapped_task_runner), wrapped_(wrapped) {
+ const base::WeakPtr<syncer::AttachmentService>& wrapped)
+ : wrapped_task_runner_(wrapped_task_runner), core_(new Core(wrapped)) {
DCHECK(wrapped_task_runner_);
}
-AttachmentServiceProxy::~AttachmentServiceProxy() {}
+AttachmentServiceProxy::AttachmentServiceProxy(
+ const scoped_refptr<base::SequencedTaskRunner>& wrapped_task_runner,
+ const scoped_refptr<Core>& core)
+ : wrapped_task_runner_(wrapped_task_runner), core_(core) {
+ DCHECK(wrapped_task_runner_);
+ DCHECK(core_);
+}
+
+AttachmentServiceProxy::~AttachmentServiceProxy() {
+}
void AttachmentServiceProxy::GetOrDownloadAttachments(
const AttachmentIdList& attachment_ids,
@@ -56,7 +66,7 @@ void AttachmentServiceProxy::GetOrDownloadAttachments(
wrapped_task_runner_->PostTask(
FROM_HERE,
base::Bind(&AttachmentService::GetOrDownloadAttachments,
- wrapped_,
+ core_,
attachment_ids,
proxy_callback));
}
@@ -69,7 +79,7 @@ void AttachmentServiceProxy::DropAttachments(
&ProxyDropCallback, base::MessageLoopProxy::current(), callback);
wrapped_task_runner_->PostTask(FROM_HERE,
base::Bind(&AttachmentService::DropAttachments,
- wrapped_,
+ core_,
attachment_ids,
proxy_callback));
}
@@ -78,14 +88,14 @@ void AttachmentServiceProxy::OnSyncDataAdd(const SyncData& sync_data) {
DCHECK(wrapped_task_runner_);
wrapped_task_runner_->PostTask(
FROM_HERE,
- base::Bind(&AttachmentService::OnSyncDataAdd, wrapped_, sync_data));
+ base::Bind(&AttachmentService::OnSyncDataAdd, core_, sync_data));
}
void AttachmentServiceProxy::OnSyncDataDelete(const SyncData& sync_data) {
DCHECK(wrapped_task_runner_);
wrapped_task_runner_->PostTask(
FROM_HERE,
- base::Bind(&AttachmentService::OnSyncDataDelete, wrapped_, sync_data));
+ base::Bind(&AttachmentService::OnSyncDataDelete, core_, sync_data));
}
void AttachmentServiceProxy::OnSyncDataUpdate(
@@ -95,9 +105,58 @@ void AttachmentServiceProxy::OnSyncDataUpdate(
wrapped_task_runner_->PostTask(
FROM_HERE,
base::Bind(&AttachmentService::OnSyncDataUpdate,
- wrapped_,
+ core_,
old_attachment_ids,
updated_sync_data));
}
+AttachmentServiceProxy::Core::Core(
+ const base::WeakPtr<syncer::AttachmentService>& wrapped)
+ : wrapped_(wrapped) {
+}
+
+AttachmentServiceProxy::Core::~Core() {
+}
+
+void AttachmentServiceProxy::Core::GetOrDownloadAttachments(
+ const AttachmentIdList& attachment_ids,
+ const GetOrDownloadCallback& callback) {
+ if (!wrapped_) {
+ return;
+ }
+ wrapped_->GetOrDownloadAttachments(attachment_ids, callback);
+}
+
+void AttachmentServiceProxy::Core::DropAttachments(
+ const AttachmentIdList& attachment_ids,
+ const DropCallback& callback) {
+ if (!wrapped_) {
+ return;
+ }
+ wrapped_->DropAttachments(attachment_ids, callback);
+}
+
+void AttachmentServiceProxy::Core::OnSyncDataAdd(const SyncData& sync_data) {
+ if (!wrapped_) {
+ return;
+ }
+ wrapped_->OnSyncDataAdd(sync_data);
+}
+
+void AttachmentServiceProxy::Core::OnSyncDataDelete(const SyncData& sync_data) {
+ if (!wrapped_) {
+ return;
+ }
+ wrapped_->OnSyncDataDelete(sync_data);
+}
+
+void AttachmentServiceProxy::Core::OnSyncDataUpdate(
+ const AttachmentIdList& old_attachment_ids,
+ const SyncData& updated_sync_data) {
+ if (!wrapped_) {
+ return;
+ }
+ wrapped_->OnSyncDataUpdate(old_attachment_ids, updated_sync_data);
+}
+
} // namespace syncer
« no previous file with comments | « sync/api/attachments/attachment_service_proxy.h ('k') | sync/api/attachments/attachment_service_proxy_for_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698