diff options
author | toyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-31 11:01:32 +0000 |
---|---|---|
committer | toyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-31 11:01:32 +0000 |
commit | 5385c44d9634d00b1cec2abf0fe7290d4205c7b0 (patch) | |
tree | 74a26c65f856026a182f94744c6805b90a6f2b68 /content | |
parent | 300967cc6dd0335308d9e06d93720649e0403a26 (diff) | |
download | chromium_src-5385c44d9634d00b1cec2abf0fe7290d4205c7b0.zip chromium_src-5385c44d9634d00b1cec2abf0fe7290d4205c7b0.tar.gz chromium_src-5385c44d9634d00b1cec2abf0fe7290d4205c7b0.tar.bz2 |
Inherits SupportsWeakPtr<T> instead of having WeakPtrFactory<T>
This change refines r137676.
BUG=122654
TEST=browser_test
Review URL: https://chromiumcodereview.appspot.com/10332233
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139771 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/renderer_host/resource_dispatcher_host_impl.cc | 19 | ||||
-rw-r--r-- | content/browser/renderer_host/resource_dispatcher_host_impl.h | 9 | ||||
-rw-r--r-- | content/browser/renderer_host/socket_stream_dispatcher_host.cc | 7 | ||||
-rw-r--r-- | content/browser/renderer_host/socket_stream_dispatcher_host.h | 11 | ||||
-rw-r--r-- | content/browser/ssl/ssl_cert_error_handler.cc | 2 | ||||
-rw-r--r-- | content/browser/ssl/ssl_cert_error_handler.h | 2 | ||||
-rw-r--r-- | content/browser/ssl/ssl_error_handler.cc | 2 | ||||
-rw-r--r-- | content/browser/ssl/ssl_error_handler.h | 2 | ||||
-rw-r--r-- | content/browser/ssl/ssl_manager.cc | 2 | ||||
-rw-r--r-- | content/browser/ssl/ssl_manager.h | 2 |
10 files changed, 23 insertions, 35 deletions
diff --git a/content/browser/renderer_host/resource_dispatcher_host_impl.cc b/content/browser/renderer_host/resource_dispatcher_host_impl.cc index aeb2573..ee6051b 100644 --- a/content/browser/renderer_host/resource_dispatcher_host_impl.cc +++ b/content/browser/renderer_host/resource_dispatcher_host_impl.cc @@ -320,8 +320,6 @@ ResourceDispatcherHostImpl::ResourceDispatcherHostImpl() : download_file_manager_(new DownloadFileManager(NULL)), save_file_manager_(new SaveFileManager()), request_id_(-1), - ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), - ALLOW_THIS_IN_INITIALIZER_LIST(ssl_delegate_weak_factory_(this)), is_shutdown_(false), max_outstanding_requests_cost_per_process_( kMaxOutstandingRequestsCostPerProcess), @@ -1517,9 +1515,9 @@ void ResourceDispatcherHostImpl::OnSSLCertificateError( int render_view_id; if(!info->GetAssociatedRenderView(&render_process_id, &render_view_id)) NOTREACHED(); - SSLManager::OnSSLCertificateError(ssl_delegate_weak_factory_.GetWeakPtr(), - request_id, info->GetResourceType(), request->url(), render_process_id, - render_view_id, ssl_info, is_hsts_host); + SSLManager::OnSSLCertificateError( + AsWeakPtr(), request_id, info->GetResourceType(), request->url(), + render_process_id, render_view_id, ssl_info, is_hsts_host); } void ResourceDispatcherHostImpl::OnResponseStarted(net::URLRequest* request) { @@ -1801,10 +1799,8 @@ void ResourceDispatcherHostImpl::PauseRequest(int child_id, // asynchronously to avoid recursion problems. if (info->pause_count() == 0) { MessageLoop::current()->PostTask(FROM_HERE, - base::Bind( - &ResourceDispatcherHostImpl::ResumeRequest, - weak_factory_.GetWeakPtr(), - global_id)); + base::Bind(&ResourceDispatcherHostImpl::ResumeRequest, + AsWeakPtr(), global_id)); } } @@ -1919,9 +1915,8 @@ void ResourceDispatcherHostImpl::OnReadCompleted(net::URLRequest* request, GlobalRequestID id(info->GetChildID(), info->GetRequestID()); MessageLoop::current()->PostTask( FROM_HERE, - base::Bind( - &ResourceDispatcherHostImpl::ResumeRequest, - weak_factory_.GetWeakPtr(), id)); + base::Bind(&ResourceDispatcherHostImpl::ResumeRequest, + AsWeakPtr(), id)); return; } } diff --git a/content/browser/renderer_host/resource_dispatcher_host_impl.h b/content/browser/renderer_host/resource_dispatcher_host_impl.h index 22276e6..f7c6274 100644 --- a/content/browser/renderer_host/resource_dispatcher_host_impl.h +++ b/content/browser/renderer_host/resource_dispatcher_host_impl.h @@ -62,7 +62,8 @@ struct Referrer; class CONTENT_EXPORT ResourceDispatcherHostImpl : public ResourceDispatcherHost, public net::URLRequest::Delegate, - public SSLErrorHandler::Delegate { + public SSLErrorHandler::Delegate, + public base::SupportsWeakPtr<ResourceDispatcherHostImpl> { public: ResourceDispatcherHostImpl(); virtual ~ResourceDispatcherHostImpl(); @@ -476,12 +477,6 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl // request_id_. int request_id_; - // For running tasks. - base::WeakPtrFactory<ResourceDispatcherHostImpl> weak_factory_; - - // For SSLErrorHandler::Delegate calls from SSLManager. - base::WeakPtrFactory<SSLErrorHandler::Delegate> ssl_delegate_weak_factory_; - // True if the resource dispatcher host has been shut down. bool is_shutdown_; diff --git a/content/browser/renderer_host/socket_stream_dispatcher_host.cc b/content/browser/renderer_host/socket_stream_dispatcher_host.cc index 84e5c8e..a947a1e 100644 --- a/content/browser/renderer_host/socket_stream_dispatcher_host.cc +++ b/content/browser/renderer_host/socket_stream_dispatcher_host.cc @@ -21,8 +21,7 @@ SocketStreamDispatcherHost::SocketStreamDispatcherHost( int render_process_id, ResourceMessageFilter::URLRequestContextSelector* selector, content::ResourceContext* resource_context) - : ALLOW_THIS_IN_INITIALIZER_LIST(ssl_delegate_weak_factory_(this)), - render_process_id_(render_process_id), + : render_process_id_(render_process_id), url_request_context_selector_(selector), resource_context_(resource_context) { DCHECK(selector); @@ -111,8 +110,8 @@ void SocketStreamDispatcherHost::OnSSLCertificateError( SocketStreamHost* socket_stream_host = hosts_.Lookup(socket_id); DCHECK(socket_stream_host); content::GlobalRequestID request_id(-1, socket_id); - SSLManager::OnSSLCertificateError(ssl_delegate_weak_factory_.GetWeakPtr(), - request_id, ResourceType::SUB_RESOURCE, socket->url(), + SSLManager::OnSSLCertificateError( + AsWeakPtr(), request_id, ResourceType::SUB_RESOURCE, socket->url(), render_process_id_, socket_stream_host->render_view_id(), ssl_info, fatal); } diff --git a/content/browser/renderer_host/socket_stream_dispatcher_host.h b/content/browser/renderer_host/socket_stream_dispatcher_host.h index b340ab9..e5cb997 100644 --- a/content/browser/renderer_host/socket_stream_dispatcher_host.h +++ b/content/browser/renderer_host/socket_stream_dispatcher_host.h @@ -29,9 +29,11 @@ class SSLInfo; // Dispatches ViewHostMsg_SocketStream_* messages sent from renderer. // It also acts as SocketStream::Delegate so that it sends // ViewMsg_SocketStream_* messages back to renderer. -class SocketStreamDispatcherHost : public content::BrowserMessageFilter, - public net::SocketStream::Delegate, - public SSLErrorHandler::Delegate { +class SocketStreamDispatcherHost + : public content::BrowserMessageFilter, + public net::SocketStream::Delegate, + public SSLErrorHandler::Delegate, + public base::SupportsWeakPtr<SocketStreamDispatcherHost> { public: SocketStreamDispatcherHost( int render_process_id, @@ -81,9 +83,6 @@ class SocketStreamDispatcherHost : public content::BrowserMessageFilter, net::URLRequestContext* GetURLRequestContext(); - // For SSLErrorHandler::Delegate calls from SSLManager. - base::WeakPtrFactory<SSLErrorHandler::Delegate> ssl_delegate_weak_factory_; - IDMap<SocketStreamHost> hosts_; int render_process_id_; const scoped_ptr<ResourceMessageFilter::URLRequestContextSelector> diff --git a/content/browser/ssl/ssl_cert_error_handler.cc b/content/browser/ssl/ssl_cert_error_handler.cc index ff6418a..740aa6b 100644 --- a/content/browser/ssl/ssl_cert_error_handler.cc +++ b/content/browser/ssl/ssl_cert_error_handler.cc @@ -13,7 +13,7 @@ using content::ResourceDispatcherHostImpl; SSLCertErrorHandler::SSLCertErrorHandler( - base::WeakPtr<Delegate> delegate, + const base::WeakPtr<Delegate>& delegate, const content::GlobalRequestID& id, ResourceType::Type resource_type, const GURL& url, diff --git a/content/browser/ssl/ssl_cert_error_handler.h b/content/browser/ssl/ssl_cert_error_handler.h index 1424651..f290a9b 100644 --- a/content/browser/ssl/ssl_cert_error_handler.h +++ b/content/browser/ssl/ssl_cert_error_handler.h @@ -18,7 +18,7 @@ class SSLCertErrorHandler : public SSLErrorHandler { public: // Construct on the IO thread. - SSLCertErrorHandler(base::WeakPtr<Delegate> delegate, + SSLCertErrorHandler(const base::WeakPtr<Delegate>& delegate, const content::GlobalRequestID& id, ResourceType::Type resource_type, const GURL& url, diff --git a/content/browser/ssl/ssl_error_handler.cc b/content/browser/ssl/ssl_error_handler.cc index 1a76172..0db8622 100644 --- a/content/browser/ssl/ssl_error_handler.cc +++ b/content/browser/ssl/ssl_error_handler.cc @@ -19,7 +19,7 @@ using content::RenderViewHostImpl; using content::WebContents; using net::SSLInfo; -SSLErrorHandler::SSLErrorHandler(base::WeakPtr<Delegate> delegate, +SSLErrorHandler::SSLErrorHandler(const base::WeakPtr<Delegate>& delegate, const content::GlobalRequestID& id, ResourceType::Type resource_type, const GURL& url, diff --git a/content/browser/ssl/ssl_error_handler.h b/content/browser/ssl/ssl_error_handler.h index 647ee71..3063d16 100644 --- a/content/browser/ssl/ssl_error_handler.h +++ b/content/browser/ssl/ssl_error_handler.h @@ -106,7 +106,7 @@ class SSLErrorHandler : public base::RefCountedThreadSafe<SSLErrorHandler> { friend class base::RefCountedThreadSafe<SSLErrorHandler>; // Construct on the IO thread. - SSLErrorHandler(base::WeakPtr<Delegate> delegate, + SSLErrorHandler(const base::WeakPtr<Delegate>& delegate, const content::GlobalRequestID& id, ResourceType::Type resource_type, const GURL& url, diff --git a/content/browser/ssl/ssl_manager.cc b/content/browser/ssl/ssl_manager.cc index 4f88b05..753a5f4 100644 --- a/content/browser/ssl/ssl_manager.cc +++ b/content/browser/ssl/ssl_manager.cc @@ -36,7 +36,7 @@ using content::WebContents; // static void SSLManager::OnSSLCertificateError( - base::WeakPtr<SSLErrorHandler::Delegate> delegate, + const base::WeakPtr<SSLErrorHandler::Delegate>& delegate, const content::GlobalRequestID& id, const ResourceType::Type resource_type, const GURL& url, diff --git a/content/browser/ssl/ssl_manager.h b/content/browser/ssl/ssl_manager.h index 5b8a17d..db5d5394 100644 --- a/content/browser/ssl/ssl_manager.h +++ b/content/browser/ssl/ssl_manager.h @@ -52,7 +52,7 @@ class SSLManager : public content::NotificationObserver { // // Called on the IO thread. static void OnSSLCertificateError( - base::WeakPtr<SSLErrorHandler::Delegate> delegate, + const base::WeakPtr<SSLErrorHandler::Delegate>& delegate, const content::GlobalRequestID& id, ResourceType::Type resource_type, const GURL& url, |