Add checks to DEBUG mode that no instance of URLRequest or URLFetcher survives the destruction of the IO thread.

This checking is done by introducing a new helper class to base called LeakTracker. Classes that you want to check for leaks just need to extend LeakTracker.

The reason I am picking on URLFetcher / URLRequest, is I believe we have a bug that is making an instance of URLFetcher to outlive the IO thread.

This causes various sorts of badness.

For example:
If URLFetcher survives the IO thread, then URLRequestContext remains referenced and therefore also survives IO thread. In turn HostResolverImpl survives the IO thread, so any outstanding resolve requests are NOT cancelled before the IO thread is decomissioned. So now, when the worker thread doing the DNS resolve finally finishes (assuming it finishes before the rogue URLRequest is destroyed), it post the result to a defunct message loop. KAB00m! (http://crbug.com/15513)

Moreover, I believe we hit this same problem sporadically in AutomationProxyTest.AutocompleteGetSetText -- the test is flaky on the buildbots, and I've seen DCHECKs which suggest it is related to this issue.

BUG=http://crbug.com/18372
Review URL: http://codereview.chromium.org/160447

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23084 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: 48ca901238509dd4c5f7bb30c66ef36f5dafc828
5 files changed
tree: 4096f394bb1cfaada594df0cb9b4432fa7ceae49
  1. base/
  2. build/
  3. ipc/
  4. testing/