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

Unified Diff: components/nacl/loader/nacl_listener.cc

Issue 218633011: Stop doing unnecessary initialization in non-SFI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
« no previous file with comments | « components/nacl/browser/nacl_process_host.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/nacl/loader/nacl_listener.cc
diff --git a/components/nacl/loader/nacl_listener.cc b/components/nacl/loader/nacl_listener.cc
index 0d29487e86ea676d0326f0214a269637e47fd346..db28dbf19ae38ad8e4225bda713c1c5fb208bf0f 100644
--- a/components/nacl/loader/nacl_listener.cc
+++ b/components/nacl/loader/nacl_listener.cc
@@ -270,17 +270,14 @@ void NaClListener::OnStart(const nacl::NaClStartParams& params) {
NaClChromeMainSetUrandomFd(urandom_fd);
#endif
- NaClChromeMainInit();
- struct NaClChromeMainArgs *args = NaClChromeMainArgsCreate();
- if (args == NULL) {
- LOG(ERROR) << "NaClChromeMainArgsCreate() failed";
- return;
- }
-
- struct NaClApp *nap = NaClAppCreate();
- if (nap == NULL) {
- LOG(ERROR) << "NaClAppCreate() failed";
- return;
+ struct NaClApp* nap = NULL;
+ if (!uses_nonsfi_mode_) {
+ NaClChromeMainInit();
+ nap = NaClAppCreate();
+ if (nap == NULL) {
+ LOG(ERROR) << "NaClAppCreate() failed";
+ return;
+ }
}
IPC::ChannelHandle browser_handle;
@@ -353,6 +350,25 @@ void NaClListener::OnStart(const nacl::NaClStartParams& params) {
std::vector<nacl::FileDescriptor> handles = params.handles;
+#if defined(OS_LINUX)
+ if (uses_nonsfi_mode_) {
+ if (params.uses_irt) {
+ LOG(ERROR) << "IRT must not be used for non-SFI NaCl.";
+ return;
+ }
+ CHECK(handles.size() == 1);
+ int imc_bootstrap_handle = nacl::ToNativeHandle(handles[0]);
+ nacl::nonsfi::MainStart(imc_bootstrap_handle);
+ return;
+ }
+#endif
+
+ struct NaClChromeMainArgs* args = NaClChromeMainArgsCreate();
+ if (args == NULL) {
+ LOG(ERROR) << "NaClChromeMainArgsCreate() failed";
+ return;
+ }
+
#if defined(OS_LINUX) || defined(OS_MACOSX)
args->number_of_cores = number_of_cores_;
args->create_memory_object_func = CreateMemoryObject;
@@ -424,12 +440,6 @@ void NaClListener::OnStart(const nacl::NaClStartParams& params) {
args->prereserved_sandbox_size = prereserved_sandbox_size_;
#endif
-#if defined(OS_LINUX)
- if (uses_nonsfi_mode_) {
- nacl::nonsfi::MainStart(args->imc_bootstrap_handle);
- return;
- }
-#endif
NaClChromeMainStartApp(nap, args);
NOTREACHED();
}
« no previous file with comments | « components/nacl/browser/nacl_process_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698