Fix emulator build error
[platform/framework/web/chromium-efl.git] / base / android / java_runtime.cc
1 // Copyright 2015 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_runtime.h"
6
7 #include "base/android_runtime_jni_headers/Runtime_jni.h"
8 #include "base/numerics/safe_conversions.h"
9
10 namespace base {
11 namespace android {
12
13 void JavaRuntime::GetMemoryUsage(uint64_t* total_memory,
14                                  uint64_t* free_memory) {
15   JNIEnv* env = base::android::AttachCurrentThread();
16   base::android::ScopedJavaLocalRef<jobject> runtime =
17       JNI_Runtime::Java_Runtime_getRuntime(env);
18   *total_memory = checked_cast<uint64_t>(
19       JNI_Runtime::Java_Runtime_totalMemory(env, runtime));
20   *free_memory = checked_cast<uint64_t>(
21       JNI_Runtime::Java_Runtime_freeMemory(env, runtime));
22 }
23
24 }  // namespace android
25 }  // namespace base