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

Unified Diff: content/app/content_main_runner.cc

Issue 10377059: Android content shell bringup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix deps so builds on clean machine Created 8 years, 7 months 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 | « build/java.gypi ('k') | content/browser/android/command_line.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..02d9b444ecc1c14fc9b28fb11bb4a201ebeb8ec6 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
@@ -367,17 +368,24 @@ static void ReleaseFreeMemoryThunk() {
base::allocator::SetReleaseFreeMemoryFunction(ReleaseFreeMemoryThunk);
#endif
+ // On Android,
+ // - setlocale() is not supported.
+ // - We do not override the signal handlers so that we can get
+ // stack trace when crashing.
+ // - The ipc_fd is passed through the Java service.
+ // Thus, these are all disabled.
#if !defined(OS_ANDROID)
// Set C library locale to make sure CommandLine can parse argument values
// in correct encoding.
setlocale(LC_ALL, "");
-#endif
SetupSignalHandlers();
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 +399,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 +413,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 +488,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());
« no previous file with comments | « build/java.gypi ('k') | content/browser/android/command_line.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698