Chromium Code Reviews| 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 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1258 hash_.clear(); | 1258 hash_.clear(); |
| 1259 deferred_interrupt_reason_ = new_create_info.result; | 1259 deferred_interrupt_reason_ = new_create_info.result; |
| 1260 received_slices_.clear(); | 1260 received_slices_.clear(); |
| 1261 TransitionTo(INTERRUPTED_TARGET_PENDING_INTERNAL); | 1261 TransitionTo(INTERRUPTED_TARGET_PENDING_INTERNAL); |
| 1262 DetermineDownloadTarget(); | 1262 DetermineDownloadTarget(); |
| 1263 return; | 1263 return; |
| 1264 } | 1264 } |
| 1265 | 1265 |
| 1266 if (state_ == INITIAL_INTERNAL) { | 1266 if (state_ == INITIAL_INTERNAL) { |
| 1267 RecordDownloadCount(NEW_DOWNLOAD_COUNT); | 1267 RecordDownloadCount(NEW_DOWNLOAD_COUNT); |
| 1268 if (job_->UsesParallelRequests()) | |
| 1269 RecordParallelDownloadCount(NEW_DOWNLOAD_COUNT); | |
| 1268 RecordDownloadMimeType(mime_type_); | 1270 RecordDownloadMimeType(mime_type_); |
| 1269 if (!GetBrowserContext()->IsOffTheRecord()) { | 1271 if (!GetBrowserContext()->IsOffTheRecord()) { |
| 1270 RecordDownloadCount(NEW_DOWNLOAD_COUNT_NORMAL_PROFILE); | 1272 RecordDownloadCount(NEW_DOWNLOAD_COUNT_NORMAL_PROFILE); |
| 1271 RecordDownloadMimeTypeForNormalProfile(mime_type_); | 1273 RecordDownloadMimeTypeForNormalProfile(mime_type_); |
| 1272 } | 1274 } |
| 1273 } | 1275 } |
| 1274 | 1276 |
| 1275 // Successful download start. | 1277 // Successful download start. |
| 1276 DCHECK(download_file_); | 1278 DCHECK(download_file_); |
| 1277 DCHECK(job_); | 1279 DCHECK(job_); |
| 1278 | 1280 |
| 1279 if (state_ == RESUMING_INTERNAL) | 1281 if (state_ == RESUMING_INTERNAL) |
| 1280 UpdateValidatorsOnResumption(new_create_info); | 1282 UpdateValidatorsOnResumption(new_create_info); |
| 1281 | 1283 |
| 1282 if (state_ == INITIAL_INTERNAL && job_->UsesParallelRequests()) | 1284 if (state_ == INITIAL_INTERNAL && job_->UsesParallelRequests()) |
|
xingliu
2017/04/12 21:37:39
Should we remove the state_ check here?
Since it
qinmin
2017/04/12 22:32:55
Yes, we should, since NEW_DOWNLOAD_COUNT enum is a
| |
| 1283 RecordParallelDownloadCount(START_COUNT); | 1285 RecordParallelDownloadCount(START_COUNT); |
| 1284 | 1286 |
| 1285 TransitionTo(TARGET_PENDING_INTERNAL); | 1287 TransitionTo(TARGET_PENDING_INTERNAL); |
| 1286 | 1288 |
| 1287 job_->Start(); | 1289 job_->Start(); |
| 1288 } | 1290 } |
| 1289 | 1291 |
| 1290 void DownloadItemImpl::StartDownload() { | 1292 void DownloadItemImpl::StartDownload() { |
| 1291 BrowserThread::PostTask( | 1293 BrowserThread::PostTask( |
| 1292 BrowserThread::FILE, FROM_HERE, | 1294 BrowserThread::FILE, FROM_HERE, |
| (...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2246 case RESUME_MODE_USER_CONTINUE: | 2248 case RESUME_MODE_USER_CONTINUE: |
| 2247 return "USER_CONTINUE"; | 2249 return "USER_CONTINUE"; |
| 2248 case RESUME_MODE_USER_RESTART: | 2250 case RESUME_MODE_USER_RESTART: |
| 2249 return "USER_RESTART"; | 2251 return "USER_RESTART"; |
| 2250 } | 2252 } |
| 2251 NOTREACHED() << "Unknown resume mode " << mode; | 2253 NOTREACHED() << "Unknown resume mode " << mode; |
| 2252 return "unknown"; | 2254 return "unknown"; |
| 2253 } | 2255 } |
| 2254 | 2256 |
| 2255 } // namespace content | 2257 } // namespace content |
| OLD | NEW |