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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // Given a UTF-8 encoded |native| string return a new (UTF-16) jstring. | 97 // Given a UTF-8 encoded |native| string return a new (UTF-16) jstring. |
98 jstring JavaStringFromStdString(JNIEnv* jni, const std::string& native); | 98 jstring JavaStringFromStdString(JNIEnv* jni, const std::string& native); |
99 | 99 |
100 // Given a (UTF-16) jstring return a new UTF-8 native string. | 100 // Given a (UTF-16) jstring return a new UTF-8 native string. |
101 std::string JavaToStdString(JNIEnv* jni, const jstring& j_string); | 101 std::string JavaToStdString(JNIEnv* jni, const jstring& j_string); |
102 | 102 |
103 // Return the (singleton) Java Enum object corresponding to |index|; | 103 // Return the (singleton) Java Enum object corresponding to |index|; |
104 jobject JavaEnumFromIndex(JNIEnv* jni, jclass state_class, | 104 jobject JavaEnumFromIndex(JNIEnv* jni, jclass state_class, |
105 const std::string& state_class_name, int index); | 105 const std::string& state_class_name, int index); |
106 | 106 |
| 107 // Returns the name of a Java enum. |
| 108 std::string GetJavaEnumName(JNIEnv* jni, |
| 109 const std::string& className, |
| 110 jobject j_enum); |
| 111 |
107 jobject NewGlobalRef(JNIEnv* jni, jobject o); | 112 jobject NewGlobalRef(JNIEnv* jni, jobject o); |
108 | 113 |
109 void DeleteGlobalRef(JNIEnv* jni, jobject o); | 114 void DeleteGlobalRef(JNIEnv* jni, jobject o); |
110 | 115 |
111 // Scope Java local references to the lifetime of this object. Use in all C++ | 116 // Scope Java local references to the lifetime of this object. Use in all C++ |
112 // callbacks (i.e. entry points that don't originate in a Java callstack | 117 // callbacks (i.e. entry points that don't originate in a Java callstack |
113 // through a "native" method call). | 118 // through a "native" method call). |
114 class ScopedLocalRefFrame { | 119 class ScopedLocalRefFrame { |
115 public: | 120 public: |
116 explicit ScopedLocalRefFrame(JNIEnv* jni); | 121 explicit ScopedLocalRefFrame(JNIEnv* jni); |
(...skipping 15 matching lines...) Expand all Loading... |
132 T operator*() const { | 137 T operator*() const { |
133 return obj_; | 138 return obj_; |
134 } | 139 } |
135 private: | 140 private: |
136 T obj_; | 141 T obj_; |
137 }; | 142 }; |
138 | 143 |
139 } // namespace webrtc_jni | 144 } // namespace webrtc_jni |
140 | 145 |
141 #endif // TALK_APP_WEBRTC_JAVA_JNI_JNI_HELPERS_H_ | 146 #endif // TALK_APP_WEBRTC_JAVA_JNI_JNI_HELPERS_H_ |
OLD | NEW |