Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 954863ab authored by Dan Sandler's avatar Dan Sandler Committed by Android (Google) Code Review
Browse files

Merge "Add ashmem stats to Parcels."

parents fb6f8b4f 5ce0430e
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -283,6 +283,8 @@ public final class Parcel {
    private static native void nativeWriteInterfaceToken(long nativePtr, String interfaceName);
    private static native void nativeEnforceInterface(long nativePtr, String interfaceName);

    private static native long nativeGetAshmemSize(long nativePtr);

    public final static Parcelable.Creator<String> STRING_CREATOR
             = new Parcelable.Creator<String>() {
        public String createFromParcel(Parcel source) {
@@ -2594,4 +2596,11 @@ public final class Parcel {
            N--;
        }
    }

    /**
     * @hide For testing
     */
    public long getBlobAshmemSize() {
        return nativeGetBlobAshmemSize(mNativePtr);
    }
}
+11 −0
Original line number Diff line number Diff line
@@ -704,6 +704,15 @@ static jlong android_os_Parcel_getGlobalAllocCount(JNIEnv* env, jclass clazz)
    return Parcel::getGlobalAllocCount();
}

static jlong android_os_Parcel_getBlobAshmemSize(JNIEnv* env, jclass clazz, jlong nativePtr)
{
    Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
    if (parcel != NULL) {
        return parcel->getBlobAshmemSize();
    }
    return 0;
}

// ----------------------------------------------------------------------------

static const JNINativeMethod gParcelMethods[] = {
@@ -756,6 +765,8 @@ static const JNINativeMethod gParcelMethods[] = {

    {"getGlobalAllocSize",        "()J", (void*)android_os_Parcel_getGlobalAllocSize},
    {"getGlobalAllocCount",       "()J", (void*)android_os_Parcel_getGlobalAllocCount},

    {"nativeGetAshmemSize",       "(J)J", (void*)android_os_Parcel_getAshmemSize},
};

const char* const kParcelPathName = "android/os/Parcel";