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

Side by Side Diff: mandoline/services/core_services/android_hooks.cc

Issue 1677293002: Bye bye Mandoline (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moar Created 4 years, 10 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include <vector>
6
7 #include "base/android/base_jni_onload.h"
8 #include "base/android/context_utils.h"
9 #include "base/android/jni_android.h"
10 #include "base/android/library_loader/library_loader_hooks.h"
11 #include "base/bind.h"
12 #include "components/resource_provider/jni/Main_jni.h"
13 #include "net/android/net_jni_registrar.h"
14
15 namespace {
16 bool RegisterJNI(JNIEnv* env) {
17 return net::android::RegisterJni(env);
18 }
19
20 bool Init() {
21 return true;
22 }
23 } // namespace
24
25
26 // This is called by the VM when the shared library is first loaded.
27 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
28 std::vector<base::android::RegisterCallback> register_callbacks;
29 register_callbacks.push_back(base::Bind(&RegisterJNI));
30 register_callbacks.push_back(
31 base::Bind(&resource_provider::RegisterNativesImpl));
32
33 std::vector<base::android::InitCallback> init_callbacks;
34 init_callbacks.push_back(base::Bind(&Init));
35
36 if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) ||
37 !base::android::OnJNIOnLoadInit(init_callbacks)) {
38 return -1;
39 }
40
41 // There cannot be two AtExitManagers at the same time. Remove the one from
42 // LibraryLoader as ApplicationRunner also uses one.
43 base::android::LibraryLoaderExitHook();
44
45 return JNI_VERSION_1_4;
46 }
47
48 extern "C" JNI_EXPORT void InitApplicationContext(
49 const base::android::JavaRef<jobject>& context) {
50 JNIEnv* env = base::android::AttachCurrentThread();
51 base::android::InitApplicationContext(env, context);
52 resource_provider::Java_Main_init(
53 env, base::android::GetApplicationContext());
54 }
OLDNEW
« no previous file with comments | « mandoline/services/core_services/OWNERS ('k') | mandoline/services/core_services/application_delegate_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698