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

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

Issue 2727143005: Change FindNextSliceToDownload() into FindSlicesToDownload() (Closed)
Patch Set: adding TODO and comments Created 3 years, 9 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
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 // 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 1937 matching lines...) Expand 10 before | Expand all | Expand 10 after
1948 1948
1949 // Avoid using the WebContents even if it's still around. Resumption requests 1949 // Avoid using the WebContents even if it's still around. Resumption requests
1950 // are consistently routed through the no-renderer code paths so that the 1950 // are consistently routed through the no-renderer code paths so that the
1951 // request will not be dropped if the WebContents (and by extension, the 1951 // request will not be dropped if the WebContents (and by extension, the
1952 // associated renderer) goes away before a response is received. 1952 // associated renderer) goes away before a response is received.
1953 std::unique_ptr<DownloadUrlParameters> download_params( 1953 std::unique_ptr<DownloadUrlParameters> download_params(
1954 new DownloadUrlParameters(GetURL(), 1954 new DownloadUrlParameters(GetURL(),
1955 storage_partition->GetURLRequestContext())); 1955 storage_partition->GetURLRequestContext()));
1956 download_params->set_file_path(GetFullPath()); 1956 download_params->set_file_path(GetFullPath());
1957 if (received_slices_.size() > 0) { 1957 if (received_slices_.size() > 0) {
1958 ReceivedSlice next_slice = FindNextSliceToDownload(received_slices_); 1958 std::vector<DownloadItem::ReceivedSlice> slices_to_download
1959 download_params->set_offset(next_slice.offset); 1959 = FindSlicesToDownload(received_slices_);
1960 download_params->set_length(next_slice.received_bytes); 1960 download_params->set_offset(slices_to_download[0].offset);
1961 download_params->set_length(slices_to_download[0].received_bytes);
1961 } else { 1962 } else {
1962 download_params->set_offset(GetReceivedBytes()); 1963 download_params->set_offset(GetReceivedBytes());
1963 } 1964 }
1964 download_params->set_last_modified(GetLastModifiedTime()); 1965 download_params->set_last_modified(GetLastModifiedTime());
1965 download_params->set_etag(GetETag()); 1966 download_params->set_etag(GetETag());
1966 download_params->set_hash_of_partial_file(hash_); 1967 download_params->set_hash_of_partial_file(hash_);
1967 download_params->set_hash_state(std::move(hash_state_)); 1968 download_params->set_hash_state(std::move(hash_state_));
1968 1969
1969 // Note that resumed downloads disallow redirects. Hence the referrer URL 1970 // Note that resumed downloads disallow redirects. Hence the referrer URL
1970 // (which is the contents of the Referer header for the last download request) 1971 // (which is the contents of the Referer header for the last download request)
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
2152 case RESUME_MODE_USER_CONTINUE: 2153 case RESUME_MODE_USER_CONTINUE:
2153 return "USER_CONTINUE"; 2154 return "USER_CONTINUE";
2154 case RESUME_MODE_USER_RESTART: 2155 case RESUME_MODE_USER_RESTART:
2155 return "USER_RESTART"; 2156 return "USER_RESTART";
2156 } 2157 }
2157 NOTREACHED() << "Unknown resume mode " << mode; 2158 NOTREACHED() << "Unknown resume mode " << mode;
2158 return "unknown"; 2159 return "unknown";
2159 } 2160 }
2160 2161
2161 } // namespace content 2162 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/download/download_job_factory.cc » ('j') | content/browser/download/parallel_download_job.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698