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

Side by Side Diff: remoting/client/jni/chromoting_jni_onload.cc

Issue 981323002: Refactoring chromoting_jni_onload.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove the at_exit_manager and add back base::android::Register Created 5 years, 9 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
« no previous file with comments | « no previous file | remoting/client/jni/chromoting_jni_runtime.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/android/base_jni_onload.h"
5 #include "base/android/base_jni_registrar.h" 6 #include "base/android/base_jni_registrar.h"
6 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
7 #include "base/android/jni_registrar.h" 8 #include "base/android/jni_registrar.h"
8 #include "base/android/jni_utils.h" 9 #include "base/android/jni_utils.h"
9 #include "net/android/net_jni_registrar.h" 10 #include "net/android/net_jni_registrar.h"
10 #include "remoting/client/jni/chromoting_jni_runtime.h" 11 #include "remoting/client/jni/chromoting_jni_runtime.h"
11 #include "ui/gfx/android/gfx_jni_registrar.h" 12 #include "ui/gfx/android/gfx_jni_registrar.h"
12 13
13 extern "C" { 14 namespace {
15
16 base::android::RegistrationMethod kRemotingRegisteredMethods[] = {
17 {"base", base::android::RegisterJni},
18 {"gfx", gfx::android::RegisterJni},
19 {"net", net::android::RegisterJni},
20 {"remoting", remoting::RegisterJni},
21 };
22
23 bool RegisterJNI(JNIEnv* env) {
24 return base::android::RegisterNativeMethods(env,
25 kRemotingRegisteredMethods, arraysize(kRemotingRegisteredMethods));
26 }
27
28 } // namespace
14 29
15 JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { 30 JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
16 base::android::InitVM(vm); 31 std::vector<base::android::RegisterCallback> register_callbacks;
17 32 register_callbacks.push_back(base::Bind(&RegisterJNI));
18 JNIEnv* env = base::android::AttachCurrentThread(); 33 std::vector<base::android::InitCallback> init_callbacks;
19 static base::android::RegistrationMethod kRemotingRegisteredMethods[] = { 34 if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) ||
20 {"base", base::android::RegisterJni}, 35 !base::android::OnJNIOnLoadInit(init_callbacks)) {
21 {"gfx", gfx::android::RegisterJni},
22 {"net", net::android::RegisterJni},
23 {"remoting", remoting::RegisterJni},
24 };
25 if (!base::android::RegisterNativeMethods(
26 env, kRemotingRegisteredMethods, arraysize(kRemotingRegisteredMethods))) {
27 return -1; 36 return -1;
28 } 37 }
29
30 base::android::InitReplacementClassLoader(env,
31 base::android::GetClassLoader(env));
32
33 return JNI_VERSION_1_4; 38 return JNI_VERSION_1_4;
34 } 39 }
35
36 } // extern "C"
OLDNEW
« no previous file with comments | « no previous file | remoting/client/jni/chromoting_jni_runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698