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

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,11 @@
typedef MessageLoopForUI MessageLoopType;
#endif
- explicit TestEnvironment(bool unit_test_mode) {
+ TestEnvironment(bool unit_test_mode,
+ base::AtExitManager* existing_at_exit_manager) {
if (!unit_test_mode) {
- at_exit_manager_.reset(new base::AtExitManager);
+ // The existing_at_exit_manager must be not NULL.
+ at_exit_manager_.reset(existing_at_exit_manager);
InitLogging(false);
}
main_message_loop_.reset(new MessageLoopType);
@@ -158,6 +160,8 @@
#endif
private:
+ // Data member at_exit_manager_ will take the ownership of the input
+ // AtExitManager and manage its lifecycle.
scoped_ptr<base::AtExitManager> at_exit_manager_;
scoped_ptr<MessageLoopType> main_message_loop_;
scoped_ptr<TestWebKitPlatformSupport> webkit_platform_support_;
@@ -237,8 +241,14 @@
// Otherwise crash may happend when different threads try to create a GURL
// at same time.
url_util::Initialize();
+ base::AtExitManager* at_exit_manager = NULL;
+ // Some initialization code may use a AtExitManager before initializing
+ // TestEnvironment, so we create a AtExitManager early and pass its ownership
+ // to TestEnvironment.
+ if (!unit_test_mode)
+ at_exit_manager = new base::AtExitManager;
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