| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_IN_MEMORY_ATTACHMENT_STORE_H_ | |
| 6 #define SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_IN_MEMORY_ATTACHMENT_STORE_H_ | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 #include "base/single_thread_task_runner.h" | |
| 10 #include "base/threading/non_thread_safe.h" | |
| 11 #include "sync/api/attachments/attachment.h" | |
| 12 #include "sync/api/attachments/attachment_id.h" | |
| 13 #include "sync/api/attachments/attachment_store.h" | |
| 14 #include "sync/base/sync_export.h" | |
| 15 | |
| 16 namespace syncer { | |
| 17 | |
| 18 // An in-memory implementation of AttachmentStore used for testing. | |
| 19 // InMemoryAttachmentStore is not threadsafe, it lives on backend thread and | |
| 20 // posts callbacks with results on |callback_task_runner|. | |
| 21 class SYNC_EXPORT InMemoryAttachmentStore : public AttachmentStoreBase, | |
| 22 public base::NonThreadSafe { | |
| 23 public: | |
| 24 InMemoryAttachmentStore( | |
| 25 const scoped_refptr<base::SingleThreadTaskRunner>& callback_task_runner); | |
| 26 virtual ~InMemoryAttachmentStore(); | |
| 27 | |
| 28 // AttachmentStoreBase implementation. | |
| 29 virtual void Read(const AttachmentIdList& ids, | |
| 30 const ReadCallback& callback) OVERRIDE; | |
| 31 virtual void Write(const AttachmentList& attachments, | |
| 32 const WriteCallback& callback) OVERRIDE; | |
| 33 virtual void Drop(const AttachmentIdList& ids, | |
| 34 const DropCallback& callback) OVERRIDE; | |
| 35 | |
| 36 private: | |
| 37 scoped_refptr<base::SingleThreadTaskRunner> callback_task_runner_; | |
| 38 AttachmentMap attachments_; | |
| 39 }; | |
| 40 | |
| 41 } // namespace syncer | |
| 42 | |
| 43 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_IN_MEMORY_ATTACHMENT_STORE_H_ | |
| OLD | NEW |