summaryrefslogtreecommitdiffstats
path: root/chrome/app
diff options
context:
space:
mode:
authorcpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-01 03:06:25 +0000
committercpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-01 03:06:25 +0000
commitae645471f62870fbe4d09eaa82e9043ffe7284b8 (patch)
tree7fa75ac4be77464cce7077b145a553d721824119 /chrome/app
parentf0118db83aa396c97628c33a030627f72bdf0444 (diff)
downloadchromium_src-ae645471f62870fbe4d09eaa82e9043ffe7284b8.zip
chromium_src-ae645471f62870fbe4d09eaa82e9043ffe7284b8.tar.gz
chromium_src-ae645471f62870fbe4d09eaa82e9043ffe7284b8.tar.bz2
Adds new class AtExitManager which manages the dtors of all singletons.
- Previously this job was done by the CRT's atexit() which runs later than we want and under the loader lock. - Had to modify most main() functions for the testing executables so we don't trigger leak detectors. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/app')
-rw-r--r--chrome/app/chrome_main.cc4
-rw-r--r--chrome/app/main.cc4
2 files changed, 8 insertions, 0 deletions
diff --git a/chrome/app/chrome_main.cc b/chrome/app/chrome_main.cc
index 54cb57c..a6f8091 100644
--- a/chrome/app/chrome_main.cc
+++ b/chrome/app/chrome_main.cc
@@ -32,6 +32,7 @@
#include <malloc.h>
#include <new.h>
+#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/icu_util.h"
#include "base/message_loop.h"
@@ -140,6 +141,9 @@ DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance,
_CrtSetReportMode(_CRT_ASSERT, 0);
#endif
+ // The exit manager is in charge of calling the dtors of singleton objects.
+ base::AtExitManager exit_manager;
+
// Register the invalid param handler and pure call handler to be able to
// notify breakpad when it happens.
_set_invalid_parameter_handler(InvalidParameter);
diff --git a/chrome/app/main.cc b/chrome/app/main.cc
index cbcfdee..ab2848b 100644
--- a/chrome/app/main.cc
+++ b/chrome/app/main.cc
@@ -30,6 +30,7 @@
#include <windows.h>
#include <tchar.h>
+#include "base/at_exit.h"
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/debug_on_start.h"
@@ -43,6 +44,9 @@
int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
wchar_t* command_line, int show_command) {
+ // The exit manager is in charge of calling the dtors of singletons.
+ base::AtExitManager exit_manager;
+
google_update::GoogleUpdateClient client;
// Note that std::wstring and CommandLine got linked anyway because of