Merge "Add @CriticalNative to getNativeTid to improve performance"

This commit is contained in:
TreeHugger Robot
2020-07-09 23:17:28 +00:00
committed by Android (Google) Code Review
2 changed files with 3 additions and 1 deletions

View File

@@ -127,6 +127,7 @@ public class Binder implements IBinder {
*
* @hide
*/
@CriticalNative
public static native int getNativeTid();
// Use a Holder to allow static initialization of Binder in the boot image, and

View File

@@ -1048,7 +1048,7 @@ static void android_os_Binder_setExtension(JNIEnv* env, jobject obj, jobject ext
jbh->setExtension(extension);
}
JNIEXPORT jint JNICALL android_os_Binder_getNativeTid(JNIEnv* env, jobject clazz) {
static jint android_os_Binder_getNativeTid() {
return (jint)android::base::GetThreadId();
}
@@ -1083,6 +1083,7 @@ static const JNINativeMethod gBinderMethods[] = {
{ "blockUntilThreadAvailable", "()V", (void*)android_os_Binder_blockUntilThreadAvailable },
{ "getExtension", "()Landroid/os/IBinder;", (void*)android_os_Binder_getExtension },
{ "setExtension", "(Landroid/os/IBinder;)V", (void*)android_os_Binder_setExtension },
// @CriticalNative
{ "getNativeTid", "()I", (void*)android_os_Binder_getNativeTid },
};