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

Unified Diff: chrome/browser/nacl_host/nacl_process_host.cc

Issue 10020002: Pass the nacl start parameters as a struct. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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/nacl_host/nacl_process_host.cc
diff --git a/chrome/browser/nacl_host/nacl_process_host.cc b/chrome/browser/nacl_host/nacl_process_host.cc
index 1d79727a415bfcb1dfe98c710e4bc40930842f32..0d4dc2334b558cb67b789cd38f53a4b22d26f209 100644
--- a/chrome/browser/nacl_host/nacl_process_host.cc
+++ b/chrome/browser/nacl_host/nacl_process_host.cc
@@ -880,8 +880,13 @@ void NaClProcessHost::IrtReady() {
}
}
-bool NaClProcessHost::SendStart() {
+bool NaClProcessHost::MakeStartParams(nacl::NaClStartParams* params) {
NaClBrowser* nacl_browser = NaClBrowser::GetInstance();
+
+ params->validation_cache_key = nacl_browser->GetValidatorCacheKey();
+ params->version = chrome::VersionInfo().CreateVersionString();
+ params->enable_exception_handling = enable_exception_handling_;
+
base::PlatformFile irt_file = nacl_browser->IrtFile();
CHECK_NE(irt_file, base::kInvalidPlatformFileValue);
@@ -943,17 +948,16 @@ bool NaClProcessHost::SendStart() {
reply_msg_ = NULL;
internal_->sockets_for_renderer.clear();
- std::vector<nacl::FileDescriptor> handles_for_sel_ldr;
for (size_t i = 0; i < internal_->sockets_for_sel_ldr.size(); i++) {
if (!SendHandleToSelLdr(data.handle,
internal_->sockets_for_sel_ldr[i], true,
- &handles_for_sel_ldr)) {
+ &params->sockets)) {
return false;
}
}
// Send over the IRT file handle. We don't close our own copy!
- if (!SendHandleToSelLdr(data.handle, irt_file, false, &handles_for_sel_ldr))
+ if (!SendHandleToSelLdr(data.handle, irt_file, false, &params->sockets))
return false;
#if defined(OS_MACOSX)
@@ -976,17 +980,18 @@ bool NaClProcessHost::SendStart() {
return false;
}
memory_fd.auto_close = true;
- handles_for_sel_ldr.push_back(memory_fd);
+ params->sockets.push_back(memory_fd);
Mark Seaborn 2012/04/06 23:13:50 The name "sockets" isn't accurate because this arr
#endif
- // Sending the version string over IPC avoids linkage issues in cases where
Mark Seaborn 2012/04/06 23:13:50 Can you keep this comment and move it to the point
- // NaCl is not compiled into the main Chromium executable or DLL.
- chrome::VersionInfo version_info;
- IPC::Message* start_message =
- new NaClProcessMsg_Start(handles_for_sel_ldr,
- nacl_browser->GetValidatorCacheKey(),
- version_info.CreateVersionString(),
- enable_exception_handling_);
+ return true;
+}
+
+bool NaClProcessHost::SendStart() {
+ nacl::NaClStartParams params;
+ if (!MakeStartParams(&params))
+ return false;
+
+ IPC::Message* start_message = new NaClProcessMsg_Start(params);
#if defined(OS_WIN)
if (debug_context_ != NULL) {
debug_context_->SetStartMessage(start_message);

Powered by Google App Engine
This is Rietveld 408576698