DescriptionStop using ScopedAllowIO in content::ResourceDispatcherHostImpl
Summary:
UploadData::GetContentLengthSync() call is removed from ResourceDispatcherHostImpl.
The return type of net::URLRequest::GetUploadProgress() is changed from uint64 to net::UploadProgress.
A new member 'upload_size' is added to AutomationURLResponse for Chrome Frame.
content::ResourceDispatcherHostImpl has been using UploadData::GetContentLengthSync() which needs ScopedAllowIO.
To stop using ScopedAllowIO, there were three options considered.
1. Use asynchronous version UploadData::GetContentLength() which does not need ScopedAllowIO.
pros: Changes would be minimal and straight-forward.
cons: GetContentLength() is also called in UploadDataStream::Init(). If we start reusing the value, there is no need to call the same method here.
2. Communicate the upload data size to ResourceDispatcherHost by adding an event OnRequestBodyInitialized() to URLRequest::Delegate.
pros: No duplicated GetContentLength() call here and in UploadDataStream::Init().
cons: Complicated interface.
3. Return upload data size as well as upload progress from URLRequest::GetUploadProgress().
pros: No duplicated GetContentLength() call here and in UploadDataStream::Init(). Simple interface. Making sense because upload progress and upload size are almost always used together (see ResourceHandler::OnUploadProgress and DOM ProgressEvent as examples).
cons: Polling upload data size may imply that the size may change.
We've decided to go with #3. The return type of net::URLRequest::GetUploadProgress() is changed from uint64 to net::UploadProgress, and URLRequest::GetUploadProgress() is used to get the upload size from ResourceDispatcherHostImpl instead of UploadData::GetContentLengthSync().
In Chrome Frame, URLRequestAutomationJob is used instead of URLRequestHttpJob and UploadDataStream is not initialized in the browser process.
This is problematic since we cannot know the size of upload data without UploadDataStream.
To deal with this, a new member 'upload_size' is added to AutomationURLResponse and the value is used to implement URLRequestAutomationJob::GetUploadProgress().
BUG=112607
TEST=Can upload files
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=154286
Patch Set 1 : _ #Patch Set 2 : Move Blob resolve and abort check to PrepareToBeginRequest() #Patch Set 3 : Move abort check back to BeginRequest() #
Total comments: 1
Patch Set 4 : Use URLRequest::Delegate to communicate the upload data size #Patch Set 5 : WIP: chrome frame #Patch Set 6 : Chrome Frame fix #
Total comments: 1
Patch Set 7 : Use URLRequest::GetUploadProgress instead of URLRequest::Delegate::OnRequestBodyInitialization #Patch Set 8 : rebase #
Total comments: 6
Patch Set 9 : Rebased to the latest patch set of Issue 10834178 #Patch Set 10 : Remove const #Messages
Total messages: 28 (0 generated)
|