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

Side by Side Diff: sync/api/attachments/attachment_service_proxy.h

Issue 247983002: Keep track of which attachments are referenced by which sync entries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rework tests and move AttachmentIdProto creation to avoid violating DEPS. Created 6 years, 7 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 | Annotate | Revision Log
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 SYNC_API_ATTACHMENTS_ATTACHMENT_SERVICE_PROXY_H_ 5 #ifndef SYNC_API_ATTACHMENTS_ATTACHMENT_SERVICE_PROXY_H_
6 #define SYNC_API_ATTACHMENTS_ATTACHMENT_SERVICE_PROXY_H_ 6 #define SYNC_API_ATTACHMENTS_ATTACHMENT_SERVICE_PROXY_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 const base::WeakPtr<syncer::AttachmentService>& wrapped); 51 const base::WeakPtr<syncer::AttachmentService>& wrapped);
52 52
53 virtual ~AttachmentServiceProxy(); 53 virtual ~AttachmentServiceProxy();
54 54
55 // AttachmentService implementation. 55 // AttachmentService implementation.
56 virtual void GetOrDownloadAttachments( 56 virtual void GetOrDownloadAttachments(
57 const AttachmentIdList& attachment_ids, 57 const AttachmentIdList& attachment_ids,
58 const GetOrDownloadCallback& callback) OVERRIDE; 58 const GetOrDownloadCallback& callback) OVERRIDE;
59 virtual void DropAttachments(const AttachmentIdList& attachment_ids, 59 virtual void DropAttachments(const AttachmentIdList& attachment_ids,
60 const DropCallback& callback) OVERRIDE; 60 const DropCallback& callback) OVERRIDE;
61 virtual void OnSyncDataAdd(const SyncData& sync_data) OVERRIDE; 61 virtual void StoreAttachments(const AttachmentList& attachment,
62 const StoreCallback& callback) OVERRIDE;
62 virtual void OnSyncDataDelete(const SyncData& sync_data) OVERRIDE; 63 virtual void OnSyncDataDelete(const SyncData& sync_data) OVERRIDE;
63 virtual void OnSyncDataUpdate(const AttachmentIdList& old_attachment_ids, 64 virtual void OnSyncDataUpdate(const AttachmentIdList& old_attachment_ids,
64 const SyncData& updated_sync_data) OVERRIDE; 65 const SyncData& updated_sync_data) OVERRIDE;
65 66
66 protected: 67 protected:
67 // Core does the work of proxying calls to AttachmentService methods from one 68 // Core does the work of proxying calls to AttachmentService methods from one
68 // thread to another so AttachmentServiceProxy can be an easy-to-use, 69 // thread to another so AttachmentServiceProxy can be an easy-to-use,
69 // non-ref-counted A ref-counted class. 70 // non-ref-counted A ref-counted class.
70 // 71 //
71 // Callback from AttachmentService are proxied back using free functions 72 // Callback from AttachmentService are proxied back using free functions
(...skipping 10 matching lines...) Expand all
82 public: 83 public:
83 // Construct an AttachmentServiceProxyCore that forwards calls to |wrapped|. 84 // Construct an AttachmentServiceProxyCore that forwards calls to |wrapped|.
84 Core(const base::WeakPtr<syncer::AttachmentService>& wrapped); 85 Core(const base::WeakPtr<syncer::AttachmentService>& wrapped);
85 86
86 // AttachmentService implementation. 87 // AttachmentService implementation.
87 virtual void GetOrDownloadAttachments( 88 virtual void GetOrDownloadAttachments(
88 const AttachmentIdList& attachment_ids, 89 const AttachmentIdList& attachment_ids,
89 const GetOrDownloadCallback& callback) OVERRIDE; 90 const GetOrDownloadCallback& callback) OVERRIDE;
90 virtual void DropAttachments(const AttachmentIdList& attachment_ids, 91 virtual void DropAttachments(const AttachmentIdList& attachment_ids,
91 const DropCallback& callback) OVERRIDE; 92 const DropCallback& callback) OVERRIDE;
92 virtual void OnSyncDataAdd(const SyncData& sync_data) OVERRIDE; 93 virtual void StoreAttachments(const AttachmentList& attachment,
94 const StoreCallback& callback) OVERRIDE;
93 virtual void OnSyncDataDelete(const SyncData& sync_data) OVERRIDE; 95 virtual void OnSyncDataDelete(const SyncData& sync_data) OVERRIDE;
94 virtual void OnSyncDataUpdate(const AttachmentIdList& old_attachment_ids, 96 virtual void OnSyncDataUpdate(const AttachmentIdList& old_attachment_ids,
95 const SyncData& updated_sync_data) OVERRIDE; 97 const SyncData& updated_sync_data) OVERRIDE;
96 98
97 protected: 99 protected:
98 friend class base::RefCountedThreadSafe<Core>; 100 friend class base::RefCountedThreadSafe<Core>;
99 virtual ~Core(); 101 virtual ~Core();
100 102
101 private: 103 private:
102 base::WeakPtr<AttachmentService> wrapped_; 104 base::WeakPtr<AttachmentService> wrapped_;
103 105
104 DISALLOW_COPY_AND_ASSIGN(Core); 106 DISALLOW_COPY_AND_ASSIGN(Core);
105 }; 107 };
106 108
107 // Used in tests to create an AttachmentServiceProxy with a custom Core. 109 // Used in tests to create an AttachmentServiceProxy with a custom Core.
108 AttachmentServiceProxy( 110 AttachmentServiceProxy(
109 const scoped_refptr<base::SequencedTaskRunner>& wrapped_task_runner, 111 const scoped_refptr<base::SequencedTaskRunner>& wrapped_task_runner,
110 const scoped_refptr<Core>& core); 112 const scoped_refptr<Core>& core);
111 113
112 private: 114 private:
113 scoped_refptr<base::SequencedTaskRunner> wrapped_task_runner_; 115 scoped_refptr<base::SequencedTaskRunner> wrapped_task_runner_;
114 scoped_refptr<Core> core_; 116 scoped_refptr<Core> core_;
115 }; 117 };
116 118
117 } // namespace syncer 119 } // namespace syncer
118 120
119 #endif // SYNC_API_ATTACHMENTS_ATTACHMENT_SERVICE_PROXY_H_ 121 #endif // SYNC_API_ATTACHMENTS_ATTACHMENT_SERVICE_PROXY_H_
OLDNEW
« no previous file with comments | « sync/api/attachments/attachment_service.h ('k') | sync/api/attachments/attachment_service_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698