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

Unified Diff: content/shell/browser/shell_content_browser_client.cc

Issue 1181953002: Load non-locale .pak files directly from the .apk on Android (rather than extracting on start-up). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@raw-paks
Patch Set: fix unused LoadMainAndroidPackFile Created 5 years, 6 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
Index: content/shell/browser/shell_content_browser_client.cc
diff --git a/content/shell/browser/shell_content_browser_client.cc b/content/shell/browser/shell_content_browser_client.cc
index a48c00860c012a8160aa7b6bf96f4b328775b684..cabc3f709d3e5b3a33b8a7cb1f0456bd16426c9e 100644
--- a/content/shell/browser/shell_content_browser_client.cc
+++ b/content/shell/browser/shell_content_browser_client.cc
@@ -38,6 +38,7 @@
#include "url/gurl.h"
#if defined(OS_ANDROID)
+#include "base/android/apk_assets.h"
#include "base/android/path_utils.h"
#include "components/crash/browser/crash_dump_manager_android.h"
#include "content/shell/android/shell_descriptors.h"
@@ -334,26 +335,22 @@ void ShellContentBrowserClient::OpenURL(
void ShellContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line,
int child_process_id,
- FileDescriptorInfo* mappings) {
+ content::FileDescriptorInfo* mappings
#if defined(OS_ANDROID)
- int flags = base::File::FLAG_OPEN | base::File::FLAG_READ;
- base::FilePath pak_file;
- bool r = PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_file);
- CHECK(r);
- pak_file = pak_file.Append(FILE_PATH_LITERAL("paks"));
- pak_file = pak_file.Append(FILE_PATH_LITERAL("content_shell.pak"));
-
- base::File f(pak_file, flags);
- if (!f.IsValid()) {
- NOTREACHED() << "Failed to open file when creating renderer process: "
- << "content_shell.pak";
- }
-
- mappings->Transfer(kShellPakDescriptor, base::ScopedFD(f.TakePlatformFile()));
+ , std::map<int, base::MemoryMappedFile::Region>* regions
+#endif
+ ) {
+#if defined(OS_ANDROID)
+ mappings->Share(
+ kShellPakDescriptor,
+ base::GlobalDescriptors::GetInstance()->Get(kShellPakDescriptor));
+ regions->insert(std::make_pair(
+ kShellPakDescriptor,
+ base::GlobalDescriptors::GetInstance()->GetRegion(kShellPakDescriptor)));
if (breakpad::IsCrashReporterEnabled()) {
- f = breakpad::CrashDumpManager::GetInstance()->CreateMinidumpFile(
- child_process_id);
+ base::File f(breakpad::CrashDumpManager::GetInstance()->CreateMinidumpFile(
+ child_process_id));
if (!f.IsValid()) {
LOG(ERROR) << "Failed to create file for minidump, crash reporting will "
<< "be disabled for this process.";

Powered by Google App Engine
This is Rietveld 408576698