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

Side by Side Diff: components/devtools_bridge/test/android/javatests/jni/jni_onload.cc

Issue 994543003: Refactoring devtools_bridge JNI_OnLoad (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « components/devtools_bridge/android/component_loader.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "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/library_loader/library_loader_hooks.h" 8 #include "base/bind.h"
8 #include "components/devtools_bridge/android/component_loader.h" 9 #include "components/devtools_bridge/android/apiary_client_factory.h"
10 #include "components/devtools_bridge/android/session_dependency_factory_android. h"
11
12 namespace {
9 13
10 using namespace devtools_bridge::android; 14 using namespace devtools_bridge::android;
11 15
16 bool RegisterJNI(JNIEnv* env) {
17 return base::android::RegisterJni(env) &&
18 SessionDependencyFactoryAndroid::RegisterNatives(env) &&
19 ApiaryClientFactory::RegisterNatives(env);
20 }
21
22 bool Init() {
23 return devtools_bridge::SessionDependencyFactory::InitializeSSL();
24 }
25
26 } // namespace
27
12 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { 28 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
13 base::android::InitVM(vm); 29 std::vector<base::android::RegisterCallback> register_callbacks;
14 JNIEnv* env = base::android::AttachCurrentThread(); 30 register_callbacks.push_back(base::Bind(&RegisterJNI));
15 if (!base::android::RegisterLibraryLoaderEntryHook(env)) { 31 std::vector<base::android::InitCallback> init_callbacks;
16 return -1; 32 init_callbacks.push_back(base::Bind(&Init));
17 } 33 if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) ||
18 if (!ComponentLoader::OnLoad(env)) { 34 !base::android::OnJNIOnLoadInit(init_callbacks)) {
19 return -1; 35 return -1;
20 } 36 }
21 return JNI_VERSION_1_4; 37 return JNI_VERSION_1_4;
22 } 38 }
OLDNEW
« no previous file with comments | « components/devtools_bridge/android/component_loader.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698