| Index: components/component_updater/component_updater_service.cc
|
| diff --git a/components/component_updater/component_updater_service.cc b/components/component_updater/component_updater_service.cc
|
| index fce7e996b2ea86761e9856805d49a2e52c34d571..5d20b7c56913b4e12a4a9b29cc92e585c970bf9f 100644
|
| --- a/components/component_updater/component_updater_service.cc
|
| +++ b/components/component_updater/component_updater_service.cc
|
| @@ -18,11 +18,13 @@
|
| #include "base/logging.h"
|
| #include "base/macros.h"
|
| #include "base/memory/scoped_ptr.h"
|
| +#include "base/metrics/histogram_macros.h"
|
| #include "base/sequenced_task_runner.h"
|
| #include "base/single_thread_task_runner.h"
|
| #include "base/thread_task_runner_handle.h"
|
| #include "base/threading/sequenced_worker_pool.h"
|
| #include "base/threading/thread_checker.h"
|
| +#include "base/time/time.h"
|
| #include "base/timer/timer.h"
|
| #include "components/component_updater/component_updater_service_internal.h"
|
| #include "components/component_updater/timer.h"
|
| @@ -235,15 +237,21 @@ bool CrxUpdateService::OnDemandUpdateWithCooldown(const std::string& id) {
|
| bool CrxUpdateService::OnDemandUpdateInternal(const std::string& id) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|
| + UMA_HISTOGRAM_ENUMERATION("ComponentUpdater.Install.Count", 1, 2);
|
| +
|
| update_client_->Install(
|
| id, base::Bind(&CrxUpdateService::OnUpdate, base::Unretained(this)),
|
| - base::Bind(&CrxUpdateService::OnUpdateComplete, base::Unretained(this)));
|
| + base::Bind(&CrxUpdateService::OnUpdateComplete, base::Unretained(this),
|
| + base::TimeTicks::Now()));
|
|
|
| return true;
|
| }
|
|
|
| bool CrxUpdateService::CheckForUpdates() {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| +
|
| + UMA_HISTOGRAM_ENUMERATION("ComponentUpdater.Update.Count", 1, 2);
|
| +
|
| std::vector<std::string> ids;
|
| for (const auto id : components_order_) {
|
| DCHECK(components_.find(id) != components_.end());
|
| @@ -252,7 +260,8 @@ bool CrxUpdateService::CheckForUpdates() {
|
|
|
| update_client_->Update(
|
| ids, base::Bind(&CrxUpdateService::OnUpdate, base::Unretained(this)),
|
| - base::Bind(&CrxUpdateService::OnUpdateComplete, base::Unretained(this)));
|
| + base::Bind(&CrxUpdateService::OnUpdateComplete, base::Unretained(this),
|
| + base::TimeTicks::Now()));
|
|
|
| return true;
|
| }
|
| @@ -296,10 +305,15 @@ void CrxUpdateService::OnUpdate(const std::vector<std::string>& ids,
|
| }
|
| }
|
|
|
| -void CrxUpdateService::OnUpdateComplete(int error) {
|
| +void CrxUpdateService::OnUpdateComplete(const base::TimeTicks& start_time,
|
| + int error) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| VLOG(1) << "Update completed with error " << error;
|
|
|
| + UMA_HISTOGRAM_BOOLEAN("ComponentUpdater.Update.Result", error != 0);
|
| + UMA_HISTOGRAM_TIMES("ComponentUpdater.UpdateCompleteTime",
|
| + base::TimeTicks::Now() - start_time);
|
| +
|
| for (const auto id : components_pending_unregistration_) {
|
| if (!update_client_->IsUpdating(id)) {
|
| const auto component = GetComponent(id);
|
|
|