| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/save_package.h" | 5 #include "content/browser/download/save_package.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { | 185 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { |
| 186 } | 186 } |
| 187 | 187 |
| 188 SavePackage::~SavePackage() { | 188 SavePackage::~SavePackage() { |
| 189 // Stop receiving saving job's updates | 189 // Stop receiving saving job's updates |
| 190 if (!finished_ && !canceled()) { | 190 if (!finished_ && !canceled()) { |
| 191 // Unexpected quit. | 191 // Unexpected quit. |
| 192 Cancel(true); | 192 Cancel(true); |
| 193 } | 193 } |
| 194 | 194 |
| 195 // We should no longer be observing the DownloadManager at this point. | 195 // We should no longer be observing the DownloadItem at this point. |
| 196 CHECK(!download_manager_); | |
| 197 CHECK(!download_); | 196 CHECK(!download_); |
| 198 | 197 |
| 199 DCHECK(all_save_items_count_ == (waiting_item_queue_.size() + | 198 DCHECK(all_save_items_count_ == (waiting_item_queue_.size() + |
| 200 completed_count() + | 199 completed_count() + |
| 201 in_process_count())); | 200 in_process_count())); |
| 202 // Free all SaveItems. | 201 // Free all SaveItems. |
| 203 while (!waiting_item_queue_.empty()) { | 202 while (!waiting_item_queue_.empty()) { |
| 204 // We still have some items which are waiting for start to save. | 203 // We still have some items which are waiting for start to save. |
| 205 SaveItem* save_item = waiting_item_queue_.front(); | 204 SaveItem* save_item = waiting_item_queue_.front(); |
| 206 waiting_item_queue_.pop(); | 205 waiting_item_queue_.pop(); |
| (...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1290 StopObservation(); | 1289 StopObservation(); |
| 1291 } | 1290 } |
| 1292 | 1291 |
| 1293 void SavePackage::FinalizeDownloadEntry() { | 1292 void SavePackage::FinalizeDownloadEntry() { |
| 1294 DCHECK(download_); | 1293 DCHECK(download_); |
| 1295 DCHECK(download_manager_); | 1294 DCHECK(download_manager_); |
| 1296 | 1295 |
| 1297 download_manager_->SavePageDownloadFinished(download_); | 1296 download_manager_->SavePageDownloadFinished(download_); |
| 1298 StopObservation(); | 1297 StopObservation(); |
| 1299 } | 1298 } |
| OLD | NEW |