1 // Copyright 2019 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "base/android/java_heap_dump_generator.h" 6 7 #include <jni.h> 8 9 #include <string_view> 10 11 #include "base/android/jni_string.h" 12 13 // Must come after all headers that specialize FromJniType() / ToJniType(). 14 #include "base/memory_jni/JavaHeapDumpGenerator_jni.h" 15 16 namespace base { 17 namespace android { 18 WriteJavaHeapDumpToPath(std::string_view filePath)19bool WriteJavaHeapDumpToPath(std::string_view filePath) { 20 JNIEnv* env = jni_zero::AttachCurrentThread(); 21 return Java_JavaHeapDumpGenerator_generateHprof( 22 env, base::android::ConvertUTF8ToJavaString(env, filePath)); 23 } 24 25 } // namespace android 26 } // namespace base 27