Modify a temporary hack to be more inclusive.

This papers over a race resulting from the original hack (which itself masks a real problem).
I am trying to find the real culprit (so this temp hack can be decomissioned) as part of <http://codereview.chromium.org/160447>.

BUG=http://crbug.com/16972

Review URL: http://codereview.chromium.org/160478

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22246 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc
index 2a0eb0f..934fd33f 100644
--- a/net/base/host_resolver_impl.cc
+++ b/net/base/host_resolver_impl.cc
@@ -16,6 +16,7 @@
 #endif
 
 #include "base/compiler_specific.h"
+#include "base/debug_util.h"
 #include "base/message_loop.h"
 #include "base/stl_util-inl.h"
 #include "base/string_util.h"
@@ -367,6 +368,14 @@
 // See OnJobComplete(Job*) for why it is important not to clean out
 // cancelled requests from Job::requests_.
 void HostResolverImpl::CancelRequest(RequestHandle req_handle) {
+  if (shutdown_) {
+    // TODO(eroman): temp hack for: http://crbug.com/16972.
+    // Because we destroy outstanding requests during Shutdown() as part of
+    // hack http://crbug.com/15513, |req_handle| is already cancelled.
+    LOG(ERROR) << "Called HostResolverImpl::CancelRequest() after Shutdown().";
+    StackTrace().PrintBacktrace();
+    return;
+  }
   Request* req = reinterpret_cast<Request*>(req_handle);
   DCHECK(req);
   DCHECK(req->job());