diff options
author | toyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-17 17:23:08 +0000 |
---|---|---|
committer | toyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-17 17:23:08 +0000 |
commit | 877182bb87fbe188efdb2d9fc641931706c9a469 (patch) | |
tree | b74686831219bc8b81e19757d2031a04cab8175d /content/browser/ssl/ssl_error_handler.cc | |
parent | 930df0858458d6f431b6378e7eae8f674a4139da (diff) | |
download | chromium_src-877182bb87fbe188efdb2d9fc641931706c9a469.zip chromium_src-877182bb87fbe188efdb2d9fc641931706c9a469.tar.gz chromium_src-877182bb87fbe188efdb2d9fc641931706c9a469.tar.bz2 |
Use WeakPtr for passing SSLErrorHandler::Delegate to SSLManager.
If user close the owner tab while SSLManager suspend a query,
SocketStreamDispatcherHost will disappear because it is owned by a
renderer host. Because WebSocket is a sub resource, its request will be
suspended until other major type resources (e.g., main frame) issue
the same query request.
I Introduce WeakPtr to make sure that SSLCertErrorHandler can call delegate
functions safely.
BUG=122654
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10034017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137676 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/ssl/ssl_error_handler.cc')
-rw-r--r-- | content/browser/ssl/ssl_error_handler.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/content/browser/ssl/ssl_error_handler.cc b/content/browser/ssl/ssl_error_handler.cc index e193d0e..1a76172 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(Delegate* delegate, +SSLErrorHandler::SSLErrorHandler(base::WeakPtr<Delegate> delegate, const content::GlobalRequestID& id, ResourceType::Type resource_type, const GURL& url, @@ -134,7 +134,8 @@ void SSLErrorHandler::CompleteCancelRequest(int error) { const SSLInfo* ssl_info = NULL; if (cert_error) ssl_info = &cert_error->ssl_info(); - delegate_->CancelSSLRequest(request_id_, error, ssl_info); + if (delegate_) + delegate_->CancelSSLRequest(request_id_, error, ssl_info); request_has_been_notified_ = true; // We're done with this object on the IO thread. @@ -151,7 +152,8 @@ void SSLErrorHandler::CompleteContinueRequest() { if (request_has_been_notified_) return; - delegate_->ContinueSSLRequest(request_id_); + if (delegate_) + delegate_->ContinueSSLRequest(request_id_); request_has_been_notified_ = true; // We're done with this object on the IO thread. |