diff options
author | wtc@google.com <wtc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-09 20:52:58 +0000 |
---|---|---|
committer | wtc@google.com <wtc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-09 20:52:58 +0000 |
commit | 9aee6e8bb55747c628e43574f78177a7d26eec67 (patch) | |
tree | 1bd176c20ba958a22ae179996429d17060d8a827 | |
parent | 54d233e8bc84f7efdefa550ce7b6172439e1a89c (diff) | |
download | chromium_src-9aee6e8bb55747c628e43574f78177a7d26eec67.zip chromium_src-9aee6e8bb55747c628e43574f78177a7d26eec67.tar.gz chromium_src-9aee6e8bb55747c628e43574f78177a7d26eec67.tar.bz2 |
Now we know the delete iter->second call in
RemovePendingRequest causes a request to be removed
from pending_requests_. Add the removing_pending_request_
member and some DCHECKS to catch that in action.
R=eroman
BUG=4749
Review URL: http://codereview.chromium.org/13270
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6622 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/resource_dispatcher_host.cc | 8 | ||||
-rw-r--r-- | chrome/browser/resource_dispatcher_host.h | 5 |
2 files changed, 12 insertions, 1 deletions
diff --git a/chrome/browser/resource_dispatcher_host.cc b/chrome/browser/resource_dispatcher_host.cc index 89a3912..8317b0d 100644 --- a/chrome/browser/resource_dispatcher_host.cc +++ b/chrome/browser/resource_dispatcher_host.cc @@ -1429,11 +1429,13 @@ ResourceDispatcherHost::ResourceDispatcherHost(MessageLoop* io_loop) request_id_(-1), plugin_service_(PluginService::GetInstance()), method_runner_(this), - is_shutdown_(false) { + is_shutdown_(false), + removing_pending_request_(0) { } ResourceDispatcherHost::~ResourceDispatcherHost() { AsyncEventHandler::GlobalCleanup(); + CHECK(!removing_pending_request_); STLDeleteValues(&pending_requests_); } @@ -1466,6 +1468,7 @@ void ResourceDispatcherHost::Shutdown() { void ResourceDispatcherHost::OnShutdown() { DCHECK(MessageLoop::current() == io_loop_); is_shutdown_ = true; + CHECK(!removing_pending_request_); STLDeleteValues(&pending_requests_); // Make sure we shutdown the timer now, otherwise by the time our destructor // runs if the timer is still running the Task is deleted twice (once by @@ -1933,6 +1936,8 @@ void ResourceDispatcherHost::RemovePendingRequest(int render_process_host_id, void ResourceDispatcherHost::RemovePendingRequest( const PendingRequestList::iterator& iter) { + CHECK(!removing_pending_request_); + removing_pending_request_ = 1; size_t num_requests_before = pending_requests_.size(); // Notify the login handler that this request object is going away. @@ -1951,6 +1956,7 @@ void ResourceDispatcherHost::RemovePendingRequest( update_load_states_timer_.Stop(); CHECK(pending_requests_.size() == num_requests_before - 1); + removing_pending_request_ = 0; } // URLRequest::Delegate ------------------------------------------------------- diff --git a/chrome/browser/resource_dispatcher_host.h b/chrome/browser/resource_dispatcher_host.h index fd6b5d2..45419fa 100644 --- a/chrome/browser/resource_dispatcher_host.h +++ b/chrome/browser/resource_dispatcher_host.h @@ -495,6 +495,11 @@ class ResourceDispatcherHost : public URLRequest::Delegate { // True if the resource dispatcher host has been shut down. bool is_shutdown_; + // A member added temporarily for debugging issue 4749. Used as a bool. + // Initialized to 0. Set to 1 upon entering RemovePendingRequest(iter) and + // reset to 0 right before returning from RemovePendingRequest(iter). + int removing_pending_request_; + DISALLOW_EVIL_CONSTRUCTORS(ResourceDispatcherHost); }; |