Chromium Code Reviews| Index: components/download/internal/model_impl.cc |
| diff --git a/components/download/internal/model_impl.cc b/components/download/internal/model_impl.cc |
| index f061b5de07d4e6325450faf15124f2be323021d1..6efd0e78fb0293cf721b2bcd420a9c894ea80eb3 100644 |
| --- a/components/download/internal/model_impl.cc |
| +++ b/components/download/internal/model_impl.cc |
| @@ -20,13 +20,14 @@ ModelImpl::~ModelImpl() = default; |
| void ModelImpl::Initialize() { |
| DCHECK(!store_->IsInitialized()); |
| - store_->Initialize(base::Bind(&ModelImpl::OnInitializedFinished, |
| - weak_ptr_factory_.GetWeakPtr())); |
| + store_->Initialize(base::BindOnce(&ModelImpl::OnInitializedFinished, |
| + weak_ptr_factory_.GetWeakPtr())); |
| } |
| void ModelImpl::Destroy() { |
|
David Trainor- moved to gerrit
2017/05/24 19:17:31
Just get rid of this as well!
|
| - store_->Destroy(base::Bind(&ModelImpl::OnDestroyFinished, |
| - weak_ptr_factory_.GetWeakPtr())); |
| + store_.reset(); |
| + entries_.clear(); |
| + client_->OnDestroyed(); |
| } |
| void ModelImpl::Add(const Entry& entry) { |
| @@ -35,9 +36,9 @@ void ModelImpl::Add(const Entry& entry) { |
| entries_.emplace(entry.guid, base::MakeUnique<Entry>(entry)); |
| - store_->Update(entry, base::Bind(&ModelImpl::OnAddFinished, |
| - weak_ptr_factory_.GetWeakPtr(), entry.client, |
| - entry.guid)); |
| + store_->Update(entry, base::BindOnce(&ModelImpl::OnAddFinished, |
| + weak_ptr_factory_.GetWeakPtr(), |
| + entry.client, entry.guid)); |
| } |
| void ModelImpl::Update(const Entry& entry) { |
| @@ -45,9 +46,9 @@ void ModelImpl::Update(const Entry& entry) { |
| DCHECK(entries_.find(entry.guid) != entries_.end()); |
| entries_[entry.guid] = base::MakeUnique<Entry>(entry); |
| - store_->Update(entry, base::Bind(&ModelImpl::OnUpdateFinished, |
| - weak_ptr_factory_.GetWeakPtr(), entry.client, |
| - entry.guid)); |
| + store_->Update(entry, base::BindOnce(&ModelImpl::OnUpdateFinished, |
| + weak_ptr_factory_.GetWeakPtr(), |
| + entry.client, entry.guid)); |
| } |
| void ModelImpl::Remove(const std::string& guid) { |
| @@ -59,8 +60,8 @@ void ModelImpl::Remove(const std::string& guid) { |
| DownloadClient client = it->second->client; |
| entries_.erase(it); |
| store_->Remove(guid, |
| - base::Bind(&ModelImpl::OnRemoveFinished, |
| - weak_ptr_factory_.GetWeakPtr(), client, guid)); |
| + base::BindOnce(&ModelImpl::OnRemoveFinished, |
| + weak_ptr_factory_.GetWeakPtr(), client, guid)); |
| } |
| Entry* ModelImpl::Get(const std::string& guid) { |
| @@ -90,12 +91,6 @@ void ModelImpl::OnInitializedFinished( |
| client_->OnInitialized(true); |
| } |
| -void ModelImpl::OnDestroyFinished(bool success) { |
| - store_.reset(); |
| - entries_.clear(); |
| - client_->OnDestroyed(success); |
| -} |
| - |
| void ModelImpl::OnAddFinished(DownloadClient client, |
| const std::string& guid, |
| bool success) { |