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

Unified Diff: content/app/content_main_runner.cc

Issue 1156873002: Load v8 snapshots directly from APK (and store them uncompressed) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v8initializer
Patch Set: Remove debug logging Created 5 years, 7 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/app/content_main_runner.cc
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc
index 279536b09b983deec9ae5f22856e5c0bbb72f83a..2382700a86973a5db37c5073797fcc2be7b8c83a 100644
--- a/content/app/content_main_runner.cc
+++ b/content/app/content_main_runner.cc
@@ -51,6 +51,10 @@
#include "ui/base/ui_base_paths.h"
#include "ui/base/ui_base_switches.h"
+#if defined(OS_ANDROID)
+#include "base/android/apk_assets.h"
+#endif
+
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
#include "gin/v8_initializer.h"
#endif
@@ -711,7 +715,13 @@ class ContentMainRunnerImpl : public ContentMainRunner {
#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
#if defined(OS_POSIX) && !defined(OS_MACOSX)
-#if !defined(OS_ANDROID)
+#if defined(OS_ANDROID)
+ // Map V8 data from within .apk.
+ CHECK(base::android::RegisterApkAssetWithGlobalDescriptors(
+ kV8NativesDataDescriptor, gin::V8Initializer::kNativesFileName));
Yaron 2015/05/25 18:56:44 Isn't this introducing new blocking IO on the main
+ CHECK(base::android::RegisterApkAssetWithGlobalDescriptors(
+ kV8SnapshotDataDescriptor, gin::V8Initializer::kSnapshotFileName));
+#else
// kV8NativesDataDescriptor and kV8SnapshotDataDescriptor could be shared
// with child processes via file descriptors. On Android they are set in
Yaron 2015/05/25 18:56:44 update
// ChildProcessService::InternalInitChildProcess, otherwise set them here.
@@ -725,7 +735,7 @@ class ContentMainRunnerImpl : public ContentMainRunner {
kV8SnapshotDataDescriptor,
kV8SnapshotDataDescriptor + base::GlobalDescriptors::kBaseDescriptor);
}
-#endif // !OS_ANDROID
+#endif // OS_ANDROID
int v8_natives_fd = g_fds->MaybeGet(kV8NativesDataDescriptor);
int v8_snapshot_fd = g_fds->MaybeGet(kV8SnapshotDataDescriptor);
if (v8_natives_fd != -1 && v8_snapshot_fd != -1) {

Powered by Google App Engine
This is Rietveld 408576698