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

Unified Diff: components/download/internal/model_impl.cc

Issue 2881173003: Download Service : Added leveldb proto layer (Closed)
Patch Set: Removed Model::Destroy Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/download/internal/model_impl.h ('k') | components/download/internal/model_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..3ab384b3ca1dbd3aca6e758c2c96ca4dc95bb74e 100644
--- a/components/download/internal/model_impl.cc
+++ b/components/download/internal/model_impl.cc
@@ -20,13 +20,8 @@ ModelImpl::~ModelImpl() = default;
void ModelImpl::Initialize() {
DCHECK(!store_->IsInitialized());
- store_->Initialize(base::Bind(&ModelImpl::OnInitializedFinished,
- weak_ptr_factory_.GetWeakPtr()));
-}
-
-void ModelImpl::Destroy() {
- store_->Destroy(base::Bind(&ModelImpl::OnDestroyFinished,
- weak_ptr_factory_.GetWeakPtr()));
+ store_->Initialize(base::BindOnce(&ModelImpl::OnInitializedFinished,
+ weak_ptr_factory_.GetWeakPtr()));
}
void ModelImpl::Add(const Entry& entry) {
@@ -35,9 +30,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 +40,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 +54,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 +85,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) {
« no previous file with comments | « components/download/internal/model_impl.h ('k') | components/download/internal/model_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698