summaryrefslogtreecommitdiffstats
path: root/net/base/upload_data_stream.cc
diff options
context:
space:
mode:
authorsatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-10 07:39:11 +0000
committersatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-10 07:39:11 +0000
commit1dce708bbe7fdef15436e20f36f805f53bfdcb73 (patch)
tree3b7852c44e541e6d755fb1044c857d37bc622252 /net/base/upload_data_stream.cc
parent9caded3f4f06300155f117134f59b5d85b98119f (diff)
downloadchromium_src-1dce708bbe7fdef15436e20f36f805f53bfdcb73.zip
chromium_src-1dce708bbe7fdef15436e20f36f805f53bfdcb73.tar.gz
chromium_src-1dce708bbe7fdef15436e20f36f805f53bfdcb73.tar.bz2
net: Make UploadData::GetContentLength() asynchronous.
However, the asynchronous version is not used yet. The synchronous version is kept as GetContentLengthSync(). The existing code is changed to use the synchronous version. TEST=net_unittests BUG=72001,112607 Review URL: https://chromiumcodereview.appspot.com/9321003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121411 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/upload_data_stream.cc')
-rw-r--r--net/base/upload_data_stream.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/base/upload_data_stream.cc b/net/base/upload_data_stream.cc
index cee54c7..5b2e5d3 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());
}