Delete useless code.

R=xalep@webrtc.org

Bug: None
Change-Id: I3960184c18f1f6ba26b296f609c823d8b73b3f93
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/262500
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Xavier Lepaul‎ <xalep@webrtc.org>
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36984}
diff --git a/examples/BUILD.gn b/examples/BUILD.gn
index 8b84fe4..34190a4 100644
--- a/examples/BUILD.gn
+++ b/examples/BUILD.gn
@@ -868,6 +868,7 @@
       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 089e9a2..b9c92d5 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 @@
     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 c649e3c..edb156c 100644
--- a/sdk/android/BUILD.gn
+++ b/sdk/android/BUILD.gn
@@ -137,6 +137,7 @@
     deps = [
       ":libjingle_peerconnection_jni",
       ":libjingle_peerconnection_metrics_default_jni",
+      ":native_api_jni",
       ":video_egl_jni",
       "../../pc:libjingle_peerconnection",
       "../../rtc_base",
@@ -563,8 +564,6 @@
       "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 @@
       ":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 4b255a4..0000000
--- 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 4702f5e..0000000
--- 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 88730ea..a1829ad 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 @@
     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()";
 }