Chromium Code Reviews| Index: content/app/content_main_runner.cc |
| diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc |
| index f87bac4a137d7fb1e07104e7d39d3724efce0995..065cdc4b2927ef6daa7fecd6e960ee453163fcda 100644 |
| --- a/content/app/content_main_runner.cc |
| +++ b/content/app/content_main_runner.cc |
| @@ -79,7 +79,7 @@ extern int PpapiBrokerMain(const content::MainFunctionParams&); |
| extern int RendererMain(const content::MainFunctionParams&); |
| extern int WorkerMain(const content::MainFunctionParams&); |
| extern int UtilityMain(const content::MainFunctionParams&); |
| -#if defined(OS_POSIX) && !defined(OS_MACOSX) |
| +#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| namespace content { |
| extern int ZygoteMain(const content::MainFunctionParams&, |
| content::ZygoteForkDelegate* forkdelegate); |
| @@ -194,7 +194,7 @@ struct MainFunction { |
| int (*function)(const content::MainFunctionParams&); |
| }; |
| -#if defined(OS_POSIX) && !defined(OS_MACOSX) |
| +#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| // On platforms that use the zygote, we have a special subset of |
| // subprocesses that are launched via the zygote. This function |
| // fills in some process-launching bits around ZygoteMain(). |
| @@ -293,7 +293,7 @@ int RunNamedProcessTypeMain( |
| } |
| } |
| -#if defined(OS_POSIX) && !defined(OS_MACOSX) |
| +#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| // Zygote startup is special -- see RunZygote comments above |
| // for why we don't use ZygoteMain directly. |
| if (process_type == switches::kZygoteProcess) |
| @@ -352,6 +352,7 @@ static void ReleaseFreeMemoryThunk() { |
| virtual int Initialize(int argc, |
| const char** argv, |
| content::ContentMainDelegate* delegate) OVERRIDE { |
| + |
| // NOTE(willchan): One might ask why this call is done here rather than in |
| // process_util_linux.cc with the definition of |
| // EnableTerminationOnOutOfMemory(). That's because base shouldn't have a |
| @@ -370,14 +371,19 @@ static void ReleaseFreeMemoryThunk() { |
| #if !defined(OS_ANDROID) |
| // Set C library locale to make sure CommandLine can parse argument values |
| // in correct encoding. |
| + // Android doesn't support this. |
| setlocale(LC_ALL, ""); |
| -#endif |
| + // On Android, do not override the signal handlers so that we can get stack |
|
Avi (use Gerrit)
2012/05/09 18:48:28
This comment and the one below are awkward; you de
John Grabowski
2012/05/09 19:03:57
Tried to clarify.
|
| + // trace when crashing. |
| SetupSignalHandlers(); |
| + // Android passes the ipc_fd through the Java service. |
| base::GlobalDescriptors* g_fds = base::GlobalDescriptors::GetInstance(); |
| g_fds->Set(kPrimaryIPCChannel, |
| kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor); |
| +#endif |
| + |
| #if defined(OS_LINUX) || defined(OS_OPENBSD) |
| g_fds->Set(kCrashDumpSignal, |
| kCrashDumpSignal + base::GlobalDescriptors::kBaseDescriptor); |
| @@ -391,8 +397,11 @@ static void ReleaseFreeMemoryThunk() { |
| base::EnableTerminationOnHeapCorruption(); |
| base::EnableTerminationOnOutOfMemory(); |
| + // On Android, AtExitManager is set up when library is loaded. |
| +#if !defined(OS_ANDROID) |
| // The exit manager is in charge of calling the dtors of singleton objects. |
| exit_manager_.reset(new base::AtExitManager); |
| +#endif |
| #if defined(OS_MACOSX) |
| // We need this pool for all the objects created before we get to the |
| @@ -402,7 +411,11 @@ static void ReleaseFreeMemoryThunk() { |
| autorelease_pool_.reset(new base::mac::ScopedNSAutoreleasePool()); |
| #endif |
| + // On Android, the command line is initialized when library is loaded. |
| + // (But *is* initialized here for content shell bringup) |
| +#if !defined(OS_ANDROID) || defined(ANDROID_UPSTREAM_BRINGUP) |
| CommandLine::Init(argc, argv); |
| +#endif |
| int exit_code; |
| if (delegate && delegate->BasicStartupComplete(&exit_code)) |
| @@ -473,6 +486,12 @@ static void ReleaseFreeMemoryThunk() { |
| ui::RegisterPathProvider(); |
| content::RegisterPathProvider(); |
| + |
| + // TODO(jrg): "up to here" is how far we get without crashing on |
| + // content shell bringup. |
| +#if defined(ANDROID_UPSTREAM_BRINGUP) |
| + return 0; |
| +#endif |
| content::RegisterContentSchemes(true); |
| CHECK(icu_util::Initialize()); |