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

Unified Diff: webkit/support/webkit_support.cc

Issue 8638006: Early create AtExitManager on Android because eraly initialization code on Android needs to acces... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/support/webkit_support.cc
===================================================================
--- webkit/support/webkit_support.cc (revision 111106)
+++ webkit/support/webkit_support.cc (working copy)
@@ -127,9 +127,15 @@
typedef MessageLoopForUI MessageLoopType;
#endif
- explicit TestEnvironment(bool unit_test_mode) {
+ // Sometimes we have to create a AtExitManager before initializing
+ // TestEnvironment. Give TestEnvironment a chance to reuse existing
+ // AtExitManager if needed.
+ explicit TestEnvironment(bool unit_test_mode,
tony 2011/11/22 17:28:55 Nit: No explicit.
Johnny(Jianning) Ding 2011/11/23 14:52:17 Done.
+ base::AtExitManager* existing_at_exit_manager) {
if (!unit_test_mode) {
- at_exit_manager_.reset(new base::AtExitManager);
+ if (!existing_at_exit_manager)
+ existing_at_exit_manager = new base::AtExitManager;
+ at_exit_manager_.reset(existing_at_exit_manager);
InitLogging(false);
}
main_message_loop_.reset(new MessageLoopType);
@@ -237,8 +243,18 @@
// Otherwise crash may happend when different threads try to create a GURL
// at same time.
url_util::Initialize();
+ base::AtExitManager* at_exit_manager = NULL;
tony 2011/11/22 17:28:55 Can we just have all ports create the at_exit_mana
Johnny(Jianning) Ding 2011/11/23 14:52:17 Done.
+#if defined(OS_ANDROID)
+ // We need to register Android specific paths in BeforeInitialize routine
+ // which are needed by TestEnvironment. Since PathService need a AtExitManager
+ // to register a callback, (See LazyInstanceHelper::CompleteInstance.) we need
+ // to create a AtExitManager before initializing TestEnvironment. We will pass
+ // the ownership of the AtExitManager to TestEnvironment constructor to let
+ // the TestEnvironment instance manage its lifecycle.
+ at_exit_manager = new base::AtExitManager;
+#endif
BeforeInitialize(unit_test_mode);
- test_environment = new TestEnvironment(unit_test_mode);
+ test_environment = new TestEnvironment(unit_test_mode, at_exit_manager);
AfterInitialize(unit_test_mode);
if (!unit_test_mode) {
// Load ICU data tables. This has to run after TestEnvironment is created
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698