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..5e137aa0481ecba7b43049ae887ac1ede6428ad6 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,16 @@ 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) |
+ // The fds are already mapped in the case of Android WebView. |
rmcilroy
2015/05/26 09:15:14
Webview? Please update the comment.
Also, where h
|
+ if (g_fds->MaybeGet(kV8NativesDataDescriptor) == -1) { |
rmcilroy
2015/05/26 09:15:14
Please use the switches::kV8NativesPassedByFD and
|
+ // Map V8 data from within .apk. |
+ CHECK(base::android::RegisterApkAssetWithGlobalDescriptors( |
+ kV8NativesDataDescriptor, gin::V8Initializer::kNativesFileName)); |
+ 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 |
// ChildProcessService::InternalInitChildProcess, otherwise set them here. |
@@ -725,7 +738,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) { |