diff options
author | cpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-01 03:06:25 +0000 |
---|---|---|
committer | cpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-01 03:06:25 +0000 |
commit | ae645471f62870fbe4d09eaa82e9043ffe7284b8 (patch) | |
tree | 7fa75ac4be77464cce7077b145a553d721824119 /webkit | |
parent | f0118db83aa396c97628c33a030627f72bdf0444 (diff) | |
download | chromium_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 'webkit')
-rw-r--r-- | webkit/tools/test_shell/run_all_tests.cc | 5 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_main.cc | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/webkit/tools/test_shell/run_all_tests.cc b/webkit/tools/test_shell/run_all_tests.cc index 05cdc43..3c4148d 100644 --- a/webkit/tools/test_shell/run_all_tests.cc +++ b/webkit/tools/test_shell/run_all_tests.cc @@ -33,6 +33,7 @@ #include <windows.h> #include <commctrl.h> +#include "base/at_exit.h" #include "base/icu_util.h" #include "base/message_loop.h" #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" @@ -50,6 +51,10 @@ const char* TestShellTest::kJavascriptDelayExitScript = "</script>"; int main(int argc, char* argv[]) { + // Some unittests may use base::Singleton<>, thus we need to instanciate + // the AtExitManager or else we will leak objects. + base::AtExitManager at_exit_manager; + TestShell::InitLogging(true); // suppress error dialogs // Initialize test shell in non-interactive mode, which will let us load one diff --git a/webkit/tools/test_shell/test_shell_main.cc b/webkit/tools/test_shell/test_shell_main.cc index 468ec36..4b1940e 100644 --- a/webkit/tools/test_shell/test_shell_main.cc +++ b/webkit/tools/test_shell/test_shell_main.cc @@ -34,6 +34,7 @@ #include <windows.h> #include <commctrl.h> +#include "base/at_exit.h" #include "base/basictypes.h" #include "base/command_line.h" #include "base/event_recorder.h" @@ -136,6 +137,9 @@ int main(int argc, char* argv[]) _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); #endif + // Some tests may use base::Singleton<>, thus we need to instanciate + // the AtExitManager or else we will leak objects. + base::AtExitManager at_exit_manager; CommandLine parsed_command_line; if (parsed_command_line.HasSwitch(test_shell::kStartupDialog)) |