Index: chromecast/browser/cast_content_browser_client.cc |
diff --git a/chromecast/browser/cast_content_browser_client.cc b/chromecast/browser/cast_content_browser_client.cc |
index e385d963ace8039ba67ad84f28644afdcd444b2e..b3e4bbefbff58a975bc84fe06fef22f03993f8b1 100644 |
--- a/chromecast/browser/cast_content_browser_client.cc |
+++ b/chromecast/browser/cast_content_browser_client.cc |
@@ -37,7 +37,6 @@ |
#include "content/public/common/content_switches.h" |
#include "content/public/common/url_constants.h" |
#include "content/public/common/web_preferences.h" |
-#include "gin/v8_initializer.h" |
#include "media/audio/audio_manager_factory.h" |
#include "net/ssl/ssl_cert_request_info.h" |
#include "net/url_request/url_request_context_getter.h" |
@@ -52,9 +51,7 @@ namespace chromecast { |
namespace shell { |
CastContentBrowserClient::CastContentBrowserClient() |
- : v8_natives_fd_(-1), |
- v8_snapshot_fd_(-1), |
- url_request_context_factory_(new URLRequestContextFactory()) { |
+ : url_request_context_factory_(new URLRequestContextFactory()) { |
} |
CastContentBrowserClient::~CastContentBrowserClient() { |
@@ -314,20 +311,24 @@ bool CastContentBrowserClient::CanCreateWindow( |
void CastContentBrowserClient::GetAdditionalMappedFilesForChildProcess( |
const base::CommandLine& command_line, |
int child_process_id, |
- content::FileDescriptorInfo* mappings) { |
+ content::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()); |
+ DCHECK(v8_files_.IsLoaded()); |
+ mappings->Share(kV8NativesDataDescriptor, v8_files_.natives_fd.get()); |
+ mappings->Share(kV8SnapshotDataDescriptor, v8_files_.snapshot_fd.get()); |
+#if defined(OS_ANDROID) |
+ 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 |
#if defined(OS_ANDROID) |
const int flags_open_read = base::File::FLAG_OPEN | base::File::FLAG_READ; |