OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/app/android/content_main.h" |
| 6 |
| 7 #include "base/base_switches.h" |
| 8 #include "base/at_exit.h" |
| 9 #include "base/command_line.h" |
| 10 #include "content/common/android/process_main.h" |
| 11 #include "content/public/app/content_main_runner.h" |
| 12 #include "content/public/common/content_switches.h" |
| 13 #include "jni/content_main_jni.h" |
| 14 |
| 15 namespace { |
| 16 content::ContentMainRunner* g_content_runner = NULL; |
| 17 |
| 18 void AtExitCallback(void * para) { |
| 19 if (g_content_runner) { |
| 20 delete g_content_runner; |
| 21 g_content_runner = NULL; |
| 22 } |
| 23 } |
| 24 |
| 25 } // namespace |
| 26 |
| 27 static jint Start(JNIEnv* env, jclass clazz, jobject context) { |
| 28 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
| 29 |
| 30 // This is only for browser process. We want to start waiting as early as |
| 31 // possible though here is the common initialization code. |
| 32 if (parsed_command_line.HasSwitch(switches::kWaitForDebugger) && |
| 33 "" == parsed_command_line.GetSwitchValueASCII(switches::kProcessType)) { |
| 34 LOG(ERROR) << "Browser waiting for GDB because flag " |
| 35 << switches::kWaitForDebugger << " was supplied."; |
| 36 base::debug::WaitForDebugger(24*60*60, false); |
| 37 } |
| 38 |
| 39 DCHECK(!g_content_runner); |
| 40 base::AtExitManager::RegisterCallback(AtExitCallback, NULL); |
| 41 g_content_runner = content::ContentMainRunner::Create(); |
| 42 g_content_runner->Initialize(0, NULL, content::g_content_main_delegate); |
| 43 return g_content_runner->Run(); |
| 44 } |
| 45 |
| 46 namespace content { |
| 47 |
| 48 bool RegisterContentMain(JNIEnv* env) { |
| 49 return RegisterNativesImpl(env); |
| 50 } |
| 51 |
| 52 } // namespace content |
OLD | NEW |