diff options
author | digit@chromium.org <digit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-09 17:09:24 +0000 |
---|---|---|
committer | digit@chromium.org <digit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-09 17:09:24 +0000 |
commit | f2d7606b43a355976bd659d1b6116eda2b40470b (patch) | |
tree | e764e9ed965ea4f1fed18dea2860472ba5bd29a3 /content/app | |
parent | 222a0ca131b552e7b5642a53b75fcd302223ba5c (diff) | |
download | chromium_src-f2d7606b43a355976bd659d1b6116eda2b40470b.zip chromium_src-f2d7606b43a355976bd659d1b6116eda2b40470b.tar.gz chromium_src-f2d7606b43a355976bd659d1b6116eda2b40470b.tar.bz2 |
android: Pass CPU properties from browser to renderer process.
This is necessary to allow the renderer processes to use NEON
instructions on ARM devices that support them in libraries like
Skia.
The main issue is that on JellyBean and higher, the renderer
process runs in a sandbox that prevents it from accessing the
filesystem, including /proc/ which is the only way to query the
kernel for the features detected by the CPU.
To overcome this, send the result of the probe to each renderer
process, which will use the new android_setCpu() function
introduced in https://gerrit.chromium.org/gerrit/#/c/39370/
Note that this requires that third-party libraries use the
android_getCpuCount() and android_getCpuFeatures() function
to get this data at runtime.
BUG=164154
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/11503013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175820 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/app')
-rw-r--r-- | content/app/android/sandboxed_process_service.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/content/app/android/sandboxed_process_service.cc b/content/app/android/sandboxed_process_service.cc index ea3db55..6316ab8 100644 --- a/content/app/android/sandboxed_process_service.cc +++ b/content/app/android/sandboxed_process_service.cc @@ -4,6 +4,8 @@ #include "content/app/android/sandboxed_process_service.h" +#include <cpu-features.h> + #include "base/android/jni_array.h" #include "base/logging.h" #include "base/posix/global_descriptors.h" @@ -60,7 +62,11 @@ void InternalInitSandboxedProcess(const std::vector<int>& file_ids, JNIEnv* env, jclass clazz, jobject context, - jobject service) { + jobject service, + jint cpu_count, + jlong cpu_features) { + // Set the CPU properties. + android_setCpu(cpu_count, cpu_features); // Register the file descriptors. // This includes the IPC channel, the crash dump signals and resource related // files. @@ -86,14 +92,17 @@ void InitSandboxedProcess(JNIEnv* env, jobject context, jobject service, jintArray j_file_ids, - jintArray j_file_fds) { + jintArray j_file_fds, + jint cpu_count, + jlong cpu_features) { std::vector<int> file_ids; std::vector<int> file_fds; JavaIntArrayToIntVector(env, j_file_ids, &file_ids); JavaIntArrayToIntVector(env, j_file_fds, &file_fds); InternalInitSandboxedProcess( - file_ids, file_fds, env, clazz, context, service); + file_ids, file_fds, env, clazz, context, service, + cpu_count, cpu_features); } void ExitSandboxedProcess(JNIEnv* env, jclass clazz) { |