summaryrefslogtreecommitdiff
path: root/chromium/plat_support
diff options
context:
space:
mode:
authorBo Liu <boliu@google.com>2013-09-06 17:01:07 -0700
committerBo Liu <boliu@google.com>2013-09-06 18:48:16 -0700
commit64511fa442b9937f0e6d8449ec0c230767f0cfa9 (patch)
tree35930948241962c5908a3b19f0706e1414d41827 /chromium/plat_support
parent0d88ded1b84a558fe0b5531963006a544460c7fa (diff)
downloadwebview-64511fa442b9937f0e6d8449ec0c230767f0cfa9.tar.gz
Raise NOFILE to hard limit (1024->4096) on draw functor attach
This is needed since gralloc buffers take 2 file handles on qualcomm, and 1024 / 2 which is too low for using as tiles. Change-Id: Ib38dc4dfde96cb4be32adb2bb85e5ed77a8c3159
Diffstat (limited to 'chromium/plat_support')
-rw-r--r--chromium/plat_support/draw_gl_functor.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/chromium/plat_support/draw_gl_functor.cpp b/chromium/plat_support/draw_gl_functor.cpp
index c07e2db..d83ead7 100644
--- a/chromium/plat_support/draw_gl_functor.cpp
+++ b/chromium/plat_support/draw_gl_functor.cpp
@@ -21,8 +21,12 @@
#include "android_webview/public/browser/draw_gl.h"
+#include <errno.h>
#include <jni.h>
#include <private/hwui/DrawGlInfo.h>
+#include <string.h>
+#include <sys/resource.h>
+#include <sys/time.h>
#include <utils/Functor.h>
#include <utils/Log.h>
@@ -97,7 +101,29 @@ class DrawGLFunctor : public Functor {
int view_context_;
};
+// Raise the file handle soft limit to the hard limit since gralloc buffers
+// uses file handles.
+void RaiseFileNumberLimit() {
+ static bool have_raised_limit = false;
+ if (have_raised_limit)
+ return;
+
+ have_raised_limit = true;
+ struct rlimit limit_struct;
+ limit_struct.rlim_cur = 0;
+ limit_struct.rlim_max = 0;
+ if (getrlimit(RLIMIT_NOFILE, &limit_struct) == 0) {
+ limit_struct.rlim_cur = limit_struct.rlim_max;
+ if (setrlimit(RLIMIT_NOFILE, &limit_struct) != 0) {
+ ALOGE("setrlimit failed: %s", strerror(errno));
+ }
+ } else {
+ ALOGE("getrlimit failed: %s", strerror(errno));
+ }
+}
+
jint CreateGLFunctor(JNIEnv*, jclass, jint view_context) {
+ RaiseFileNumberLimit();
return reinterpret_cast<jint>(new DrawGLFunctor(view_context));
}