diff --git a/atom/browser/api/atom_api_session.cc b/atom/browser/api/atom_api_session.cc index d1f21e48c4a1..d1eaca7994ab 100644 --- a/atom/browser/api/atom_api_session.cc +++ b/atom/browser/api/atom_api_session.cc @@ -33,17 +33,13 @@ class ResolveProxyHelper { const GURL& url, Session::ResolveProxyCallback callback) : callback_(callback), - original_thread_(base::ThreadTaskRunnerHandle::Get()), - weak_ptr_factory_(this) { - scoped_refptr getter = - browser_context->GetDefaultStoragePartition(browser_context) - ->GetURLRequestContext(); - - getter->GetNetworkTaskRunner()->PostTask( + original_thread_(base::ThreadTaskRunnerHandle::Get()) { + scoped_refptr context_getter = + browser_context->GetRequestContext(); + context_getter->GetNetworkTaskRunner()->PostTask( FROM_HERE, base::Bind(&ResolveProxyHelper::ResolveProxy, - weak_ptr_factory_.GetWeakPtr(), - getter, url)); + base::Unretained(this), context_getter, url)); } void OnResolveProxyCompleted(int result) { @@ -52,22 +48,19 @@ class ResolveProxyHelper { proxy = proxy_info_.ToPacString(); original_thread_->PostTask(FROM_HERE, base::Bind(callback_, proxy)); - delete this; } private: - void ResolveProxy( - scoped_refptr getter, - const GURL& url) { + void ResolveProxy(scoped_refptr context_getter, + const GURL& url) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); net::ProxyService* proxy_service = - getter->GetURLRequestContext()->proxy_service(); - + context_getter->GetURLRequestContext()->proxy_service(); net::CompletionCallback completion_callback = base::Bind(&ResolveProxyHelper::OnResolveProxyCompleted, - weak_ptr_factory_.GetWeakPtr()); + base::Unretained(this)); // Start the request. int result = proxy_service->ResolveProxy( @@ -83,13 +76,10 @@ class ResolveProxyHelper { net::ProxyInfo proxy_info_; net::ProxyService::PacRequest* pac_req_; scoped_refptr original_thread_; - base::WeakPtrFactory weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(ResolveProxyHelper); }; - - } // namespace Session::Session(AtomBrowserContext* browser_context) diff --git a/vendor/brightray b/vendor/brightray index b05e019d2f66..b158824f01a1 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit b05e019d2f66023fad1ae2f16cc765e3d62ffd5e +Subproject commit b158824f01a1aee3bc2e062d2834e7ff3c91c838