| Index: base/android/apk_assets.cc
|
| diff --git a/base/android/apk_assets.cc b/base/android/apk_assets.cc
|
| index 2a433cc4eaef1309150fcdae276d33a302829c49..186ba8980bb5f40b384f96a6393d995a1dea3c2a 100644
|
| --- a/base/android/apk_assets.cc
|
| +++ b/base/android/apk_assets.cc
|
| @@ -10,6 +10,7 @@
|
| #include "base/android/jni_array.h"
|
| #include "base/android/jni_string.h"
|
| #include "base/android/scoped_java_ref.h"
|
| +#include "base/file_descriptor_store.h"
|
| #include "jni/ApkAssets_jni.h"
|
|
|
| namespace base {
|
| @@ -17,8 +18,8 @@ namespace android {
|
|
|
| int OpenApkAsset(const std::string& file_path,
|
| base::MemoryMappedFile::Region* region) {
|
| - // The AAssetManager API of the NDK is does not expose a method for accessing
|
| - // raw resources :(.
|
| + // The AssetManager API of the NDK does not expose a method for accessing raw
|
| + // resources :(
|
| JNIEnv* env = base::android::AttachCurrentThread();
|
| ScopedJavaLocalRef<jlongArray> jarr = Java_ApkAssets_open(
|
| env, base::android::GetApplicationContext(),
|
| @@ -32,6 +33,18 @@ int OpenApkAsset(const std::string& file_path,
|
| return fd;
|
| }
|
|
|
| +bool RegisterApkAssetWithFileDescriptorStore(const std::string& key,
|
| + const std::string& file_path) {
|
| + base::MemoryMappedFile::Region region =
|
| + base::MemoryMappedFile::Region::kWholeFile;
|
| + int asset_fd = OpenApkAsset(file_path, ®ion);
|
| + if (asset_fd == -1)
|
| + return false;
|
| + base::FileDescriptorStore::GetInstance().Set(key, base::ScopedFD(asset_fd),
|
| + region);
|
| + return true;
|
| +}
|
| +
|
| bool RegisterApkAssetWithGlobalDescriptors(base::GlobalDescriptors::Key key,
|
| const std::string& file_path) {
|
| base::MemoryMappedFile::Region region =
|
|
|