From 82cbae4c0d76f6164b241a062c188cfda64babf9 Mon Sep 17 00:00:00 2001 From: Yaowen Guo Date: Tue, 17 May 2022 16:10:15 +0800 Subject: [PATCH] Delete useless code. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R=xalep@webrtc.org Bug: None Change-Id: I3960184c18f1f6ba26b296f609c823d8b73b3f93 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/262500 Reviewed-by: Mirko Bonadei Reviewed-by: Xavier Lepaul‎ Commit-Queue: Magnus Jedvert Reviewed-by: Magnus Jedvert Cr-Commit-Position: refs/heads/main@{#36984} --- examples/BUILD.gn | 1 + examples/unityplugin/jni_onload.cc | 5 +-- sdk/android/BUILD.gn | 4 +- sdk/android/src/jni/class_loader.h | 24 ------------ sdk/android/src/jni/class_reference_holder.h | 41 -------------------- sdk/android/src/jni/jni_onload.cc | 5 +-- 6 files changed, 7 insertions(+), 73 deletions(-) delete mode 100644 sdk/android/src/jni/class_loader.h delete mode 100644 sdk/android/src/jni/class_reference_holder.h diff --git a/examples/BUILD.gn b/examples/BUILD.gn index 8b84fe480e..34190a41dc 100644 --- a/examples/BUILD.gn +++ b/examples/BUILD.gn @@ -868,6 +868,7 @@ if (is_win || is_android) { deps += [ "../modules/utility", "../sdk/android:libjingle_peerconnection_jni", + "../sdk/android:native_api_jni", ] } } diff --git a/examples/unityplugin/jni_onload.cc b/examples/unityplugin/jni_onload.cc index 089e9a21dd..b9c92d5ef4 100644 --- a/examples/unityplugin/jni_onload.cc +++ b/examples/unityplugin/jni_onload.cc @@ -14,7 +14,7 @@ #include "examples/unityplugin/class_reference_holder.h" #include "rtc_base/ssl_adapter.h" -#include "sdk/android/src/jni/class_reference_holder.h" +#include "sdk/android/native_api/jni/class_loader.h" #include "sdk/android/src/jni/jni_helpers.h" namespace webrtc { @@ -27,14 +27,13 @@ extern "C" jint JNIEXPORT JNICALL JNI_OnLoad(JavaVM* jvm, void* reserved) { return -1; RTC_CHECK(rtc::InitializeSSL()) << "Failed to InitializeSSL()"; - LoadGlobalClassReferenceHolder(); + webrtc::InitClassLoader(GetEnv()); unity_plugin::LoadGlobalClassReferenceHolder(); return ret; } extern "C" void JNIEXPORT JNICALL JNI_OnUnLoad(JavaVM* jvm, void* reserved) { - FreeGlobalClassReferenceHolder(); unity_plugin::FreeGlobalClassReferenceHolder(); RTC_CHECK(rtc::CleanupSSL()) << "Failed to CleanupSSL()"; } diff --git a/sdk/android/BUILD.gn b/sdk/android/BUILD.gn index c649e3cf5e..edb156cfb3 100644 --- a/sdk/android/BUILD.gn +++ b/sdk/android/BUILD.gn @@ -137,6 +137,7 @@ if (is_android) { deps = [ ":libjingle_peerconnection_jni", ":libjingle_peerconnection_metrics_default_jni", + ":native_api_jni", ":video_egl_jni", "../../pc:libjingle_peerconnection", "../../rtc_base", @@ -563,8 +564,6 @@ if (current_os == "linux" || is_android) { "src/jni/android_histogram.cc", "src/jni/android_network_monitor.cc", "src/jni/android_network_monitor.h", - "src/jni/class_loader.h", - "src/jni/class_reference_holder.h", "src/jni/jni_common.cc", "src/jni/jni_helpers.cc", "src/jni/jni_helpers.h", @@ -1566,6 +1565,7 @@ if (is_android) { ":instrumentationtests_jni", ":libjingle_peerconnection_jni", ":libjingle_peerconnection_metrics_default_jni", + ":native_api_jni", "../../pc:libjingle_peerconnection", "../../rtc_base", ] diff --git a/sdk/android/src/jni/class_loader.h b/sdk/android/src/jni/class_loader.h deleted file mode 100644 index 4b255a4660..0000000000 --- a/sdk/android/src/jni/class_loader.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2017 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// Deprecated: use sdk/android/native_api/jni/class_loader.h instead. - -#ifndef SDK_ANDROID_SRC_JNI_CLASS_LOADER_H_ -#define SDK_ANDROID_SRC_JNI_CLASS_LOADER_H_ - -#include "sdk/android/native_api/jni/class_loader.h" - -namespace webrtc { -namespace jni { -using ::webrtc::InitClassLoader; -} // namespace jni -} // namespace webrtc - -#endif // SDK_ANDROID_SRC_JNI_CLASS_LOADER_H_ diff --git a/sdk/android/src/jni/class_reference_holder.h b/sdk/android/src/jni/class_reference_holder.h deleted file mode 100644 index 4702f5e2a9..0000000000 --- a/sdk/android/src/jni/class_reference_holder.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2015 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef SDK_ANDROID_SRC_JNI_CLASS_REFERENCE_HOLDER_H_ -#define SDK_ANDROID_SRC_JNI_CLASS_REFERENCE_HOLDER_H_ - -// TODO(magjed): Update external clients to call webrtc::jni::InitClassLoader -// immediately instead. -#include "sdk/android/native_api/jni/class_loader.h" -#include "sdk/android/src/jni/jni_helpers.h" - -namespace webrtc { -namespace jni { - -// Deprecated. Call webrtc::jni::InitClassLoader() immediately instead.. -inline void LoadGlobalClassReferenceHolder() { - webrtc::InitClassLoader(GetEnv()); -} - -// Deprecated. Do not call at all. -inline void FreeGlobalClassReferenceHolder() {} - -} // namespace jni -} // namespace webrtc - -// TODO(magjed): Remove once external clients are updated. -namespace webrtc_jni { - -using webrtc::jni::LoadGlobalClassReferenceHolder; -using webrtc::jni::FreeGlobalClassReferenceHolder; - -} // namespace webrtc_jni - -#endif // SDK_ANDROID_SRC_JNI_CLASS_REFERENCE_HOLDER_H_ diff --git a/sdk/android/src/jni/jni_onload.cc b/sdk/android/src/jni/jni_onload.cc index 88730ea4ea..a1829ad0b1 100644 --- a/sdk/android/src/jni/jni_onload.cc +++ b/sdk/android/src/jni/jni_onload.cc @@ -13,7 +13,7 @@ #define JNIEXPORT __attribute__((visibility("default"))) #include "rtc_base/ssl_adapter.h" -#include "sdk/android/src/jni/class_reference_holder.h" +#include "sdk/android/native_api/jni/class_loader.h" #include "sdk/android/src/jni/jni_helpers.h" namespace webrtc { @@ -26,13 +26,12 @@ extern "C" jint JNIEXPORT JNICALL JNI_OnLoad(JavaVM* jvm, void* reserved) { return -1; RTC_CHECK(rtc::InitializeSSL()) << "Failed to InitializeSSL()"; - LoadGlobalClassReferenceHolder(); + webrtc::InitClassLoader(GetEnv()); return ret; } extern "C" void JNIEXPORT JNICALL JNI_OnUnLoad(JavaVM* jvm, void* reserved) { - FreeGlobalClassReferenceHolder(); RTC_CHECK(rtc::CleanupSSL()) << "Failed to CleanupSSL()"; }