Commit 90a387f2 authored by Sorin Jianu's avatar Sorin Jianu Committed by Commit Bot

Added a UMA stat to for new/old BITS jobs in the component updater.

The component updater can look into the BITS queue to see if
a job already exist to download a given component. This stat
provides an insight of whether this optimization is useful.

TBR=waffles

Bug: 737730
Change-Id: I56b31ad7b382197970b2dc49e8b42a7620a8e943
Reviewed-on: https://chromium-review.googlesource.com/564178Reviewed-by: default avatarRobert Kaplow <rkaplow@chromium.org>
Reviewed-by: default avatarJoshua Pawlicki <waffles@chromium.org>
Reviewed-by: default avatarSorin Jianu <sorin@chromium.org>
Commit-Queue: Sorin Jianu <sorin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#485352}
parent f4d9f75e
...@@ -675,8 +675,6 @@ bool BackgroundDownloader::OnStateTransferring() { ...@@ -675,8 +675,6 @@ bool BackgroundDownloader::OnStateTransferring() {
return false; return false;
} }
// Creates or opens a job for the given url and queues it up. Tries to
// install a job observer but continues on if an observer can't be set up.
HRESULT BackgroundDownloader::QueueBitsJob(const GURL& url, HRESULT BackgroundDownloader::QueueBitsJob(const GURL& url,
ComPtr<IBackgroundCopyJob>* job) { ComPtr<IBackgroundCopyJob>* job) {
DCHECK(task_runner()->RunsTasksInCurrentSequence()); DCHECK(task_runner()->RunsTasksInCurrentSequence());
...@@ -699,6 +697,9 @@ HRESULT BackgroundDownloader::QueueBitsJob(const GURL& url, ...@@ -699,6 +697,9 @@ HRESULT BackgroundDownloader::QueueBitsJob(const GURL& url,
return hr; return hr;
} }
const bool is_new_job = hr == S_OK;
UMA_HISTOGRAM_BOOLEAN("UpdateClient.BackgroundDownloaderNewJob", is_new_job);
hr = local_job->Resume(); hr = local_job->Resume();
if (FAILED(hr)) { if (FAILED(hr)) {
CleanupJob(local_job); CleanupJob(local_job);
...@@ -717,7 +718,7 @@ HRESULT BackgroundDownloader::CreateOrOpenJob(const GURL& url, ...@@ -717,7 +718,7 @@ HRESULT BackgroundDownloader::CreateOrOpenJob(const GURL& url,
bits_manager_, &jobs); bits_manager_, &jobs);
if (SUCCEEDED(hr) && !jobs.empty()) { if (SUCCEEDED(hr) && !jobs.empty()) {
*job = jobs.front(); *job = jobs.front();
return hr; return S_FALSE;
} }
ComPtr<IBackgroundCopyJob> local_job; ComPtr<IBackgroundCopyJob> local_job;
......
...@@ -87,6 +87,9 @@ class BackgroundDownloader : public CrxDownloader { ...@@ -87,6 +87,9 @@ class BackgroundDownloader : public CrxDownloader {
void StartTimer(); void StartTimer();
void OnTimer(); void OnTimer();
// Creates or opens a job for the given url and queues it up. Returns S_OK if
// a new job was created or S_FALSE if an existing job for the |url| was found
// in the BITS queue.
HRESULT QueueBitsJob(const GURL& url, HRESULT QueueBitsJob(const GURL& url,
Microsoft::WRL::ComPtr<IBackgroundCopyJob>* job); Microsoft::WRL::ComPtr<IBackgroundCopyJob>* job);
HRESULT CreateOrOpenJob(const GURL& url, HRESULT CreateOrOpenJob(const GURL& url,
......
...@@ -81111,6 +81111,15 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. ...@@ -81111,6 +81111,15 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
</summary> </summary>
</histogram> </histogram>
<histogram name="UpdateClient.BackgroundDownloaderNewJob" enum="Boolean">
<owner>sorin@chromium.org</owner>
<summary>
True if a new BITS job was created to download the url, or false, if an
existing job was found in the BITS queue. The metric is recorded when
the component updater background downloader is asked to download a CRX.
</summary>
</histogram>
<histogram name="UpdateEngine.Attempt.ConnectionType" <histogram name="UpdateEngine.Attempt.ConnectionType"
enum="UpdateEngineConnectionType"> enum="UpdateEngineConnectionType">
<owner>zeuthen@chromium.org</owner> <owner>zeuthen@chromium.org</owner>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment