summaryrefslogtreecommitdiffstats
path: root/Source/WebKit
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit')
-rw-r--r--Source/WebKit/android/WebCoreSupport/PlatformBridge.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/WebKit/android/WebCoreSupport/PlatformBridge.cpp b/Source/WebKit/android/WebCoreSupport/PlatformBridge.cpp
index 8d8d809..27fe208 100644
--- a/Source/WebKit/android/WebCoreSupport/PlatformBridge.cpp
+++ b/Source/WebKit/android/WebCoreSupport/PlatformBridge.cpp
@@ -30,6 +30,7 @@
#include "Document.h"
#include "FileSystemClient.h"
#include "FrameView.h"
+#include "JNIUtility.h"
#include "JavaSharedClient.h"
#include "KeyGeneratorClient.h"
#include "MemoryUsage.h"
@@ -229,6 +230,17 @@ int PlatformBridge::actualMemoryUsageMB()
return MemoryUsage::memoryUsageMb(true);
}
+bool PlatformBridge::canSatisfyMemoryAllocation(long bytes)
+{
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
+ jclass bridgeClass = env->FindClass("android/webkit/JniUtil");
+ jmethodID method = env->GetStaticMethodID(bridgeClass, "canSatisfyMemoryAllocation", "(J)Z");
+ jboolean canAllocate = env->CallStaticBooleanMethod(bridgeClass, method, static_cast<jlong>(bytes));
+ env->DeleteLocalRef(bridgeClass);
+
+ return canAllocate == JNI_TRUE;
+}
+
} // namespace WebCore