Set the net::LOAD_IGNORE_LIMITS flag when executing synchronous load requests to avoid a deadlock in SyncRequestProxy (issue #192).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@268 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2011-07-15 20:31:21 +00:00
parent c509581239
commit b2100d27bd
2 changed files with 16 additions and 4 deletions

View File

@ -102,6 +102,7 @@ struct RequestParams {
int appcache_host_id;
bool download_to_file;
scoped_refptr<net::UploadData> upload;
net::RequestPriority priority;
};
// The interval for calls to RequestProxy::MaybeUpdateUploadProgress
@ -147,6 +148,8 @@ class RequestProxy : public net::URLRequest::Delegate,
peer_ = peer;
owner_loop_ = MessageLoop::current();
InitializeParams(params);
// proxy over to the io thread
CefThread::PostTask(CefThread::IO, FROM_HERE, NewRunnableMethod(
this, &RequestProxy::AsyncStart, params));
@ -171,6 +174,10 @@ class RequestProxy : public net::URLRequest::Delegate,
DCHECK(!request_.get() || CefThread::CurrentlyOn(CefThread::IO));
}
virtual void InitializeParams(RequestParams* params) {
params->priority = net::MEDIUM;
}
// --------------------------------------------------------------------------
// The following methods are called on the owner's thread in response to
// various net::URLRequest callbacks. The event hooks, defined below, trigger
@ -495,6 +502,7 @@ class RequestProxy : public net::URLRequest::Delegate,
}
request_.reset(new net::URLRequest(params->url, this));
request_->set_priority(params->priority);
request_->set_method(params->method);
request_->set_first_party_for_cookies(params->first_party_for_cookies);
request_->set_referrer(params->referrer.spec());
@ -886,6 +894,14 @@ class SyncRequestProxy : public RequestProxy {
event_.Signal();
}
protected:
virtual void InitializeParams(RequestParams* params) {
// For synchronous requests ignore load limits to avoid a deadlock problem
// in SyncRequestProxy (issue #192).
params->load_flags |= net::LOAD_IGNORE_LIMITS;
params->priority = net::HIGHEST;
}
private:
ResourceLoaderBridge::SyncLoadResponse* result_;
base::WaitableEvent event_;

View File

@ -36,10 +36,6 @@ void CefProcessIOThread::Init() {
CoInitialize(NULL);
#endif
// Increase max sockets per group as a workaround for the SyncRequestProxy
// deadlock problem (issue #192).
net::ClientSocketPoolManager::set_max_sockets_per_group(15);
FilePath cache_path(_Context->cache_path());
request_context_ = new BrowserRequestContext(cache_path,
net::HttpCache::NORMAL, false);