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

Unified Diff: components/update_client/background_downloader_win.cc

Issue 808773005: Move most of the component updater artifacts to update_client. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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/update_client/background_downloader_win.h ('k') | components/update_client/component_patcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/update_client/background_downloader_win.cc
diff --git a/components/component_updater/background_downloader_win.cc b/components/update_client/background_downloader_win.cc
similarity index 95%
rename from components/component_updater/background_downloader_win.cc
rename to components/update_client/background_downloader_win.cc
index 2e9b9972c3e11c0c9c4836677a8058fe75237a85..536fafd30039b49507c92d5f9046ed7f7b4a7e26 100644
--- a/components/component_updater/background_downloader_win.cc
+++ b/components/update_client/background_downloader_win.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/component_updater/background_downloader_win.h"
+#include "components/update_client/background_downloader_win.h"
#include <atlbase.h>
#include <atlcom.h>
@@ -20,7 +20,7 @@
#include "base/single_thread_task_runner.h"
#include "base/strings/sys_string_conversions.h"
#include "base/win/scoped_co_mem.h"
-#include "components/component_updater/component_updater_utils.h"
+#include "components/update_client/utils.h"
#include "ui/base/win/atl_module.h"
#include "url/gurl.h"
@@ -93,7 +93,7 @@ using base::win::ScopedComPtr;
// Last, after completing a job, irrespective of the outcome, the jobs older
// than a week are proactively cleaned up.
-namespace component_updater {
+namespace update_client {
namespace {
@@ -141,7 +141,7 @@ int GetHttpStatusFromBitsError(HRESULT error) {
// Returns the files in a BITS job.
HRESULT GetFilesInJob(IBackgroundCopyJob* job,
- std::vector<ScopedComPtr<IBackgroundCopyFile> >* files) {
+ std::vector<ScopedComPtr<IBackgroundCopyFile>>* files) {
ScopedComPtr<IEnumBackgroundCopyFiles> enum_files;
HRESULT hr = job->EnumFiles(enum_files.Receive());
if (FAILED(hr))
@@ -259,7 +259,7 @@ HRESULT GetJobError(IBackgroundCopyJob* job, HRESULT* error_code_out) {
template <class Predicate>
HRESULT FindBitsJobIf(Predicate pred,
IBackgroundCopyManager* bits_manager,
- std::vector<ScopedComPtr<IBackgroundCopyJob> >* jobs) {
+ std::vector<ScopedComPtr<IBackgroundCopyJob>>* jobs) {
ScopedComPtr<IEnumBackgroundCopyJobs> enum_jobs;
HRESULT hr = bits_manager->EnumJobs(0, enum_jobs.Receive());
if (FAILED(hr))
@@ -317,7 +317,7 @@ struct JobFileUrlEqual : public std::binary_function<IBackgroundCopyJob*,
bool JobFileUrlEqual::operator()(IBackgroundCopyJob* job,
const base::string16& remote_name) const {
- std::vector<ScopedComPtr<IBackgroundCopyFile> > files;
+ std::vector<ScopedComPtr<IBackgroundCopyFile>> files;
HRESULT hr = GetFilesInJob(job, &files);
if (FAILED(hr))
return false;
@@ -344,7 +344,7 @@ HRESULT GetBitsManager(IBackgroundCopyManager** bits_manager) {
}
void CleanupJobFiles(IBackgroundCopyJob* job) {
- std::vector<ScopedComPtr<IBackgroundCopyFile> > files;
+ std::vector<ScopedComPtr<IBackgroundCopyFile>> files;
if (FAILED(GetFilesInJob(job, &files)))
return;
for (size_t i = 0; i != files.size(); ++i) {
@@ -371,7 +371,7 @@ HRESULT CleanupStaleJobs(
last_sweep = current_time;
- std::vector<ScopedComPtr<IBackgroundCopyJob> > jobs;
+ std::vector<ScopedComPtr<IBackgroundCopyJob>> jobs;
HRESULT hr = FindBitsJobIf(
std::bind2nd(JobCreationOlderThanDays(), kPurgeStaleJobsAfterDays),
bits_manager.get(), &jobs);
@@ -418,10 +418,9 @@ BackgroundDownloader::~BackgroundDownloader() {
void BackgroundDownloader::DoStartDownload(const GURL& url) {
DCHECK(thread_checker_.CalledOnValidThread());
- task_runner_->PostTask(
- FROM_HERE,
- base::Bind(
- &BackgroundDownloader::BeginDownload, base::Unretained(this), url));
+ task_runner_->PostTask(FROM_HERE,
+ base::Bind(&BackgroundDownloader::BeginDownload,
+ base::Unretained(this), url));
}
// Called once when this class is asked to do a download. Creates or opens
@@ -444,10 +443,8 @@ void BackgroundDownloader::BeginDownload(const GURL& url) {
// A repeating timer retains the user task. This timer can be stopped and
// reset multiple times.
timer_.reset(new base::RepeatingTimer<BackgroundDownloader>);
- timer_->Start(FROM_HERE,
- base::TimeDelta::FromSeconds(kJobPollingIntervalSec),
- this,
- &BackgroundDownloader::OnDownloading);
+ timer_->Start(FROM_HERE, base::TimeDelta::FromSeconds(kJobPollingIntervalSec),
+ this, &BackgroundDownloader::OnDownloading);
waffles 2015/01/20 21:49:07 Did git cl format do this? I liked the old format
}
// Called any time the timer fires.
@@ -558,10 +555,7 @@ void BackgroundDownloader::EndDownload(HRESULT error) {
main_task_runner_->PostTask(
FROM_HERE,
base::Bind(&BackgroundDownloader::OnDownloadComplete,
- base::Unretained(this),
- is_handled,
- result,
- download_metrics));
+ base::Unretained(this), is_handled, result, download_metrics));
// Once the task is posted to the the main thread, this object may be deleted
// by its owner. It is not safe to access members of this object on the
@@ -629,10 +623,8 @@ void BackgroundDownloader::OnStateTransferring() {
result.total_bytes = total_bytes;
main_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&BackgroundDownloader::OnDownloadProgress,
- base::Unretained(this),
- result));
+ FROM_HERE, base::Bind(&BackgroundDownloader::OnDownloadProgress,
+ base::Unretained(this), result));
}
// Called when the download was cancelled. Since the observer should have
@@ -672,7 +664,7 @@ HRESULT BackgroundDownloader::QueueBitsJob(const GURL& url) {
}
HRESULT BackgroundDownloader::CreateOrOpenJob(const GURL& url) {
- std::vector<ScopedComPtr<IBackgroundCopyJob> > jobs;
+ std::vector<ScopedComPtr<IBackgroundCopyJob>> jobs;
HRESULT hr = FindBitsJobIf(
std::bind2nd(JobFileUrlEqual(), base::SysUTF8ToWide(url.spec())),
bits_manager_.get(), &jobs);
@@ -685,8 +677,8 @@ HRESULT BackgroundDownloader::CreateOrOpenJob(const GURL& url) {
// display name is initialized later on.
GUID guid = {0};
ScopedComPtr<IBackgroundCopyJob> job;
- hr = bits_manager_->CreateJob(
- kJobDescription, BG_JOB_TYPE_DOWNLOAD, &guid, job.Receive());
+ hr = bits_manager_->CreateJob(kJobDescription, BG_JOB_TYPE_DOWNLOAD, &guid,
+ job.Receive());
if (FAILED(hr))
return hr;
@@ -742,7 +734,7 @@ HRESULT BackgroundDownloader::CompleteJob() {
if (FAILED(hr) && hr != BG_S_UNABLE_TO_DELETE_FILES)
return hr;
- std::vector<ScopedComPtr<IBackgroundCopyFile> > files;
+ std::vector<ScopedComPtr<IBackgroundCopyFile>> files;
hr = GetFilesInJob(job_.get(), &files);
if (FAILED(hr))
return hr;
@@ -767,4 +759,4 @@ HRESULT BackgroundDownloader::CompleteJob() {
return S_OK;
}
-} // namespace component_updater
+} // namespace update_client
« no previous file with comments | « components/update_client/background_downloader_win.h ('k') | components/update_client/component_patcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698