webrtc_m130/sdk/android/src/jni/scoped_java_ref_counted.cc
Niels Möller 82f33c566a Delete transitional method EncodedImage.maybeRetain
Bug: webrtc:9378
Change-Id: Ibe3d5bad835d1725faa38f8e2a804efc9272776e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/155661
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30072}
2019-12-12 14:11:14 +00:00

39 lines
1.1 KiB
C++

/*
* Copyright 2019 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "sdk/android/src/jni/scoped_java_ref_counted.h"
#include "sdk/android/generated_base_jni/RefCounted_jni.h"
namespace webrtc {
namespace jni {
// static
ScopedJavaRefCounted ScopedJavaRefCounted::Retain(
JNIEnv* jni,
const JavaRef<jobject>& j_object) {
Java_RefCounted_retain(jni, j_object);
CHECK_EXCEPTION(jni)
<< "Unexpected java exception from java JavaRefCounted.retain()";
return Adopt(jni, j_object);
}
ScopedJavaRefCounted::~ScopedJavaRefCounted() {
if (!j_object_.is_null()) {
JNIEnv* jni = AttachCurrentThreadIfNeeded();
Java_RefCounted_release(jni, j_object_);
CHECK_EXCEPTION(jni)
<< "Unexpected java exception from java RefCounted.release()";
}
}
} // namespace jni
} // namespace webrtc