| OLD | NEW |
| 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 // File method ordering: Methods in this file are in the same order as | 5 // File method ordering: Methods in this file are in the same order as |
| 6 // in download_item_impl.h, with the following exception: The public | 6 // in download_item_impl.h, with the following exception: The public |
| 7 // interface Start is placed in chronological order with the other | 7 // interface Start is placed in chronological order with the other |
| 8 // (private) routines that together define a DownloadItem's state | 8 // (private) routines that together define a DownloadItem's state |
| 9 // transitions as the download progresses. See "Download progression | 9 // transitions as the download progresses. See "Download progression |
| 10 // cascade" later in this file. | 10 // cascade" later in this file. |
| (...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1285 } | 1285 } |
| 1286 } | 1286 } |
| 1287 | 1287 |
| 1288 // Successful download start. | 1288 // Successful download start. |
| 1289 DCHECK(download_file_); | 1289 DCHECK(download_file_); |
| 1290 DCHECK(job_); | 1290 DCHECK(job_); |
| 1291 | 1291 |
| 1292 if (state_ == RESUMING_INTERNAL) | 1292 if (state_ == RESUMING_INTERNAL) |
| 1293 UpdateValidatorsOnResumption(new_create_info); | 1293 UpdateValidatorsOnResumption(new_create_info); |
| 1294 | 1294 |
| 1295 // If the download uses parallel requests, and choose not to create parallel |
| 1296 // request during resumption, clear the received_slices_ vector. |
| 1297 if (!job_->UsesParallelRequests() && !received_slices_.empty()) { |
| 1298 received_bytes_ = |
| 1299 GetMaxContiguousDataBlockSizeFromBeginning(received_slices_); |
| 1300 received_slices_.clear(); |
| 1301 } |
| 1302 |
| 1295 TransitionTo(TARGET_PENDING_INTERNAL); | 1303 TransitionTo(TARGET_PENDING_INTERNAL); |
| 1296 | 1304 |
| 1297 job_->Start(); | 1305 job_->Start(); |
| 1298 } | 1306 } |
| 1299 | 1307 |
| 1300 void DownloadItemImpl::StartDownload() { | 1308 void DownloadItemImpl::StartDownload() { |
| 1301 BrowserThread::PostTask( | 1309 BrowserThread::PostTask( |
| 1302 BrowserThread::FILE, FROM_HERE, | 1310 BrowserThread::FILE, FROM_HERE, |
| 1303 base::Bind(&DownloadFile::Initialize, | 1311 base::Bind(&DownloadFile::Initialize, |
| 1304 // Safe because we control download file lifetime. | 1312 // Safe because we control download file lifetime. |
| (...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2256 case RESUME_MODE_USER_CONTINUE: | 2264 case RESUME_MODE_USER_CONTINUE: |
| 2257 return "USER_CONTINUE"; | 2265 return "USER_CONTINUE"; |
| 2258 case RESUME_MODE_USER_RESTART: | 2266 case RESUME_MODE_USER_RESTART: |
| 2259 return "USER_RESTART"; | 2267 return "USER_RESTART"; |
| 2260 } | 2268 } |
| 2261 NOTREACHED() << "Unknown resume mode " << mode; | 2269 NOTREACHED() << "Unknown resume mode " << mode; |
| 2262 return "unknown"; | 2270 return "unknown"; |
| 2263 } | 2271 } |
| 2264 | 2272 |
| 2265 } // namespace content | 2273 } // namespace content |
| OLD | NEW |