summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorhamaji@chromium.org <hamaji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-04 06:24:47 +0000
committerhamaji@chromium.org <hamaji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-04 06:24:47 +0000
commit65eba107d38f1f9dea6ef318f34af7446904a0ac (patch)
treec378fdab95e774b35996a531628a5cb2cd162dc3 /components
parent73958b6d336effc4a0954bb038e149df1b1a3369 (diff)
downloadchromium_src-65eba107d38f1f9dea6ef318f34af7446904a0ac.zip
chromium_src-65eba107d38f1f9dea6ef318f34af7446904a0ac.tar.gz
chromium_src-65eba107d38f1f9dea6ef318f34af7446904a0ac.tar.bz2
Stop doing unnecessary initialization in non-SFI
We do not need to call NaClChromeMainInit for non-SFI NaCl. It seems the log module is initialized in other places, and SRPC module is initialized in nonsfi_main. Also set uses_irt=false for non-SFI NaCl. We do not need to send the unnecessary FD of IRT. With this patch, we will not call modify_ldt in non-SFI mode. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3734 BUG=350487 TEST=out/Release/browser_tests --gtest_filter='NaCl*' TEST=Our app works without modify_ldt Review URL: https://codereview.chromium.org/218633011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261691 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components')
-rw-r--r--components/nacl/browser/nacl_process_host.cc2
-rw-r--r--components/nacl/loader/nacl_listener.cc44
2 files changed, 28 insertions, 18 deletions
diff --git a/components/nacl/browser/nacl_process_host.cc b/components/nacl/browser/nacl_process_host.cc
index 89e3f80..98f3919 100644
--- a/components/nacl/browser/nacl_process_host.cc
+++ b/components/nacl/browser/nacl_process_host.cc
@@ -792,7 +792,7 @@ bool NaClProcessHost::StartNaClExecution() {
NaClBrowser::GetDelegate()->URLMatchesDebugPatterns(manifest_url_);
// Enable PPAPI proxy channel creation only for renderer processes.
params.enable_ipc_proxy = enable_ppapi_proxy();
- params.uses_irt = uses_irt_;
+ params.uses_irt = uses_irt_ && !uses_nonsfi_mode_;
params.enable_dyncode_syscalls = enable_dyncode_syscalls_;
const ChildProcessData& data = process_->GetData();
diff --git a/components/nacl/loader/nacl_listener.cc b/components/nacl/loader/nacl_listener.cc
index 0d29487..db28dbf 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();
}