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

Side by Side Diff: chrome/browser/component_updater/background_downloader_win.cc

Issue 102993014: Reset is_completed_ before attempting a new crx component download. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/component_updater/background_downloader_win.h" 5 #include "chrome/browser/component_updater/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 <functional> 10 #include <functional>
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 url)); 382 url));
383 } 383 }
384 384
385 // Called once when this class is asked to do a download. Creates or opens 385 // Called once when this class is asked to do a download. Creates or opens
386 // an existing bits job, hooks up the notifications, and starts the timer. 386 // an existing bits job, hooks up the notifications, and starts the timer.
387 void BackgroundDownloader::BeginDownload(const GURL& url) { 387 void BackgroundDownloader::BeginDownload(const GURL& url) {
388 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 388 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
389 389
390 DCHECK(!timer_); 390 DCHECK(!timer_);
391 391
392 is_completed_ = false;
393
392 HRESULT hr = QueueBitsJob(url); 394 HRESULT hr = QueueBitsJob(url);
393 if (FAILED(hr)) { 395 if (FAILED(hr)) {
394 EndDownload(hr); 396 EndDownload(hr);
395 return; 397 return;
396 } 398 }
397 399
398 // A repeating timer retains the user task. This timer can be stopped and 400 // A repeating timer retains the user task. This timer can be stopped and
399 // reset multiple times. 401 // reset multiple times.
400 timer_.reset(new base::RepeatingTimer<BackgroundDownloader>); 402 timer_.reset(new base::RepeatingTimer<BackgroundDownloader>);
401 timer_->Start(FROM_HERE, 403 timer_->Start(FROM_HERE,
402 base::TimeDelta::FromSeconds(kJobPollingIntervalSec), 404 base::TimeDelta::FromSeconds(kJobPollingIntervalSec),
403 this, 405 this,
404 &BackgroundDownloader::OnDownloading); 406 &BackgroundDownloader::OnDownloading);
405 407
406 download_start_time_ = base::Time::Now(); 408 download_start_time_ = base::Time::Now();
waffles 2013/12/19 23:21:24 Should we initialize these when we initialize is_c
Sorin Jianu 2013/12/19 23:30:04 Done.
407 job_stuck_begin_time_ = download_start_time_; 409 job_stuck_begin_time_ = download_start_time_;
408 } 410 }
409 411
410 // Called any time the timer fires. 412 // Called any time the timer fires.
411 void BackgroundDownloader::OnDownloading() { 413 void BackgroundDownloader::OnDownloading() {
412 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 414 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
413 415
414 DCHECK(job_); 416 DCHECK(job_);
415 417
416 DCHECK(!is_completed_); 418 DCHECK(!is_completed_);
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 } 695 }
694 696
695 bool BackgroundDownloader::IsStuck() { 697 bool BackgroundDownloader::IsStuck() {
696 const base::TimeDelta job_stuck_timeout( 698 const base::TimeDelta job_stuck_timeout(
697 base::TimeDelta::FromMinutes(kJobStuckTimeoutMin)); 699 base::TimeDelta::FromMinutes(kJobStuckTimeoutMin));
698 return job_stuck_begin_time_ + job_stuck_timeout < base::Time::Now(); 700 return job_stuck_begin_time_ + job_stuck_timeout < base::Time::Now();
699 } 701 }
700 702
701 } // namespace component_updater 703 } // namespace component_updater
702 704
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698