diff options
| author | sl.ostapenko@samsung.com <sl.ostapenko@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-02 23:27:04 +0000 |
|---|---|---|
| committer | sl.ostapenko@samsung.com <sl.ostapenko@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-02 23:27:04 +0000 |
| commit | 2a79350a2a7c9fc4ec039cb921442518028d6294 (patch) | |
| tree | 8569456cd4667a7d8e1656ae46c506c0806cbbe5 /base/android/sys_utils.cc | |
| parent | cce34bd6de099e68afdedba4ed8cd5f4e67c4cf8 (diff) | |
| download | chromium_src-2a79350a2a7c9fc4ec039cb921442518028d6294.zip chromium_src-2a79350a2a7c9fc4ec039cb921442518028d6294.tar.gz chromium_src-2a79350a2a7c9fc4ec039cb921442518028d6294.tar.bz2 | |
Cache JNI call results in SysUtils on native side.
BUG=323727
Review URL: https://codereview.chromium.org/89773002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238228 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/android/sys_utils.cc')
| -rw-r--r-- | base/android/sys_utils.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/base/android/sys_utils.cc b/base/android/sys_utils.cc index 103324d..efd13df 100644 --- a/base/android/sys_utils.cc +++ b/base/android/sys_utils.cc @@ -15,16 +15,26 @@ bool SysUtils::Register(JNIEnv* env) { return RegisterNativesImpl(env); } -bool SysUtils::IsLowEndDevice() { +bool SysUtils::IsLowEndDeviceFromJni() { JNIEnv* env = AttachCurrentThread(); return Java_SysUtils_isLowEndDevice(env); } -size_t SysUtils::AmountOfPhysicalMemoryKB() { +bool SysUtils::IsLowEndDevice() { + static bool is_low_end = IsLowEndDeviceFromJni(); + return is_low_end; +} + +size_t SysUtils::AmountOfPhysicalMemoryKBFromJni() { JNIEnv* env = AttachCurrentThread(); return static_cast<size_t>(Java_SysUtils_amountOfPhysicalMemoryKB(env)); } +size_t SysUtils::AmountOfPhysicalMemoryKB() { + static size_t amount_of_ram = AmountOfPhysicalMemoryKBFromJni(); + return amount_of_ram; +} + SysUtils::SysUtils() { } } // namespace android |
