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

Side by Side Diff: components/sync/core/attachments/attachment_service_proxy.h

Issue 2388673002: Revert of [Sync] Move //components/sync to the syncer namespace. (patchset #5 id:40001 of https://co (Closed)
Patch Set: Created 4 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 #ifndef COMPONENTS_SYNC_CORE_ATTACHMENTS_ATTACHMENT_SERVICE_PROXY_H_ 5 #ifndef COMPONENTS_SYNC_CORE_ATTACHMENTS_ATTACHMENT_SERVICE_PROXY_H_
6 #define COMPONENTS_SYNC_CORE_ATTACHMENTS_ATTACHMENT_SERVICE_PROXY_H_ 6 #define COMPONENTS_SYNC_CORE_ATTACHMENTS_ATTACHMENT_SERVICE_PROXY_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 26 matching lines...) Expand all
37 // Construct an invalid AttachmentServiceProxy. 37 // Construct an invalid AttachmentServiceProxy.
38 AttachmentServiceProxy(); 38 AttachmentServiceProxy();
39 39
40 // Construct an AttachmentServiceProxy that forwards calls to |wrapped| on the 40 // Construct an AttachmentServiceProxy that forwards calls to |wrapped| on the
41 // |wrapped_task_runner| thread. 41 // |wrapped_task_runner| thread.
42 // 42 //
43 // Note, this object does not own |wrapped|. When |wrapped| is destroyed, 43 // Note, this object does not own |wrapped|. When |wrapped| is destroyed,
44 // calls to this object become no-ops. 44 // calls to this object become no-ops.
45 AttachmentServiceProxy( 45 AttachmentServiceProxy(
46 const scoped_refptr<base::SequencedTaskRunner>& wrapped_task_runner, 46 const scoped_refptr<base::SequencedTaskRunner>& wrapped_task_runner,
47 const base::WeakPtr<AttachmentService>& wrapped); 47 const base::WeakPtr<syncer::AttachmentService>& wrapped);
48 48
49 AttachmentServiceProxy(const AttachmentServiceProxy& other); 49 AttachmentServiceProxy(const AttachmentServiceProxy& other);
50 50
51 ~AttachmentServiceProxy() override; 51 ~AttachmentServiceProxy() override;
52 52
53 void GetOrDownloadAttachments(const AttachmentIdList& attachment_ids, 53 void GetOrDownloadAttachments(const AttachmentIdList& attachment_ids,
54 const GetOrDownloadCallback& callback) override; 54 const GetOrDownloadCallback& callback) override;
55 void UploadAttachments(const AttachmentIdList& attachment_ids) override; 55 void UploadAttachments(const AttachmentIdList& attachment_ids) override;
56 56
57 protected: 57 protected:
58 // Core does the work of proxying calls to AttachmentService methods from one 58 // Core does the work of proxying calls to AttachmentService methods from one
59 // thread to another so AttachmentServiceProxy can be an easy-to-use, 59 // thread to another so AttachmentServiceProxy can be an easy-to-use,
60 // non-ref-counted A ref-counted class. 60 // non-ref-counted A ref-counted class.
61 // 61 //
62 // Callback from AttachmentService are proxied back using free functions 62 // Callback from AttachmentService are proxied back using free functions
63 // defined in the .cc file (ProxyFooCallback functions). 63 // defined in the .cc file (ProxyFooCallback functions).
64 // 64 //
65 // Core is ref-counted because we want to allow AttachmentServiceProxy to be 65 // Core is ref-counted because we want to allow AttachmentServiceProxy to be
66 // copy-constructable while allowing for different implementations of Core 66 // copy-constructable while allowing for different implementations of Core
67 // (e.g. one type of core might own the wrapped AttachmentService). 67 // (e.g. one type of core might own the wrapped AttachmentService).
68 // 68 //
69 // Calls to objects of this class become no-ops once its wrapped object is 69 // Calls to objects of this class become no-ops once its wrapped object is
70 // destroyed. 70 // destroyed.
71 class Core : public AttachmentService, 71 class Core : public AttachmentService,
72 public base::RefCountedThreadSafe<Core> { 72 public base::RefCountedThreadSafe<Core> {
73 public: 73 public:
74 // Construct an AttachmentServiceProxyCore that forwards calls to |wrapped|. 74 // Construct an AttachmentServiceProxyCore that forwards calls to |wrapped|.
75 explicit Core(const base::WeakPtr<AttachmentService>& wrapped); 75 explicit Core(const base::WeakPtr<syncer::AttachmentService>& wrapped);
76 76
77 // AttachmentService implementation. 77 // AttachmentService implementation.
78 void GetOrDownloadAttachments( 78 void GetOrDownloadAttachments(
79 const AttachmentIdList& attachment_ids, 79 const AttachmentIdList& attachment_ids,
80 const GetOrDownloadCallback& callback) override; 80 const GetOrDownloadCallback& callback) override;
81 void UploadAttachments(const AttachmentIdList& attachment_ids) override; 81 void UploadAttachments(const AttachmentIdList& attachment_ids) override;
82 82
83 protected: 83 protected:
84 ~Core() override; 84 ~Core() override;
85 85
(...skipping 11 matching lines...) Expand all
97 const scoped_refptr<Core>& core); 97 const scoped_refptr<Core>& core);
98 98
99 private: 99 private:
100 scoped_refptr<base::SequencedTaskRunner> wrapped_task_runner_; 100 scoped_refptr<base::SequencedTaskRunner> wrapped_task_runner_;
101 scoped_refptr<Core> core_; 101 scoped_refptr<Core> core_;
102 }; 102 };
103 103
104 } // namespace syncer 104 } // namespace syncer
105 105
106 #endif // COMPONENTS_SYNC_CORE_ATTACHMENTS_ATTACHMENT_SERVICE_PROXY_H_ 106 #endif // COMPONENTS_SYNC_CORE_ATTACHMENTS_ATTACHMENT_SERVICE_PROXY_H_
OLDNEW
« no previous file with comments | « components/sync/core/attachments/attachment_service_impl.h ('k') | components/sync/core/base_node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698