diff --git a/libcef/browser_resource_loader_bridge.cc b/libcef/browser_resource_loader_bridge.cc index 50bd0b819..a4ada8988 100644 --- a/libcef/browser_resource_loader_bridge.cc +++ b/libcef/browser_resource_loader_bridge.cc @@ -102,6 +102,7 @@ struct RequestParams { int appcache_host_id; bool download_to_file; scoped_refptr 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_; diff --git a/libcef/cef_process_io_thread.cc b/libcef/cef_process_io_thread.cc index 3c2923f9a..5afa4e887 100644 --- a/libcef/cef_process_io_thread.cc +++ b/libcef/cef_process_io_thread.cc @@ -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);