diff options
author | 2017-10-04 16:31:08 -0700 | |
---|---|---|
committer | 2017-10-06 18:22:12 -0700 | |
commit | ad5df101c37e65cf5f8bb599596ab1f18d5815da (patch) | |
tree | 1b86115d6631c8604e27fc234636756a8791c35e | |
parent | 001ff033e6cb4bd650da6df768ab676697db65a9 (diff) |
ART: Remove FileDescriptor knowledge
Change VMDebug APIs to not pass FileDescriptor, but an int fd.
Test: m test-art-host
Test: Device boots
Change-Id: I4b17f3b2d5d2c71530c3552c11adc2b38fb93df9
-rw-r--r-- | runtime/native/dalvik_system_VMDebug.cc | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/runtime/native/dalvik_system_VMDebug.cc b/runtime/native/dalvik_system_VMDebug.cc index 3357fa7a45..70dd5cb56d 100644 --- a/runtime/native/dalvik_system_VMDebug.cc +++ b/runtime/native/dalvik_system_VMDebug.cc @@ -95,10 +95,10 @@ static void VMDebug_startMethodTracingDdmsImpl(JNIEnv*, jclass, jint bufferSize, } static void VMDebug_startMethodTracingFd(JNIEnv* env, jclass, jstring javaTraceFilename, - jobject javaFd, jint bufferSize, jint flags, + jint javaFd, jint bufferSize, jint flags, jboolean samplingEnabled, jint intervalUs, jboolean streamingOutput) { - int originalFd = jniGetFDFromFileDescriptor(env, javaFd); + int originalFd = javaFd; if (originalFd < 0) { return; } @@ -224,9 +224,9 @@ static jlong VMDebug_threadCpuTimeNanos(JNIEnv*, jclass) { * Cause "hprof" data to be dumped. We can throw an IOException if an * error occurs during file handling. */ -static void VMDebug_dumpHprofData(JNIEnv* env, jclass, jstring javaFilename, jobject javaFd) { +static void VMDebug_dumpHprofData(JNIEnv* env, jclass, jstring javaFilename, jint javaFd) { // Only one of these may be null. - if (javaFilename == nullptr && javaFd == nullptr) { + if (javaFilename == nullptr && javaFd < 0) { ScopedObjectAccess soa(env); ThrowNullPointerException("fileName == null && fd == null"); return; @@ -243,15 +243,7 @@ static void VMDebug_dumpHprofData(JNIEnv* env, jclass, jstring javaFilename, job filename = "[fd]"; } - int fd = -1; - if (javaFd != nullptr) { - fd = jniGetFDFromFileDescriptor(env, javaFd); - if (fd < 0) { - ScopedObjectAccess soa(env); - ThrowRuntimeException("Invalid file descriptor"); - return; - } - } + int fd = javaFd; hprof::DumpHeap(filename.c_str(), fd, false); } @@ -537,7 +529,7 @@ static JNINativeMethod gMethods[] = { NATIVE_METHOD(VMDebug, countInstancesOfClass, "(Ljava/lang/Class;Z)J"), NATIVE_METHOD(VMDebug, countInstancesOfClasses, "([Ljava/lang/Class;Z)[J"), NATIVE_METHOD(VMDebug, crash, "()V"), - NATIVE_METHOD(VMDebug, dumpHprofData, "(Ljava/lang/String;Ljava/io/FileDescriptor;)V"), + NATIVE_METHOD(VMDebug, dumpHprofData, "(Ljava/lang/String;I)V"), NATIVE_METHOD(VMDebug, dumpHprofDataDdms, "()V"), NATIVE_METHOD(VMDebug, dumpReferenceTables, "()V"), NATIVE_METHOD(VMDebug, getAllocCount, "(I)I"), @@ -557,7 +549,7 @@ static JNINativeMethod gMethods[] = { NATIVE_METHOD(VMDebug, startEmulatorTracing, "()V"), NATIVE_METHOD(VMDebug, startInstructionCounting, "()V"), NATIVE_METHOD(VMDebug, startMethodTracingDdmsImpl, "(IIZI)V"), - NATIVE_METHOD(VMDebug, startMethodTracingFd, "(Ljava/lang/String;Ljava/io/FileDescriptor;IIZIZ)V"), + NATIVE_METHOD(VMDebug, startMethodTracingFd, "(Ljava/lang/String;IIIZIZ)V"), NATIVE_METHOD(VMDebug, startMethodTracingFilename, "(Ljava/lang/String;IIZI)V"), NATIVE_METHOD(VMDebug, stopAllocCounting, "()V"), NATIVE_METHOD(VMDebug, stopEmulatorTracing, "()V"), |