Revert "Move InitClassLoader from JNI_OnLoad to InitGlobalJniVariables."

This reverts commit b3a8c980f7b33e7457f9a1ee3582ccbc28b7f70c.

Reason for revert: Breaking internal projects

Original change's description:
> Move InitClassLoader from JNI_OnLoad to InitGlobalJniVariables.
> 
> This fixes clients with custom JNI_OnLoad code.
> 
> Bug: webrtc:8278
> Change-Id: I67b45c2ca07b13b0bf968c5ac17ec6f1bcc58a86
> Reviewed-on: https://webrtc-review.googlesource.com/21281
> Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
> Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#20629}

TBR=magjed@webrtc.org,sakal@webrtc.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: webrtc:8278
Change-Id: I6add8182172501cb93bed998f68ce848c7280a98
Reviewed-on: https://webrtc-review.googlesource.com/22780
Reviewed-by: Lu Liu <lliuu@webrtc.org>
Commit-Queue: Lu Liu <lliuu@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20660}
This commit is contained in:
Lu Liu
2017-11-13 19:43:17 +00:00
committed by Commit Bot
parent 6e634bf4cf
commit edfa7d7131
2 changed files with 2 additions and 3 deletions

View File

@ -15,7 +15,6 @@
#include <unistd.h>
#include <vector>
#include "sdk/android/src/jni/class_loader.h"
#include "sdk/android/src/jni/classreferenceholder.h"
namespace webrtc {
@ -79,8 +78,6 @@ jint InitGlobalJniVariables(JavaVM *jvm) {
if (jvm->GetEnv(reinterpret_cast<void**>(&jni), JNI_VERSION_1_6) != JNI_OK)
return -1;
InitClassLoader(jni);
return JNI_VERSION_1_6;
}

View File

@ -28,6 +28,8 @@ extern "C" jint JNIEXPORT JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) {
RTC_CHECK(rtc::InitializeSSL()) << "Failed to InitializeSSL()";
LoadGlobalClassReferenceHolder();
JNIEnv* env = AttachCurrentThreadIfNeeded();
InitClassLoader(env);
return ret;
}