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

Unified Diff: chrome/browser/chrome_content_browser_client.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: Pass FDs & Regions through to child process (Still has formatting errors) 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: chrome/browser/chrome_content_browser_client.cc
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index e07ea7aa1525c34b4ffab0b1a833072daa79498a..65e7f8a75757a92e70882ded883ea959543f044e 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -123,7 +123,6 @@
#include "content/public/common/service_registry.h"
#include "content/public/common/url_utils.h"
#include "content/public/common/web_preferences.h"
-#include "gin/v8_initializer.h"
#include "net/base/mime_util.h"
#include "net/cookies/canonical_cookie.h"
#include "net/cookies/cookie_options.h"
@@ -603,10 +602,6 @@ namespace chrome {
ChromeContentBrowserClient::ChromeContentBrowserClient()
:
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
- v8_natives_fd_(-1),
- v8_snapshot_fd_(-1),
-#endif // OS_POSIX && !OS_MACOSX
weak_factory_(this) {
#if defined(ENABLE_PLUGINS)
for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i)
@@ -2220,24 +2215,31 @@ void ChromeContentBrowserClient::GetAdditionalFileSystemBackends(
}
#if defined(OS_POSIX) && !defined(OS_MACOSX)
+
void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line,
int child_process_id,
- FileDescriptorInfo* mappings) {
+ FileDescriptorInfo* mappings
+#if defined(OS_ANDROID)
+ , std::map<int, base::MemoryMappedFile::Region>* regions
+#endif
+ ) {
#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
- if (v8_natives_fd_.get() == -1 || v8_snapshot_fd_.get() == -1) {
- int v8_natives_fd = -1;
- int v8_snapshot_fd = -1;
- if (gin::V8Initializer::OpenV8FilesForChildProcesses(&v8_natives_fd,
- &v8_snapshot_fd)) {
- v8_natives_fd_.reset(v8_natives_fd);
- v8_snapshot_fd_.reset(v8_snapshot_fd);
- }
+ if (!v8_files_.IsLoaded()) {
+ gin::V8Initializer::OpenV8FilesForChildProcesses(&v8_files_);
}
- DCHECK(v8_natives_fd_.get() != -1 && v8_snapshot_fd_.get() != -1);
- mappings->Share(kV8NativesDataDescriptor, v8_natives_fd_.get());
- mappings->Share(kV8SnapshotDataDescriptor, v8_snapshot_fd_.get());
-#endif // V8_USE_EXTERNAL_STARTUP_DATA
+ DCHECK(v8_files_.IsLoaded());
+ mappings->Share(kV8NativesDataDescriptor, v8_files_.natives_fd.get());
+ mappings->Share(kV8SnapshotDataDescriptor, v8_files_.snapshot_fd.get());
+ LOG(WARNING) << "ANDREW: mapping v8 " << v8_files_.natives_fd.get();
+#if defined(OS_ANDROID)
+ LOG(WARNING) << "ANDREW: inserting v8 " << v8_files_.natives_fd.get();
+ regions->insert(
+ std::make_pair(kV8NativesDataDescriptor, v8_files_.natives_region));
+ regions->insert(
+ std::make_pair(kV8SnapshotDataDescriptor, v8_files_.snapshot_region));
+#endif // defined(OS_ANDROID)
+#endif // V8_USE_EXTERNAL_STARTUP_DATA && !defined(OS_ANDROID)
#if defined(OS_ANDROID)
base::FilePath data_path;

Powered by Google App Engine
This is Rietveld 408576698