OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/parallel_download_utils.h" | 5 #include "content/browser/download/parallel_download_utils.h" |
6 | 6 |
7 #include "base/metrics/field_trial_params.h" | 7 #include "base/metrics/field_trial_params.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "content/public/browser/download_save_info.h" | 10 #include "content/public/browser/download_save_info.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 } | 160 } |
161 | 161 |
162 void DebugSlicesInfo(const DownloadItem::ReceivedSlices& slices) { | 162 void DebugSlicesInfo(const DownloadItem::ReceivedSlices& slices) { |
163 DVLOG(1) << "Received slices size : " << slices.size(); | 163 DVLOG(1) << "Received slices size : " << slices.size(); |
164 for (const auto& it : slices) { | 164 for (const auto& it : slices) { |
165 DVLOG(1) << "Slice offset = " << it.offset | 165 DVLOG(1) << "Slice offset = " << it.offset |
166 << " , received_bytes = " << it.received_bytes; | 166 << " , received_bytes = " << it.received_bytes; |
167 } | 167 } |
168 } | 168 } |
169 | 169 |
170 CONTENT_EXPORT int64_t GetMaxContiguousDataBlockSizeFromBeginning( | 170 int64_t GetMaxContiguousDataBlockSizeFromBeginning( |
171 const DownloadItem::ReceivedSlices& slices) { | 171 const DownloadItem::ReceivedSlices& slices) { |
172 std::vector<DownloadItem::ReceivedSlice>::const_iterator iter = | 172 std::vector<DownloadItem::ReceivedSlice>::const_iterator iter = |
173 slices.begin(); | 173 slices.begin(); |
174 | 174 |
175 int64_t size = 0; | 175 int64_t size = 0; |
176 while (iter != slices.end() && iter->offset == size) { | 176 while (iter != slices.end() && iter->offset == size) { |
177 size += iter->received_bytes; | 177 size += iter->received_bytes; |
178 iter++; | 178 iter++; |
179 } | 179 } |
180 return size; | 180 return size; |
181 } | 181 } |
182 | 182 |
| 183 bool IsParallelDownloadEnabled() { |
| 184 return base::FeatureList::IsEnabled(features::kParallelDownloading); |
| 185 } |
| 186 |
183 } // namespace content | 187 } // namespace content |
OLD | NEW |