| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 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 | 10 |
| 11 #ifndef WEBRTC_MODULES_UTILITY_SOURCE_JVM_H_ | 11 #ifndef WEBRTC_MODULES_UTILITY_INCLUDE_JVM_ANDROID_H_ |
| 12 #define WEBRTC_MODULES_UTILITY_SOURCE_JVM_H_ | 12 #define WEBRTC_MODULES_UTILITY_INCLUDE_JVM_ANDROID_H_ |
| 13 | 13 |
| 14 #include <jni.h> | 14 #include <jni.h> |
| 15 #include <string> | 15 #include <string> |
| 16 | 16 |
| 17 #include "webrtc/base/scoped_ptr.h" | 17 #include "webrtc/base/scoped_ptr.h" |
| 18 #include "webrtc/base/thread_checker.h" | 18 #include "webrtc/base/thread_checker.h" |
| 19 #include "webrtc/modules/utility/interface/helpers_android.h" | 19 #include "webrtc/modules/utility/include/helpers_android.h" |
| 20 | 20 |
| 21 namespace webrtc { | 21 namespace webrtc { |
| 22 | 22 |
| 23 // The JNI interface pointer (JNIEnv) is valid only in the current thread. | 23 // The JNI interface pointer (JNIEnv) is valid only in the current thread. |
| 24 // Should another thread need to access the Java VM, it must first call | 24 // Should another thread need to access the Java VM, it must first call |
| 25 // AttachCurrentThread() to attach itself to the VM and obtain a JNI interface | 25 // AttachCurrentThread() to attach itself to the VM and obtain a JNI interface |
| 26 // pointer. The native thread remains attached to the VM until it calls | 26 // pointer. The native thread remains attached to the VM until it calls |
| 27 // DetachCurrentThread() to detach. | 27 // DetachCurrentThread() to detach. |
| 28 class AttachCurrentThreadIfNeeded { | 28 class AttachCurrentThreadIfNeeded { |
| 29 public: | 29 public: |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 private: | 175 private: |
| 176 JNIEnv* jni() const { return GetEnv(jvm_); } | 176 JNIEnv* jni() const { return GetEnv(jvm_); } |
| 177 | 177 |
| 178 rtc::ThreadChecker thread_checker_; | 178 rtc::ThreadChecker thread_checker_; |
| 179 JavaVM* const jvm_; | 179 JavaVM* const jvm_; |
| 180 jobject context_; | 180 jobject context_; |
| 181 }; | 181 }; |
| 182 | 182 |
| 183 } // namespace webrtc | 183 } // namespace webrtc |
| 184 | 184 |
| 185 #endif // WEBRTC_MODULES_UTILITY_SOURCE_JVM_H_ | 185 #endif // WEBRTC_MODULES_UTILITY_INCLUDE_JVM_ANDROID_H_ |
| OLD | NEW |