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

Side by Side Diff: content/browser/download/download_manager_impl.cc

Issue 10704026: Reland DownloadItem::Observer::OnDownloadDestroyed() replaces DownloadItem::REMOVING (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/download/download_manager_impl.h" 5 #include "content/browser/download/download_manager_impl.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 // ignore the notification. 606 // ignore the notification.
607 if (active_downloads_.count(download_id) == 0) 607 if (active_downloads_.count(download_id) == 0)
608 return; 608 return;
609 609
610 DownloadItem* download = active_downloads_[download_id]; 610 DownloadItem* download = active_downloads_[download_id];
611 download->OnAllDataSaved(size, hash); 611 download->OnAllDataSaved(size, hash);
612 MaybeCompleteDownload(download); 612 MaybeCompleteDownload(download);
613 } 613 }
614 614
615 void DownloadManagerImpl::AssertStateConsistent(DownloadItem* download) const { 615 void DownloadManagerImpl::AssertStateConsistent(DownloadItem* download) const {
616 if (download->GetState() == DownloadItem::REMOVING) {
617 DCHECK(!ContainsKey(downloads_, download->GetId()));
618 DCHECK(!ContainsKey(active_downloads_, download->GetId()));
619 DCHECK(!ContainsKey(history_downloads_, download->GetDbHandle()));
620 return;
621 }
622
623 // Should be in downloads_ if we're not REMOVING.
624 CHECK(ContainsKey(downloads_, download->GetId())); 616 CHECK(ContainsKey(downloads_, download->GetId()));
625 617
626 // Check history_downloads_ consistency. 618 // Check history_downloads_ consistency.
627 if (download->IsPersisted()) { 619 if (download->IsPersisted()) {
628 CHECK(ContainsKey(history_downloads_, download->GetDbHandle())); 620 CHECK(ContainsKey(history_downloads_, download->GetDbHandle()));
629 } else { 621 } else {
630 for (DownloadMap::const_iterator it = history_downloads_.begin(); 622 for (DownloadMap::const_iterator it = history_downloads_.begin();
631 it != history_downloads_.end(); ++it) { 623 it != history_downloads_.end(); ++it) {
632 DCHECK(it->second != download); 624 DCHECK(it->second != download);
633 } 625 }
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 void DownloadManagerImpl::DownloadRenamedToFinalName( 1212 void DownloadManagerImpl::DownloadRenamedToFinalName(
1221 DownloadItem* download) { 1213 DownloadItem* download) {
1222 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1214 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1223 // If the rename failed, we receive an OnDownloadInterrupted() call before we 1215 // If the rename failed, we receive an OnDownloadInterrupted() call before we
1224 // receive the DownloadRenamedToFinalName() call. 1216 // receive the DownloadRenamedToFinalName() call.
1225 if (delegate_) { 1217 if (delegate_) {
1226 delegate_->UpdatePathForItemInPersistentStore( 1218 delegate_->UpdatePathForItemInPersistentStore(
1227 download, download->GetFullPath()); 1219 download, download->GetFullPath());
1228 } 1220 }
1229 } 1221 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698