Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(718)

Side by Side Diff: webrtc/api/java/jni/jni_helpers.cc

Issue 1853523002: Allowing a Java object field to be null in a new JNI helper method. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Adding comment around maxBitrateBps explaining null value. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/api/java/jni/jni_helpers.h" 10 #include "webrtc/api/java/jni/jni_helpers.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 jclass GetObjectClass(JNIEnv* jni, jobject object) { 169 jclass GetObjectClass(JNIEnv* jni, jobject object) {
170 jclass c = jni->GetObjectClass(object); 170 jclass c = jni->GetObjectClass(object);
171 CHECK_EXCEPTION(jni) << "error during GetObjectClass"; 171 CHECK_EXCEPTION(jni) << "error during GetObjectClass";
172 RTC_CHECK(c) << "GetObjectClass returned NULL"; 172 RTC_CHECK(c) << "GetObjectClass returned NULL";
173 return c; 173 return c;
174 } 174 }
175 175
176 jobject GetObjectField(JNIEnv* jni, jobject object, jfieldID id) { 176 jobject GetObjectField(JNIEnv* jni, jobject object, jfieldID id) {
177 jobject o = jni->GetObjectField(object, id); 177 jobject o = jni->GetObjectField(object, id);
178 CHECK_EXCEPTION(jni) << "error during GetObjectField"; 178 CHECK_EXCEPTION(jni) << "error during GetObjectField";
pthatcher1 2016/04/11 19:39:29 Can't you replace this with GetNullableObjectField
Taylor Brandstetter 2016/04/11 23:13:38 True.
179 RTC_CHECK(o) << "GetObjectField returned NULL"; 179 RTC_CHECK(!IsNull(jni, o)) << "GetObjectField returned NULL";
180 return o; 180 return o;
181 } 181 }
182 182
183 jobject GetNullableObjectField(JNIEnv* jni, jobject object, jfieldID id) {
184 jobject o = jni->GetObjectField(object, id);
185 CHECK_EXCEPTION(jni) << "error during GetObjectField";
186 return o;
187 }
188
183 jstring GetStringField(JNIEnv* jni, jobject object, jfieldID id) { 189 jstring GetStringField(JNIEnv* jni, jobject object, jfieldID id) {
184 return static_cast<jstring>(GetObjectField(jni, object, id)); 190 return static_cast<jstring>(GetObjectField(jni, object, id));
185 } 191 }
186 192
187 jlong GetLongField(JNIEnv* jni, jobject object, jfieldID id) { 193 jlong GetLongField(JNIEnv* jni, jobject object, jfieldID id) {
188 jlong l = jni->GetLongField(object, id); 194 jlong l = jni->GetLongField(object, id);
189 CHECK_EXCEPTION(jni) << "error during GetLongField"; 195 CHECK_EXCEPTION(jni) << "error during GetLongField";
190 return l; 196 return l;
191 } 197 }
192 198
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 RTC_CHECK(!AtEnd()); 341 RTC_CHECK(!AtEnd());
336 return value_; 342 return value_;
337 } 343 }
338 344
339 bool Iterable::Iterator::AtEnd() const { 345 bool Iterable::Iterator::AtEnd() const {
340 RTC_CHECK(thread_checker_.CalledOnValidThread()); 346 RTC_CHECK(thread_checker_.CalledOnValidThread());
341 return jni_ == nullptr || IsNull(jni_, iterator_); 347 return jni_ == nullptr || IsNull(jni_, iterator_);
342 } 348 }
343 349
344 } // namespace webrtc_jni 350 } // namespace webrtc_jni
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698