OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/update_client/background_downloader_win.h" | 5 #include "components/update_client/background_downloader_win.h" |
6 | 6 |
7 #include <atlbase.h> | 7 #include <atlbase.h> |
8 #include <atlcom.h> | 8 #include <atlcom.h> |
9 | 9 |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 job_stuck_begin_time_ = download_start_time_; | 435 job_stuck_begin_time_ = download_start_time_; |
436 | 436 |
437 HRESULT hr = QueueBitsJob(url); | 437 HRESULT hr = QueueBitsJob(url); |
438 if (FAILED(hr)) { | 438 if (FAILED(hr)) { |
439 EndDownload(hr); | 439 EndDownload(hr); |
440 return; | 440 return; |
441 } | 441 } |
442 | 442 |
443 // A repeating timer retains the user task. This timer can be stopped and | 443 // A repeating timer retains the user task. This timer can be stopped and |
444 // reset multiple times. | 444 // reset multiple times. |
445 timer_.reset(new base::RepeatingTimer<BackgroundDownloader>); | 445 timer_.reset(new base::RepeatingTimer); |
446 timer_->Start(FROM_HERE, base::TimeDelta::FromSeconds(kJobPollingIntervalSec), | 446 timer_->Start(FROM_HERE, base::TimeDelta::FromSeconds(kJobPollingIntervalSec), |
447 this, &BackgroundDownloader::OnDownloading); | 447 this, &BackgroundDownloader::OnDownloading); |
448 } | 448 } |
449 | 449 |
450 // Called any time the timer fires. | 450 // Called any time the timer fires. |
451 void BackgroundDownloader::OnDownloading() { | 451 void BackgroundDownloader::OnDownloading() { |
452 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 452 DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
453 | 453 |
454 DCHECK(job_.get()); | 454 DCHECK(job_.get()); |
455 | 455 |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 // must match as a job only contains one file. | 753 // must match as a job only contains one file. |
754 DCHECK(progress.Completed); | 754 DCHECK(progress.Completed); |
755 DCHECK_EQ(progress.BytesTotal, progress.BytesTransferred); | 755 DCHECK_EQ(progress.BytesTotal, progress.BytesTransferred); |
756 | 756 |
757 response_ = base::FilePath(local_name); | 757 response_ = base::FilePath(local_name); |
758 | 758 |
759 return S_OK; | 759 return S_OK; |
760 } | 760 } |
761 | 761 |
762 } // namespace update_client | 762 } // namespace update_client |
OLD | NEW |