| Index: base/android/apk_assets.cc
|
| diff --git a/base/android/apk_assets.cc b/base/android/apk_assets.cc
|
| index 2a433cc4eaef1309150fcdae276d33a302829c49..19a202ce49c54fefe8f9d2dee6883d83214b5383 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,15 +33,16 @@ int OpenApkAsset(const std::string& file_path,
|
| return fd;
|
| }
|
|
|
| -bool RegisterApkAssetWithGlobalDescriptors(base::GlobalDescriptors::Key key,
|
| - const std::string& file_path) {
|
| +bool RegisterApkAssetWithFileDescriptorStore(const std::string& key,
|
| + const base::FilePath& file_path) {
|
| base::MemoryMappedFile::Region region =
|
| base::MemoryMappedFile::Region::kWholeFile;
|
| - int asset_fd = OpenApkAsset(file_path, ®ion);
|
| - if (asset_fd != -1) {
|
| - base::GlobalDescriptors::GetInstance()->Set(key, asset_fd, region);
|
| - }
|
| - return asset_fd != -1;
|
| + int asset_fd = OpenApkAsset(file_path.value(), ®ion);
|
| + if (asset_fd == -1)
|
| + return false;
|
| + base::FileDescriptorStore::GetInstance().Set(key, base::ScopedFD(asset_fd),
|
| + region);
|
| + return true;
|
| }
|
|
|
| } // namespace android
|
|
|