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

Unified Diff: content/shell/android/shell_library_loader.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
Index: content/shell/android/shell_library_loader.cc
diff --git a/content/shell/android/shell_library_loader.cc b/content/shell/android/shell_library_loader.cc
index e447d7e729bbbd013f31bac1ab5a41bda22ba14b..3b6757eaf10bad7ac1aee9e321990fd40cdf680e 100644
--- a/content/shell/android/shell_library_loader.cc
+++ b/content/shell/android/shell_library_loader.cc
@@ -3,8 +3,11 @@
// found in the LICENSE file.
#include "base/basictypes.h"
+#include "base/debug/debugger.h"
+#include "base/logging.h"
#include "base/android/jni_android.h"
#include "base/android/jni_registrar.h"
+#include "content/public/app/content_main_runner.h"
#include "content/public/browser/android_library_loader_hooks.h"
#include "content/shell/shell_main_delegate.h"
#include "content/shell/android/shell_manager.h"
@@ -15,8 +18,32 @@ static base::android::RegistrationMethod kRegistrationMethods[] = {
{ "ShellView", content::ShellView::Register },
};
+namespace {
+ content::ContentMainRunner* g_content_main_runner = NULL;
+}
+
// This is called by the VM when the shared library is first loaded.
JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
+
+ // Don't call anything in base without initializing it.
+ // ContentMainRunner will do what we need.
+ g_content_main_runner = content::ContentMainRunner::Create();
+
+ // TODO(tedchoc): Set this to the main delegate once the Android specific
+ // browser process initialization gets checked in.
+ ShellMainDelegate* delegate = new ShellMainDelegate();
+
+ // We use a ShellContentClient, created as a member of
+ // ShellMainDelegate and set with a call to
+ // content::SetContentClient() in PreSandboxStartup().
+ // That must be done before ContentMainRunner::Initialize().
+ // TODO(jrg): resolve the upstream/downstream discrepancy; we
+ // shouldn't need to do this.
+ delegate->PreSandboxStartup();
+
+ // TODO(jrg): find command line info from java; pass down in here.
+ g_content_main_runner->Initialize(0, NULL, NULL);
+
base::android::InitVM(vm);
JNIEnv* env = base::android::AttachCurrentThread();
if (!RegisterLibraryLoaderEntryHook(env)) {
@@ -29,9 +56,12 @@ JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
arraysize(kRegistrationMethods)))
return -1;
- // TODO(tedchoc): Set this to the main delegate once the Android specific
- // browser process initialization gets checked in.
- new ShellMainDelegate();
-
return JNI_VERSION_1_4;
}
+
+
+JNI_EXPORT void JNI_OnUnload(JavaVM* vm, void* reserved) {
+ delete g_content_main_runner;
+ g_content_main_runner = NULL;
+}
+
« no previous file with comments | « content/shell/android/java/org/chromium/content_shell/ContentShellApplication.java ('k') | media/base/android/java/media.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698