Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4116)

Unified Diff: chrome/browser/browser_main.cc

Issue 17023: Provide and use auto startup/teardown for tracked objects... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/tracked_objects.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browser_main.cc
===================================================================
--- chrome/browser/browser_main.cc (revision 7482)
+++ chrome/browser/browser_main.cc (working copy)
@@ -7,9 +7,9 @@
#include "base/command_line.h"
#include "sandbox/src/sandbox.h"
-// TODO(port): several win-only methods have been pulled out of this, but
+// TODO(port): several win-only methods have been pulled out of this, but
// BrowserMain() as a whole needs to be broken apart so that it's usable by
-// other platforms. For now, it's just a stub. This is a serious work in
+// other platforms. For now, it's just a stub. This is a serious work in
// progress and should not be taken as an indication of a real refactoring.
#if defined(OS_WIN)
@@ -150,6 +150,13 @@
// TODO(beng, brettw): someday, break this out into sub functions with well
// defined roles (e.g. pre/post-profile startup, etc).
+#ifdef TRACK_ALL_TASK_OBJECTS
+ // Start tracking the creation and deletion of Task instance.
+ // This construction MUST be done before main_message_loop, so that it is
+ // destroyed after the main_message_loop.
+ tracked_objects::AutoTracking tracking_objects;
+#endif
+
MessageLoop main_message_loop(MessageLoop::TYPE_UI);
// Initialize the SystemMonitor
@@ -264,12 +271,6 @@
// Initialize histogram statistics gathering system.
StatisticsRecorder statistics;
- // Start tracking the creation and deletion of Task instances
- bool tracking_objects = false;
-#ifdef TRACK_ALL_TASK_OBJECTS
- tracking_objects = tracked_objects::ThreadData::StartTracking(true);
-#endif
-
// Initialize the shared instance of user data manager.
UserDataManager::Create();
@@ -487,21 +488,8 @@
// browser_shutdown takes care of deleting browser_process, so we need to
// release it.
browser_process.release();
-
browser_shutdown::Shutdown();
- // The following teardown code will pacify Purify, but is not necessary for
- // shutdown. Only list methods here that have no significant side effects
- // and can be run in single threaded mode before terminating.
-#ifndef NDEBUG // Don't call these in a Release build: they just waste time.
- // The following should ONLY be called when in single threaded mode. It is
- // unsafe to do this cleanup if other threads are still active.
- // It is also very unnecessary, so I'm only doing this in debug to satisfy
- // purify.
- if (tracking_objects)
- tracked_objects::ThreadData::ShutdownSingleThreadedCleanup();
-#endif // NDEBUG
-
return result_code;
}
« no previous file with comments | « base/tracked_objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698