From ae645471f62870fbe4d09eaa82e9043ffe7284b8 Mon Sep 17 00:00:00 2001 From: "cpu@google.com" Date: Fri, 1 Aug 2008 03:06:25 +0000 Subject: 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 --- webkit/tools/test_shell/run_all_tests.cc | 5 +++++ webkit/tools/test_shell/test_shell_main.cc | 4 ++++ 2 files changed, 9 insertions(+) (limited to 'webkit') 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 #include +#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 = ""; 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 #include +#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)) -- cgit v1.1