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

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

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 5 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_service_proxy.cc
diff --git a/sync/internal_api/attachments/attachment_service_proxy.cc b/sync/internal_api/attachments/attachment_service_proxy.cc
deleted file mode 100644
index 825057fbebbbdd86adf115d96ef2bf754b25eb4f..0000000000000000000000000000000000000000
--- a/sync/internal_api/attachments/attachment_service_proxy.cc
+++ /dev/null
@@ -1,104 +0,0 @@
-// Copyright 2014 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_service_proxy.h"
-
-#include "base/bind.h"
-#include "base/message_loop/message_loop.h"
-#include "base/threading/thread_task_runner_handle.h"
-
-namespace syncer {
-
-namespace {
-
-// These ProxyFooCallback functions are used to invoke a callback in a specific
-// thread.
-
-// Invokes |callback| with |result| and |attachments| in the |task_runner|
-// thread.
-void ProxyGetOrDownloadCallback(
- const scoped_refptr<base::SequencedTaskRunner>& task_runner,
- const AttachmentService::GetOrDownloadCallback& callback,
- const AttachmentService::GetOrDownloadResult& result,
- std::unique_ptr<AttachmentMap> attachments) {
- task_runner->PostTask(
- FROM_HERE, base::Bind(callback, result, base::Passed(&attachments)));
-}
-
-} // namespace
-
-AttachmentServiceProxy::AttachmentServiceProxy() {
-}
-
-AttachmentServiceProxy::AttachmentServiceProxy(
- const scoped_refptr<base::SequencedTaskRunner>& wrapped_task_runner,
- const base::WeakPtr<syncer::AttachmentService>& wrapped)
- : wrapped_task_runner_(wrapped_task_runner), core_(new Core(wrapped)) {
- DCHECK(wrapped_task_runner_.get());
-}
-
-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_.get());
- DCHECK(core_.get());
-}
-
-AttachmentServiceProxy::AttachmentServiceProxy(
- const AttachmentServiceProxy& other) = default;
-
-AttachmentServiceProxy::~AttachmentServiceProxy() {
-}
-
-void AttachmentServiceProxy::GetOrDownloadAttachments(
- const AttachmentIdList& attachment_ids,
- const GetOrDownloadCallback& callback) {
- DCHECK(wrapped_task_runner_.get());
- GetOrDownloadCallback proxy_callback =
- base::Bind(&ProxyGetOrDownloadCallback,
- base::ThreadTaskRunnerHandle::Get(),
- callback);
- wrapped_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&AttachmentService::GetOrDownloadAttachments,
- core_,
- attachment_ids,
- proxy_callback));
-}
-
-void AttachmentServiceProxy::UploadAttachments(
- const AttachmentIdList& attachment_ids) {
- DCHECK(wrapped_task_runner_.get());
- wrapped_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&AttachmentService::UploadAttachments, core_, attachment_ids));
-}
-
-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::UploadAttachments(
- const AttachmentIdList& attachment_ids) {
- if (!wrapped_) {
- return;
- }
- wrapped_->UploadAttachments(attachment_ids);
-}
-
-} // namespace syncer

Powered by Google App Engine
This is Rietveld 408576698