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

Unified Diff: net/base/upload_data_stream.cc

Issue 9321003: net: Make UploadData::GetContentLength() asynchronous. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 10 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: net/base/upload_data_stream.cc
diff --git a/net/base/upload_data_stream.cc b/net/base/upload_data_stream.cc
index cee54c7740dadef6c804c309ee141d53843b7428..5b2e5d30b659cbf7410da85b41898ee604819fb4 100644
--- a/net/base/upload_data_stream.cc
+++ b/net/base/upload_data_stream.cc
@@ -31,7 +31,10 @@ UploadDataStream::~UploadDataStream() {
int UploadDataStream::Init() {
DCHECK(!initialized_successfully_);
- total_size_ = upload_data_->GetContentLength();
+ {
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
+ total_size_ = upload_data_->GetContentLengthSync();
+ }
// If the underlying file has been changed and the expected file
// modification time is set, treat it as error. Note that the expected
@@ -98,6 +101,8 @@ int UploadDataStream::Read(IOBuffer* buf, int buf_len) {
// Open the file of the current element if not yet opened.
if (!element_file_stream_.get()) {
element_file_bytes_remaining_ = element.GetContentLength();
+ // Temporarily allow until fix: http://crbug.com/72001.
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
element_file_stream_.reset(element.NewFileStreamForReading());
}

Powered by Google App Engine
This is Rietveld 408576698