diff options
author | primiano@chromium.org <primiano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-18 22:50:46 +0000 |
---|---|---|
committer | primiano@chromium.org <primiano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-18 22:50:46 +0000 |
commit | 1b9f6bf9c0126652ae2b1aea33fc8032832472f0 (patch) | |
tree | 425ab9aa4b62da16e3114dc010937dfb140fd73c /base/android | |
parent | c2baa092fcb370d3788ab6ae53079773706e7158 (diff) | |
download | chromium_src-1b9f6bf9c0126652ae2b1aea33fc8032832472f0.zip chromium_src-1b9f6bf9c0126652ae2b1aea33fc8032832472f0.tar.gz chromium_src-1b9f6bf9c0126652ae2b1aea33fc8032832472f0.tar.bz2 |
[android_webview] Introduce AwAssets to reference assets inside the apk.
This change introduces a utility class AwAssets, accessible by native,
which is able to retrieve references (fd + offset + size) of assets
inside the apk. This is to enable direct mmap of uncompressed assets.
This change does NOT introduce yet any change to the WebView apk itself.
At current state, no behavioral change is intended.
BUG=394502
Review URL: https://codereview.chromium.org/401743003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284238 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/android')
-rw-r--r-- | base/android/jni_array.cc | 13 | ||||
-rw-r--r-- | base/android/jni_array.h | 6 |
2 files changed, 19 insertions, 0 deletions
diff --git a/base/android/jni_array.cc b/base/android/jni_array.cc index 6c7ac5b..3c06413 100644 --- a/base/android/jni_array.cc +++ b/base/android/jni_array.cc @@ -167,6 +167,19 @@ void JavaIntArrayToIntVector(JNIEnv* env, env->ReleaseIntArrayElements(int_array, ints, JNI_ABORT); } +void JavaLongArrayToLongVector(JNIEnv* env, + jlongArray long_array, + std::vector<long>* out) { + DCHECK(out); + out->clear(); + jsize len = env->GetArrayLength(long_array); + jlong* longs = env->GetLongArrayElements(long_array, NULL); + for (jsize i = 0; i < len; ++i) { + out->push_back(static_cast<long>(longs[i])); + } + env->ReleaseLongArrayElements(long_array, longs, JNI_ABORT); +} + void JavaFloatArrayToFloatVector(JNIEnv* env, jfloatArray float_array, std::vector<float>* out) { diff --git a/base/android/jni_array.h b/base/android/jni_array.h index 9d9be67..66b9422 100644 --- a/base/android/jni_array.h +++ b/base/android/jni_array.h @@ -73,6 +73,12 @@ BASE_EXPORT void JavaIntArrayToIntVector( jintArray int_array, std::vector<int>* out); +// Replaces the content of |out| with the Java longs in |long_array|. +BASE_EXPORT void JavaLongArrayToLongVector( + JNIEnv* env, + jlongArray long_array, + std::vector<long>* out); + // Replaces the content of |out| with the Java floats in |float_array|. BASE_EXPORT void JavaFloatArrayToFloatVector( JNIEnv* env, |