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_AUDIO_DEVICE_ANDROID_BUILD_INFO_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_BUILD_INFO_H_ |
12 #define WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_BUILD_INFO_H_ | 12 #define WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_BUILD_INFO_H_ |
13 | 13 |
14 #include <jni.h> | 14 #include <jni.h> |
| 15 #include <memory> |
15 #include <string> | 16 #include <string> |
16 | 17 |
17 #include "webrtc/modules/utility/include/jvm_android.h" | 18 #include "webrtc/modules/utility/include/jvm_android.h" |
18 | 19 |
19 namespace webrtc { | 20 namespace webrtc { |
20 | 21 |
21 // Utility class used to query the Java class (org/webrtc/voiceengine/BuildInfo) | 22 // Utility class used to query the Java class (org/webrtc/voiceengine/BuildInfo) |
22 // for device and Android build information. | 23 // for device and Android build information. |
23 // The calling thread is attached to the JVM at construction if needed and a | 24 // The calling thread is attached to the JVM at construction if needed and a |
24 // valid Java environment object is also created. | 25 // valid Java environment object is also created. |
(...skipping 23 matching lines...) Expand all Loading... |
48 // Helper method which calls a static getter method with |name| and returns | 49 // Helper method which calls a static getter method with |name| and returns |
49 // a string from Java. | 50 // a string from Java. |
50 std::string GetStringFromJava(const char* name); | 51 std::string GetStringFromJava(const char* name); |
51 | 52 |
52 // Ensures that this class can access a valid JNI interface pointer even | 53 // Ensures that this class can access a valid JNI interface pointer even |
53 // if the creating thread was not attached to the JVM. | 54 // if the creating thread was not attached to the JVM. |
54 AttachCurrentThreadIfNeeded attach_thread_if_needed_; | 55 AttachCurrentThreadIfNeeded attach_thread_if_needed_; |
55 | 56 |
56 // Provides access to the JNIEnv interface pointer and the JavaToStdString() | 57 // Provides access to the JNIEnv interface pointer and the JavaToStdString() |
57 // method which is used to translate Java strings to std strings. | 58 // method which is used to translate Java strings to std strings. |
58 rtc::scoped_ptr<JNIEnvironment> j_environment_; | 59 std::unique_ptr<JNIEnvironment> j_environment_; |
59 | 60 |
60 // Holds the jclass object and provides access to CallStaticObjectMethod(). | 61 // Holds the jclass object and provides access to CallStaticObjectMethod(). |
61 // Used by GetStringFromJava() during construction only. | 62 // Used by GetStringFromJava() during construction only. |
62 JavaClass j_build_info_; | 63 JavaClass j_build_info_; |
63 }; | 64 }; |
64 | 65 |
65 } // namespace webrtc | 66 } // namespace webrtc |
66 | 67 |
67 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_BUILD_INFO_H_ | 68 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_BUILD_INFO_H_ |
OLD | NEW |