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

Unified Diff: content/browser/download/download_file_impl.h

Issue 2811293004: Fix an issue that we didn't clean url request properly. (Closed)
Patch Set: Removed a DCHECK for unit test. Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/download/download_file_impl.h
diff --git a/content/browser/download/download_file_impl.h b/content/browser/download/download_file_impl.h
index b3ce7d9259c8a57f2af114e9ef1ed22edc93719b..664b713cc89e229e046b9cf3bc525d101658e22b 100644
--- a/content/browser/download/download_file_impl.h
+++ b/content/browser/download/download_file_impl.h
@@ -53,7 +53,8 @@ class CONTENT_EXPORT DownloadFileImpl : public DownloadFile {
~DownloadFileImpl() override;
// DownloadFile functions.
- void Initialize(const InitializeCallback& callback,
+ void Initialize(const InitializeCallback& initialize_callback,
+ const CancelRequestCallback& cancel_request_callback,
const DownloadItem::ReceivedSlices& received_slices) override;
void AddByteStream(std::unique_ptr<ByteStreamReader> stream_reader,
@@ -114,7 +115,6 @@ class CONTENT_EXPORT DownloadFileImpl : public DownloadFile {
ByteStreamReader* stream_reader() const { return stream_reader_.get(); }
int64_t offset() const { return offset_; }
int64_t length() const { return length_; }
- void set_length(int64_t length) { length_ = length; }
int64_t bytes_written() const { return bytes_written_; }
bool is_finished() const { return finished_; }
void set_finished(bool finish) { finished_ = finish; }
@@ -229,6 +229,9 @@ class CONTENT_EXPORT DownloadFileImpl : public DownloadFile {
// SourceStreams are ordered by their offsets
SourceStream* FindPrecedingNeighbor(SourceStream* source_stream);
+ // See |cancel_request_callback_|.
+ void CancelRequestOnUIThread(int64_t offset);
+
// Print the internal states for debugging.
void DebugStates() const;
@@ -249,6 +252,10 @@ class CONTENT_EXPORT DownloadFileImpl : public DownloadFile {
// starting from offset.
SourceStreams source_streams_;
+ // Used to cancel the request on UI thread, since the ByteStreamReader can't
+ // close the underlying resource writing to the pipe.
+ CancelRequestCallback cancel_request_callback_;
+
// Used to trigger progress updates.
std::unique_ptr<base::RepeatingTimer> update_timer_;

Powered by Google App Engine
This is Rietveld 408576698