summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-22 00:04:59 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-22 00:04:59 +0000
commit03a69dcb6cbedb76522854b8bf6bde624d5c8301 (patch)
treeddfae66028127132d1ede834aa57bf1e4a478923
parente8c927ab11958c3d1d7c768674795bcbc8b67bbb (diff)
downloadchromium_src-03a69dcb6cbedb76522854b8bf6bde624d5c8301.zip
chromium_src-03a69dcb6cbedb76522854b8bf6bde624d5c8301.tar.gz
chromium_src-03a69dcb6cbedb76522854b8bf6bde624d5c8301.tar.bz2
Enable LeakTracker on release builds.
This is intended to be temporary, so we can get data from the dev channel on why URLRequest objects are leaking at shutdown. WARNING: it may cause a slight slowdown on page cycler. Also as part of this change, I switched the order that we check URLFetcher / URLRequest. This is simply so that if both URLFetcher and URLRequest have leaked, we will report the URLFetcher leak rather than the URLRequest leak. BUG=http://crbug.com/21199, http://crbug.com/18372 Review URL: http://codereview.chromium.org/217005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26765 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/leak_tracker.h12
-rw-r--r--chrome/browser/browser_process_impl.cc11
2 files changed, 20 insertions, 3 deletions
diff --git a/base/leak_tracker.h b/base/leak_tracker.h
index de6ff29..9084f9a 100644
--- a/base/leak_tracker.h
+++ b/base/leak_tracker.h
@@ -5,8 +5,16 @@
#ifndef BASE_LEAK_TRACKER_H_
#define BASE_LEAK_TRACKER_H_
-// Only enable leak tracking in debug builds.
-#ifndef NDEBUG
+// Temporarily enable LeakTracker in all builds (both
+// release and debug). This will have an impact on performance, but
+// is intended to help track down a leak which reproduces on dev
+// channel.
+//
+// TODO(eroman): Restore the old code which only enabled LeakTracker
+// for debug builds.
+//
+// http://crbug.com/21199, http://crbug.com/18372
+#ifndef ENABLE_LEAK_TRACKER
#define ENABLE_LEAK_TRACKER
#endif
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 68a3dc3..f971e80 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -106,8 +106,17 @@ class IOThread : public BrowserProcessSubThread {
protected:
virtual void CleanUp() {
// URLFetcher and URLRequest instances must NOT outlive the IO thread.
- base::LeakTracker<URLRequest>::CheckForLeaks();
+ //
+ // Strictly speaking, URLFetcher's CheckForLeaks() should be done on the
+ // UI thread. However, since there _shouldn't_ be any instances left
+ // at this point, it shouldn't be a race.
+ //
+ // We check URLFetcher first, since if it has leaked then an associated
+ // URLRequest will also have leaked. However it is more useful to
+ // crash showing the callstack of URLFetcher's allocation than its
+ // URLRequest member.
base::LeakTracker<URLFetcher>::CheckForLeaks();
+ base::LeakTracker<URLRequest>::CheckForLeaks();
BrowserProcessSubThread::CleanUp();
}