Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1946)

Unified Diff: base/android/apk_assets.cc

Issue 2684433003: Files required by a service now listed in manifest. (Closed)
Patch Set: Fix build. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/android/apk_assets.h ('k') | base/file_descriptor_store.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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, &region);
- if (asset_fd != -1) {
- base::GlobalDescriptors::GetInstance()->Set(key, asset_fd, region);
- }
- return asset_fd != -1;
+ int asset_fd = OpenApkAsset(file_path.value(), &region);
+ if (asset_fd == -1)
+ return false;
+ base::FileDescriptorStore::GetInstance().Set(key, base::ScopedFD(asset_fd),
+ region);
+ return true;
}
} // namespace android
« no previous file with comments | « base/android/apk_assets.h ('k') | base/file_descriptor_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698