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