OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 56 } |
57 | 57 |
58 void FreeGlobalClassReferenceHolder() { | 58 void FreeGlobalClassReferenceHolder() { |
59 g_class_reference_holder->FreeReferences(AttachCurrentThreadIfNeeded()); | 59 g_class_reference_holder->FreeReferences(AttachCurrentThreadIfNeeded()); |
60 delete g_class_reference_holder; | 60 delete g_class_reference_holder; |
61 g_class_reference_holder = nullptr; | 61 g_class_reference_holder = nullptr; |
62 } | 62 } |
63 | 63 |
64 ClassReferenceHolder::ClassReferenceHolder(JNIEnv* jni) { | 64 ClassReferenceHolder::ClassReferenceHolder(JNIEnv* jni) { |
65 LoadClass(jni, "java/nio/ByteBuffer"); | 65 LoadClass(jni, "java/nio/ByteBuffer"); |
| 66 LoadClass(jni, "java/util/ArrayList"); |
66 LoadClass(jni, "org/webrtc/AudioTrack"); | 67 LoadClass(jni, "org/webrtc/AudioTrack"); |
67 LoadClass(jni, "org/webrtc/DataChannel"); | 68 LoadClass(jni, "org/webrtc/DataChannel"); |
68 LoadClass(jni, "org/webrtc/DataChannel$Buffer"); | 69 LoadClass(jni, "org/webrtc/DataChannel$Buffer"); |
69 LoadClass(jni, "org/webrtc/DataChannel$Init"); | 70 LoadClass(jni, "org/webrtc/DataChannel$Init"); |
70 LoadClass(jni, "org/webrtc/DataChannel$State"); | 71 LoadClass(jni, "org/webrtc/DataChannel$State"); |
71 LoadClass(jni, "org/webrtc/IceCandidate"); | 72 LoadClass(jni, "org/webrtc/IceCandidate"); |
72 #if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD) | 73 #if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD) |
73 LoadClass(jni, "android/graphics/SurfaceTexture"); | 74 LoadClass(jni, "android/graphics/SurfaceTexture"); |
74 LoadClass(jni, "org/webrtc/CameraEnumerator"); | 75 LoadClass(jni, "org/webrtc/CameraEnumerator"); |
75 LoadClass(jni, "org/webrtc/Camera2Enumerator"); | 76 LoadClass(jni, "org/webrtc/Camera2Enumerator"); |
(...skipping 28 matching lines...) Expand all Loading... |
104 LoadClass(jni, "org/webrtc/PeerConnection$TcpCandidatePolicy"); | 105 LoadClass(jni, "org/webrtc/PeerConnection$TcpCandidatePolicy"); |
105 LoadClass(jni, "org/webrtc/PeerConnection$KeyType"); | 106 LoadClass(jni, "org/webrtc/PeerConnection$KeyType"); |
106 LoadClass(jni, "org/webrtc/PeerConnection$SignalingState"); | 107 LoadClass(jni, "org/webrtc/PeerConnection$SignalingState"); |
107 LoadClass(jni, "org/webrtc/SessionDescription"); | 108 LoadClass(jni, "org/webrtc/SessionDescription"); |
108 LoadClass(jni, "org/webrtc/SessionDescription$Type"); | 109 LoadClass(jni, "org/webrtc/SessionDescription$Type"); |
109 LoadClass(jni, "org/webrtc/StatsReport"); | 110 LoadClass(jni, "org/webrtc/StatsReport"); |
110 LoadClass(jni, "org/webrtc/StatsReport$Value"); | 111 LoadClass(jni, "org/webrtc/StatsReport$Value"); |
111 LoadClass(jni, "org/webrtc/VideoRenderer$I420Frame"); | 112 LoadClass(jni, "org/webrtc/VideoRenderer$I420Frame"); |
112 LoadClass(jni, "org/webrtc/VideoCapturer"); | 113 LoadClass(jni, "org/webrtc/VideoCapturer"); |
113 LoadClass(jni, "org/webrtc/VideoTrack"); | 114 LoadClass(jni, "org/webrtc/VideoTrack"); |
| 115 LoadClass(jni, "org/webrtc/RtpSender"); |
| 116 LoadClass(jni, "org/webrtc/RtpReceiver"); |
114 } | 117 } |
115 | 118 |
116 ClassReferenceHolder::~ClassReferenceHolder() { | 119 ClassReferenceHolder::~ClassReferenceHolder() { |
117 CHECK(classes_.empty()) << "Must call FreeReferences() before dtor!"; | 120 CHECK(classes_.empty()) << "Must call FreeReferences() before dtor!"; |
118 } | 121 } |
119 | 122 |
120 void ClassReferenceHolder::FreeReferences(JNIEnv* jni) { | 123 void ClassReferenceHolder::FreeReferences(JNIEnv* jni) { |
121 for (std::map<std::string, jclass>::const_iterator it = classes_.begin(); | 124 for (std::map<std::string, jclass>::const_iterator it = classes_.begin(); |
122 it != classes_.end(); ++it) { | 125 it != classes_.end(); ++it) { |
123 jni->DeleteGlobalRef(it->second); | 126 jni->DeleteGlobalRef(it->second); |
(...skipping 18 matching lines...) Expand all Loading... |
142 CHECK(inserted) << "Duplicate class name: " << name; | 145 CHECK(inserted) << "Duplicate class name: " << name; |
143 } | 146 } |
144 | 147 |
145 // Returns a global reference guaranteed to be valid for the lifetime of the | 148 // Returns a global reference guaranteed to be valid for the lifetime of the |
146 // process. | 149 // process. |
147 jclass FindClass(JNIEnv* jni, const char* name) { | 150 jclass FindClass(JNIEnv* jni, const char* name) { |
148 return g_class_reference_holder->GetClass(name); | 151 return g_class_reference_holder->GetClass(name); |
149 } | 152 } |
150 | 153 |
151 } // namespace webrtc_jni | 154 } // namespace webrtc_jni |
OLD | NEW |