| OLD | NEW |
| 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 #include "sync/api/attachments/attachment_store.h" | 5 #include "sync/api/attachments/attachment_store.h" |
| 6 | 6 |
| 7 #include "base/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.h" |
| 8 #include "sync/internal_api/public/attachments/attachment_store_handle.h" | 8 #include "sync/internal_api/public/attachments/attachment_store_handle.h" |
| 9 #include "sync/internal_api/public/attachments/in_memory_attachment_store.h" | 9 #include "sync/internal_api/public/attachments/in_memory_attachment_store.h" |
| 10 #include "sync/internal_api/public/attachments/on_disk_attachment_store.h" |
| 10 | 11 |
| 11 namespace syncer { | 12 namespace syncer { |
| 12 | 13 |
| 13 AttachmentStoreBase::AttachmentStoreBase() {} | 14 AttachmentStoreBase::AttachmentStoreBase() {} |
| 14 AttachmentStoreBase::~AttachmentStoreBase() {} | 15 AttachmentStoreBase::~AttachmentStoreBase() {} |
| 15 | 16 |
| 16 AttachmentStore::AttachmentStore() {} | 17 AttachmentStore::AttachmentStore() {} |
| 17 AttachmentStore::~AttachmentStore() {} | 18 AttachmentStore::~AttachmentStore() {} |
| 18 | 19 |
| 19 scoped_refptr<AttachmentStore> AttachmentStore::CreateInMemoryStore() { | 20 scoped_refptr<AttachmentStore> AttachmentStore::CreateInMemoryStore() { |
| 20 // Both frontend and backend of attachment store will live on current thread. | 21 // Both frontend and backend of attachment store will live on current thread. |
| 21 scoped_ptr<AttachmentStoreBase> backend( | 22 scoped_ptr<AttachmentStoreBase> backend( |
| 22 new InMemoryAttachmentStore(base::ThreadTaskRunnerHandle::Get())); | 23 new InMemoryAttachmentStore(base::ThreadTaskRunnerHandle::Get())); |
| 23 return scoped_refptr<AttachmentStore>(new AttachmentStoreHandle( | 24 return scoped_refptr<AttachmentStore>(new AttachmentStoreHandle( |
| 24 backend.Pass(), base::ThreadTaskRunnerHandle::Get())); | 25 backend.Pass(), base::ThreadTaskRunnerHandle::Get())); |
| 25 } | 26 } |
| 26 | 27 |
| 28 scoped_refptr<AttachmentStore> AttachmentStore::CreateOnDiskStore( |
| 29 const base::FilePath& path) { |
| 30 scoped_ptr<AttachmentStoreBase> backend( |
| 31 new OnDiskAttachmentStore(path, base::ThreadTaskRunnerHandle::Get())); |
| 32 return scoped_refptr<AttachmentStore>(new AttachmentStoreHandle( |
| 33 backend.Pass(), base::ThreadTaskRunnerHandle::Get())); |
| 34 } |
| 35 |
| 27 } // namespace syncer | 36 } // namespace syncer |
| OLD | NEW |