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

Side by Side Diff: content/browser/download/download_file_impl.h

Issue 2744793003: Move the logic to determine how much data can be written to another function (Closed)
Patch Set: 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 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_
6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_
7 7
8 #include "content/browser/download/download_file.h" 8 #include "content/browser/download/download_file.h"
9 9
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 169
170 // Rename file_ based on |parameters|. 170 // Rename file_ based on |parameters|.
171 void RenameWithRetryInternal(std::unique_ptr<RenameParameters> parameters); 171 void RenameWithRetryInternal(std::unique_ptr<RenameParameters> parameters);
172 172
173 // Send an update on our progress. 173 // Send an update on our progress.
174 void SendUpdate(); 174 void SendUpdate();
175 175
176 // Called before the data is written to disk. 176 // Called before the data is written to disk.
177 void WillWriteToDisk(size_t data_len); 177 void WillWriteToDisk(size_t data_len);
178 178
179 // For a given SourceStream object and the bytes it has read, determine the
180 // actual number of bytes it can write to the disk. For parallel downloading,
181 // if the target location is already written by another worker, the current
xingliu 2017/03/11 00:11:46 nit%: We actually check this only before the first
qinmin 2017/03/14 23:24:50 Done. Yes, a half open request will stop when a la
182 // stream should stop writing, Returns true if the stream can write no more
183 // data and should be finished, returns false otherwise.
184 bool CalculateBytesToWrite(SourceStream* source_stream,
185 size_t bytes_read,
186 size_t* bytes_to_write);
187
179 // Called when there's some activity on the byte stream that needs to be 188 // Called when there's some activity on the byte stream that needs to be
180 // handled. 189 // handled.
181 void StreamActive(SourceStream* source_stream); 190 void StreamActive(SourceStream* source_stream);
182 191
183 // Register callback and start to read data from the stream. 192 // Register callback and start to read data from the stream.
184 void RegisterAndActivateStream(SourceStream* source_stream); 193 void RegisterAndActivateStream(SourceStream* source_stream);
185 194
186 // Return the total valid bytes received in the target file. 195 // Return the total valid bytes received in the target file.
187 // If the file is a sparse file, return the total number of valid bytes. 196 // If the file is a sparse file, return the total number of valid bytes.
188 // Otherwise, return the current file size. 197 // Otherwise, return the current file size.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 237
229 base::WeakPtr<DownloadDestinationObserver> observer_; 238 base::WeakPtr<DownloadDestinationObserver> observer_;
230 base::WeakPtrFactory<DownloadFileImpl> weak_factory_; 239 base::WeakPtrFactory<DownloadFileImpl> weak_factory_;
231 240
232 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl); 241 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl);
233 }; 242 };
234 243
235 } // namespace content 244 } // namespace content
236 245
237 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ 246 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/download/download_file_impl.cc » ('j') | content/browser/download/download_file_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698