OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "services/android/java_handler.h" | 5 #include "services/android/java_handler.h" |
6 | 6 |
7 #include "base/android/base_jni_onload.h" | 7 #include "base/android/base_jni_onload.h" |
8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/android/library_loader/library_loader_hooks.h" | 10 #include "base/android/library_loader/library_loader_hooks.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 return false; | 74 return false; |
75 | 75 |
76 if (!mojo::android::RegisterBaseRunLoop(env)) | 76 if (!mojo::android::RegisterBaseRunLoop(env)) |
77 return false; | 77 return false; |
78 | 78 |
79 return true; | 79 return true; |
80 } | 80 } |
81 | 81 |
82 } // namespace | 82 } // namespace |
83 | 83 |
84 MojoResult MojoMain(MojoHandle shell_handle) { | 84 MojoResult MojoMain(MojoHandle application_request) { |
85 mojo::ApplicationRunnerChromium runner(new services::android::JavaHandler()); | 85 mojo::ApplicationRunnerChromium runner(new services::android::JavaHandler()); |
86 return runner.Run(shell_handle); | 86 return runner.Run(application_request); |
87 } | 87 } |
88 | 88 |
89 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { | 89 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { |
90 std::vector<base::android::RegisterCallback> register_callbacks; | 90 std::vector<base::android::RegisterCallback> register_callbacks; |
91 register_callbacks.push_back(base::Bind(&RegisterJNI)); | 91 register_callbacks.push_back(base::Bind(&RegisterJNI)); |
92 if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) || | 92 if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) || |
93 !base::android::OnJNIOnLoadInit( | 93 !base::android::OnJNIOnLoadInit( |
94 std::vector<base::android::InitCallback>())) { | 94 std::vector<base::android::InitCallback>())) { |
95 return -1; | 95 return -1; |
96 } | 96 } |
97 | 97 |
98 // There cannot be two AtExit objects triggering at the same time. Remove the | 98 // There cannot be two AtExit objects triggering at the same time. Remove the |
99 // one from LibraryLoader as ApplicationRunnerChromium also uses one. | 99 // one from LibraryLoader as ApplicationRunnerChromium also uses one. |
100 base::android::LibraryLoaderExitHook(); | 100 base::android::LibraryLoaderExitHook(); |
101 | 101 |
102 return JNI_VERSION_1_4; | 102 return JNI_VERSION_1_4; |
103 } | 103 } |
104 | 104 |
105 // This is needed because the application needs to access the application | 105 // This is needed because the application needs to access the application |
106 // context. | 106 // context. |
107 extern "C" JNI_EXPORT void InitApplicationContext( | 107 extern "C" JNI_EXPORT void InitApplicationContext( |
108 const base::android::JavaRef<jobject>& context) { | 108 const base::android::JavaRef<jobject>& context) { |
109 JNIEnv* env = base::android::AttachCurrentThread(); | 109 JNIEnv* env = base::android::AttachCurrentThread(); |
110 base::android::InitApplicationContext(env, context); | 110 base::android::InitApplicationContext(env, context); |
111 } | 111 } |
112 | 112 |
OLD | NEW |