OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 #include "webrtc/sdk/android/src/jni/classreferenceholder.h" | 10 #include "webrtc/sdk/android/src/jni/classreferenceholder.h" |
11 | 11 |
12 #include "webrtc/sdk/android/src/jni/jni_helpers.h" | 12 #include "webrtc/sdk/android/src/jni/jni_helpers.h" |
13 | 13 |
14 namespace webrtc_jni { | 14 namespace webrtc { |
| 15 namespace jni { |
15 | 16 |
16 // ClassReferenceHolder holds global reference to Java classes in app/webrtc. | 17 // ClassReferenceHolder holds global reference to Java classes in app/webrtc. |
17 class ClassReferenceHolder { | 18 class ClassReferenceHolder { |
18 public: | 19 public: |
19 explicit ClassReferenceHolder(JNIEnv* jni); | 20 explicit ClassReferenceHolder(JNIEnv* jni); |
20 ~ClassReferenceHolder(); | 21 ~ClassReferenceHolder(); |
21 | 22 |
22 void FreeReferences(JNIEnv* jni); | 23 void FreeReferences(JNIEnv* jni); |
23 jclass GetClass(const std::string& name); | 24 jclass GetClass(const std::string& name); |
24 | 25 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 bool inserted = classes_.insert(std::make_pair(name, globalRef)).second; | 147 bool inserted = classes_.insert(std::make_pair(name, globalRef)).second; |
147 RTC_CHECK(inserted) << "Duplicate class name: " << name; | 148 RTC_CHECK(inserted) << "Duplicate class name: " << name; |
148 } | 149 } |
149 | 150 |
150 // Returns a global reference guaranteed to be valid for the lifetime of the | 151 // Returns a global reference guaranteed to be valid for the lifetime of the |
151 // process. | 152 // process. |
152 jclass FindClass(JNIEnv* jni, const char* name) { | 153 jclass FindClass(JNIEnv* jni, const char* name) { |
153 return g_class_reference_holder->GetClass(name); | 154 return g_class_reference_holder->GetClass(name); |
154 } | 155 } |
155 | 156 |
156 } // namespace webrtc_jni | 157 } // namespace jni |
| 158 } // namespace webrtc |
OLD | NEW |