| 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
|
|
|