mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
- Add download handling support via new CefDownloadHandler and CefDownloadItem interfaces (issue #516).
- Fix setting of CefKeyEvent.focus_on_editable_field when the underlying RenderViewHost changes. - Fix potential crash if URLRequest objects are still in-progress upon shutdown. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@715 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -13,10 +13,12 @@
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/browser/url_network_delegate.h"
|
||||
#include "libcef/browser/url_request_context_proxy.h"
|
||||
#include "libcef/browser/url_request_interceptor.h"
|
||||
|
||||
#include "base/file_util.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/stl_util.h"
|
||||
#include "base/string_split.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "base/threading/worker_pool.h"
|
||||
@ -137,6 +139,7 @@ CefURLRequestContextGetter::CefURLRequestContextGetter(
|
||||
}
|
||||
|
||||
CefURLRequestContextGetter::~CefURLRequestContextGetter() {
|
||||
STLDeleteElements(&url_request_context_proxies_);
|
||||
}
|
||||
|
||||
net::URLRequestContext* CefURLRequestContextGetter::GetURLRequestContext() {
|
||||
@ -353,6 +356,51 @@ void CefURLRequestContextGetter::SetCookieSupportedSchemes(
|
||||
delete [] arr;
|
||||
}
|
||||
|
||||
CefURLRequestContextProxy*
|
||||
CefURLRequestContextGetter::CreateURLRequestContextProxy() {
|
||||
CEF_REQUIRE_IOT();
|
||||
CefURLRequestContextProxy* proxy = new CefURLRequestContextProxy(this);
|
||||
url_request_context_proxies_.insert(proxy);
|
||||
return proxy;
|
||||
}
|
||||
|
||||
void CefURLRequestContextGetter::ReleaseURLRequestContextProxy(
|
||||
CefURLRequestContextProxy* proxy) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
// Don't do anything if we're currently shutting down. The proxy objects will
|
||||
// be deleted when this object is destroyed.
|
||||
if (_Context->shutting_down())
|
||||
return;
|
||||
|
||||
if (proxy->url_requests()->size() == 0) {
|
||||
// Safe to delete the proxy.
|
||||
RequestContextProxySet::iterator it =
|
||||
url_request_context_proxies_.find(proxy);
|
||||
DCHECK(it != url_request_context_proxies_.end());
|
||||
url_request_context_proxies_.erase(it);
|
||||
delete proxy;
|
||||
} else {
|
||||
proxy->increment_delete_try_count();
|
||||
if (proxy->delete_try_count() <= 1) {
|
||||
// Cancel the pending requests. This may result in additional tasks being
|
||||
// posted on the IO thread.
|
||||
std::set<const net::URLRequest*>::iterator it =
|
||||
proxy->url_requests()->begin();
|
||||
for (; it != proxy->url_requests()->end(); ++it)
|
||||
const_cast<net::URLRequest*>(*it)->Cancel();
|
||||
|
||||
// Try to delete the proxy again later.
|
||||
CEF_POST_TASK(CEF_IOT,
|
||||
base::Bind(&CefURLRequestContextGetter::ReleaseURLRequestContextProxy,
|
||||
this, proxy));
|
||||
} else {
|
||||
NOTREACHED() <<
|
||||
"too many retries to delete URLRequestContext proxy object";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CefURLRequestContextGetter::CreateProxyConfigService() {
|
||||
if (proxy_config_service_.get())
|
||||
return;
|
||||
|
Reference in New Issue
Block a user