diff options
author | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-12 04:27:26 +0000 |
---|---|---|
committer | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-12 04:27:26 +0000 |
commit | 53614c7b731fd92f33d24dd3334761ba7963ba1f (patch) | |
tree | 3715de2c88cfe1efeadf685e4a7e97dff9950412 /chrome/browser/resource_dispatcher_host.cc | |
parent | 4fbca13f3478efb8652b4438951de4865e53c705 (diff) | |
download | chromium_src-53614c7b731fd92f33d24dd3334761ba7963ba1f.zip chromium_src-53614c7b731fd92f33d24dd3334761ba7963ba1f.tar.gz chromium_src-53614c7b731fd92f33d24dd3334761ba7963ba1f.tar.bz2 |
Makes sure ResourceDispatcherHost properly cleans up a cancelled
request that is not in a pending state. When we cancel a URLRequest
with no pending IO, nothing happens. This means ResourceDispatcherHost
doesn't clean up its maps and delete the URLRequest.
Another possibility for fixing this is to invoke OnResponseCompleted,
but as the request isn't really completed that may cause other bad
things.
Let me know if you think this should be fixed in another way.
BUG=4302
TEST=see bug
Review URL: http://codereview.chromium.org/10814
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5252 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resource_dispatcher_host.cc')
-rw-r--r-- | chrome/browser/resource_dispatcher_host.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/chrome/browser/resource_dispatcher_host.cc b/chrome/browser/resource_dispatcher_host.cc index edc9aca..60ba658 100644 --- a/chrome/browser/resource_dispatcher_host.cc +++ b/chrome/browser/resource_dispatcher_host.cc @@ -1745,7 +1745,16 @@ void ResourceDispatcherHost::CancelRequest(int render_process_host_id, info->login_handler->OnRequestCancelled(); info->login_handler = NULL; } - i->second->Cancel(); + if (!i->second->is_pending()) { + // No io is pending, canceling the request won't notify us of anything, + // so we explicitly remove it. + // TODO: removing the request in this manner means we're not notifying + // anyone. We need make sure the event handlers and others are notified + // so that everything is cleaned up properly. + RemovePendingRequest(info->render_process_host_id, info->request_id); + } else { + i->second->Cancel(); + } } // Do not remove from the pending requests, as the request will still |