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

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

Issue 2794683002: set content length limit if half open range request fails (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
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/download_job.h" 5 #include "content/browser/download/download_job.h"
6 6
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "content/browser/download/download_file.h" 8 #include "content/browser/download/download_file.h"
9 #include "content/browser/download/download_item_impl.h" 9 #include "content/browser/download/download_item_impl.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // download_file_ is owned by download_item_ on the UI thread and is always 44 // download_file_ is owned by download_item_ on the UI thread and is always
45 // deleted on the FILE thread after download_file_ is nulled out. 45 // deleted on the FILE thread after download_file_ is nulled out.
46 // So it's safe to use base::Unretained here. 46 // So it's safe to use base::Unretained here.
47 BrowserThread::PostTask( 47 BrowserThread::PostTask(
48 BrowserThread::FILE, FROM_HERE, 48 BrowserThread::FILE, FROM_HERE,
49 base::Bind(&DownloadFile::AddByteStream, base::Unretained(download_file), 49 base::Bind(&DownloadFile::AddByteStream, base::Unretained(download_file),
50 base::Passed(&stream_reader), offset, length)); 50 base::Passed(&stream_reader), offset, length));
51 return true; 51 return true;
52 } 52 }
53 53
54 void DownloadJob::SetContentLengthLimit(int64_t limit) {
55 DCHECK_CURRENTLY_ON(BrowserThread::UI);
56 DownloadFile* download_file = download_item_->download_file_.get();
57 if (download_file) {
58 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
59 base::Bind(&DownloadFile::SetContentLengthLimit,
60 base::Unretained(download_file), limit));
61 }
62 }
63
54 bool DownloadJob::UsesParallelRequests() const { 64 bool DownloadJob::UsesParallelRequests() const {
55 return false; 65 return false;
56 } 66 }
57 67
58 } // namespace content 68 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698