Consolidates most of the callback types in the component updater.
This is a mechanical refactoring.
The idea is to use
update_client::Callback = base::Callback<void(Error error)>;
as the type of callback which is being passed as an argument
to non-blocking function in the update_client and in the
component_updater is most cases.
Before this change, there were several entities which
defined similar callbacks, such as Action, UpdateEngine, ComponentUpdater.
It just made it difficult to understand which callback does what.
BUG=615669
Review-Url: https://codereview.chromium.org/2474773002
Cr-Commit-Position: refs/heads/master@{#429462}
diff --git a/components/component_updater/component_updater_service.cc b/components/component_updater/component_updater_service.cc
index a4097e8..d6c4261 100644
--- a/components/component_updater/component_updater_service.cc
+++ b/components/component_updater/component_updater_service.cc
@@ -248,7 +248,7 @@
}
void CrxUpdateService::OnDemandUpdate(const std::string& id,
- CompletionCallback callback) {
+ const Callback& callback) {
DCHECK(thread_checker_.CalledOnValidThread());
if (!GetComponent(id)) {
@@ -275,12 +275,12 @@
return false;
}
- OnDemandUpdateInternal(id, CompletionCallback());
+ OnDemandUpdateInternal(id, Callback());
return true;
}
void CrxUpdateService::OnDemandUpdateInternal(const std::string& id,
- CompletionCallback callback) {
+ const Callback& callback) {
DCHECK(thread_checker_.CalledOnValidThread());
UMA_HISTOGRAM_ENUMERATION("ComponentUpdater.Calls", UPDATE_TYPE_MANUAL,
@@ -314,7 +314,7 @@
unsecure_ids,
base::Bind(&CrxUpdateService::OnUpdate, base::Unretained(this)),
base::Bind(&CrxUpdateService::OnUpdateComplete, base::Unretained(this),
- CompletionCallback(), base::TimeTicks::Now()));
+ Callback(), base::TimeTicks::Now()));
}
if (!secure_ids.empty()) {
@@ -322,7 +322,7 @@
secure_ids,
base::Bind(&CrxUpdateService::OnUpdate, base::Unretained(this)),
base::Bind(&CrxUpdateService::OnUpdateComplete, base::Unretained(this),
- CompletionCallback(), base::TimeTicks::Now()));
+ Callback(), base::TimeTicks::Now()));
}
return true;
@@ -375,7 +375,7 @@
}
}
-void CrxUpdateService::OnUpdateComplete(CompletionCallback callback,
+void CrxUpdateService::OnUpdateComplete(Callback callback,
const base::TimeTicks& start_time,
update_client::Error error) {
DCHECK(thread_checker_.CalledOnValidThread());