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

Unified Diff: content/app/android/content_main.cc

Issue 10444121: Added android_browser_process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Init 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
Index: content/app/android/content_main.cc
diff --git a/content/app/android/content_main.cc b/content/app/android/content_main.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5815cf818ff9b06e4ffcd4a4bb3b547f1a29adba
--- /dev/null
+++ b/content/app/android/content_main.cc
@@ -0,0 +1,52 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/app/android/content_main.h"
+
+#include "base/base_switches.h"
+#include "base/at_exit.h"
+#include "base/command_line.h"
+#include "content/common/android/process_main.h"
+#include "content/public/app/content_main_runner.h"
+#include "content/public/common/content_switches.h"
+#include "jni/content_main_jni.h"
+
+namespace {
+content::ContentMainRunner* g_content_runner = NULL;
+
+void AtExitCallback(void * para) {
+ if (g_content_runner) {
+ delete g_content_runner;
+ g_content_runner = NULL;
+ }
+}
+
+} // namespace
+
+static jint Start(JNIEnv* env, jclass clazz, jobject context) {
+ const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
+
+ // This is only for browser process. We want to start waiting as early as
+ // possible though here is the common initialization code.
+ if (parsed_command_line.HasSwitch(switches::kWaitForDebugger) &&
+ "" == parsed_command_line.GetSwitchValueASCII(switches::kProcessType)) {
+ LOG(ERROR) << "Browser waiting for GDB because flag "
+ << switches::kWaitForDebugger << " was supplied.";
+ base::debug::WaitForDebugger(24*60*60, false);
+ }
+
+ DCHECK(!g_content_runner);
+ base::AtExitManager::RegisterCallback(AtExitCallback, NULL);
+ g_content_runner = content::ContentMainRunner::Create();
+ g_content_runner->Initialize(0, NULL, content::g_content_main_delegate);
+ return g_content_runner->Run();
+}
+
+namespace content {
+
+bool RegisterContentMain(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698