Index: sync/api/attachments/fake_attachment_store.cc |
diff --git a/sync/api/attachments/fake_attachment_store.cc b/sync/api/attachments/fake_attachment_store.cc |
index 99ee76aa0218cfc7c6614d654e22e5a1dfb9da66..ab1e3fd0d88d0bf1db9cd0ba2f246254eeae2a24 100644 |
--- a/sync/api/attachments/fake_attachment_store.cc |
+++ b/sync/api/attachments/fake_attachment_store.cc |
@@ -29,21 +29,16 @@ class FakeAttachmentStore::Backend |
private: |
friend class base::RefCountedThreadSafe<Backend>; |
- typedef std::string UniqueId; |
- typedef std::map<UniqueId, Attachment*> AttachmentMap; |
~Backend(); |
- Result Remove(const sync_pb::AttachmentId& id); |
scoped_refptr<base::SingleThreadTaskRunner> frontend_task_runner_; |
AttachmentMap attachments_; |
- STLValueDeleter<AttachmentMap> attachments_value_deleter_; |
}; |
FakeAttachmentStore::Backend::Backend( |
const scoped_refptr<base::SingleThreadTaskRunner>& frontend_task_runner) |
- : frontend_task_runner_(frontend_task_runner), |
- attachments_value_deleter_(&attachments_) {} |
+ : frontend_task_runner_(frontend_task_runner) {} |
FakeAttachmentStore::Backend::~Backend() {} |
@@ -53,7 +48,7 @@ void FakeAttachmentStore::Backend::Read(const sync_pb::AttachmentId& id, |
scoped_ptr<Attachment> attachment; |
Result result = NOT_FOUND; |
if (iter != attachments_.end()) { |
- attachment.reset(new Attachment(*iter->second)); |
+ attachment.reset(new Attachment(iter->second)); |
result = SUCCESS; |
} |
frontend_task_runner_->PostTask( |
@@ -63,31 +58,23 @@ void FakeAttachmentStore::Backend::Read(const sync_pb::AttachmentId& id, |
void FakeAttachmentStore::Backend::Write( |
const scoped_refptr<base::RefCountedMemory>& bytes, |
const WriteCallback& callback) { |
- scoped_ptr<Attachment> attachment = Attachment::Create(bytes); |
- DCHECK(attachment.get()); |
- sync_pb::AttachmentId attachment_id(attachment->GetId()); |
- attachments_.insert(AttachmentMap::value_type(attachment_id.unique_id(), |
- attachment.release())); |
+ Attachment attachment = Attachment::Create(bytes); |
+ sync_pb::AttachmentId attachment_id(attachment.GetId()); |
+ attachments_.insert( |
+ AttachmentMap::value_type(attachment_id.unique_id(), attachment)); |
frontend_task_runner_->PostTask(FROM_HERE, |
base::Bind(callback, SUCCESS, attachment_id)); |
} |
void FakeAttachmentStore::Backend::Drop(const sync_pb::AttachmentId& id, |
const DropCallback& callback) { |
- Result result = Remove(id); |
- frontend_task_runner_->PostTask(FROM_HERE, base::Bind(callback, result)); |
-} |
- |
-AttachmentStore::Result FakeAttachmentStore::Backend::Remove( |
- const sync_pb::AttachmentId& id) { |
Result result = NOT_FOUND; |
AttachmentMap::iterator iter = attachments_.find(id.unique_id()); |
if (iter != attachments_.end()) { |
- delete iter->second; |
attachments_.erase(iter); |
result = SUCCESS; |
} |
- return result; |
+ frontend_task_runner_->PostTask(FROM_HERE, base::Bind(callback, result)); |
} |
FakeAttachmentStore::FakeAttachmentStore( |