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

Side by Side Diff: chrome/browser/nacl_host/nacl_process_host.cc

Issue 11761025: When launching PNaCl helper nexes, explicitly disable IRT loading. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rearrange parameter order, etc. Created 7 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/nacl_host/nacl_process_host.h" 5 #include "chrome/browser/nacl_host/nacl_process_host.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 } 137 }
138 138
139 bool NaClProcessHost::PluginListener::OnMessageReceived( 139 bool NaClProcessHost::PluginListener::OnMessageReceived(
140 const IPC::Message& msg) { 140 const IPC::Message& msg) {
141 return host_->OnUntrustedMessageForwarded(msg); 141 return host_->OnUntrustedMessageForwarded(msg);
142 } 142 }
143 143
144 NaClProcessHost::NaClProcessHost(const GURL& manifest_url, 144 NaClProcessHost::NaClProcessHost(const GURL& manifest_url,
145 int render_view_id, 145 int render_view_id,
146 uint32 permission_bits, 146 uint32 permission_bits,
147 bool off_the_record) 147 bool off_the_record,
148 bool uses_irt)
148 : manifest_url_(manifest_url), 149 : manifest_url_(manifest_url),
149 permissions_(GetNaClPermissions(permission_bits)), 150 permissions_(GetNaClPermissions(permission_bits)),
150 #if defined(OS_WIN) 151 #if defined(OS_WIN)
151 process_launched_by_broker_(false), 152 process_launched_by_broker_(false),
152 #elif defined(OS_LINUX) 153 #elif defined(OS_LINUX)
153 wait_for_nacl_gdb_(false), 154 wait_for_nacl_gdb_(false),
154 #endif 155 #endif
155 reply_msg_(NULL), 156 reply_msg_(NULL),
156 #if defined(OS_WIN) 157 #if defined(OS_WIN)
157 debug_exception_handler_requested_(false), 158 debug_exception_handler_requested_(false),
158 #endif 159 #endif
159 internal_(new NaClInternal()), 160 internal_(new NaClInternal()),
160 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), 161 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
161 enable_exception_handling_(false), 162 enable_exception_handling_(false),
162 enable_debug_stub_(false), 163 enable_debug_stub_(false),
163 off_the_record_(off_the_record), 164 off_the_record_(off_the_record),
164 enable_ipc_proxy_(false), 165 enable_ipc_proxy_(false),
166 uses_irt_(uses_irt),
165 ALLOW_THIS_IN_INITIALIZER_LIST(ipc_plugin_listener_(this)), 167 ALLOW_THIS_IN_INITIALIZER_LIST(ipc_plugin_listener_(this)),
166 render_view_id_(render_view_id) { 168 render_view_id_(render_view_id) {
167 process_.reset(content::BrowserChildProcessHost::Create( 169 process_.reset(content::BrowserChildProcessHost::Create(
168 content::PROCESS_TYPE_NACL_LOADER, this)); 170 content::PROCESS_TYPE_NACL_LOADER, this));
169 171
170 // Set the display name so the user knows what plugin the process is running. 172 // Set the display name so the user knows what plugin the process is running.
171 // We aren't on the UI thread so getting the pref locale for language 173 // We aren't on the UI thread so getting the pref locale for language
172 // formatting isn't possible, so IDN will be lost, but this is probably OK 174 // formatting isn't possible, so IDN will be lost, but this is probably OK
173 // for this use case. 175 // for this use case.
174 process_->SetName(net::FormatUrl(manifest_url_, std::string())); 176 process_->SetName(net::FormatUrl(manifest_url_, std::string()));
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); 707 NaClBrowser* nacl_browser = NaClBrowser::GetInstance();
706 708
707 nacl::NaClStartParams params; 709 nacl::NaClStartParams params;
708 params.validation_cache_enabled = nacl_browser->ValidationCacheIsEnabled(); 710 params.validation_cache_enabled = nacl_browser->ValidationCacheIsEnabled();
709 params.validation_cache_key = nacl_browser->GetValidationCacheKey(); 711 params.validation_cache_key = nacl_browser->GetValidationCacheKey();
710 params.version = chrome::VersionInfo().CreateVersionString(); 712 params.version = chrome::VersionInfo().CreateVersionString();
711 params.enable_exception_handling = enable_exception_handling_; 713 params.enable_exception_handling = enable_exception_handling_;
712 params.enable_debug_stub = enable_debug_stub_ && 714 params.enable_debug_stub = enable_debug_stub_ &&
713 NaClBrowser::GetInstance()->URLMatchesDebugPatterns(manifest_url_); 715 NaClBrowser::GetInstance()->URLMatchesDebugPatterns(manifest_url_);
714 params.enable_ipc_proxy = enable_ipc_proxy_; 716 params.enable_ipc_proxy = enable_ipc_proxy_;
715 717 params.uses_irt = uses_irt_;
716 base::PlatformFile irt_file = nacl_browser->IrtFile();
717 CHECK_NE(irt_file, base::kInvalidPlatformFileValue);
718 718
719 const ChildProcessData& data = process_->GetData(); 719 const ChildProcessData& data = process_->GetData();
720 for (size_t i = 0; i < internal_->sockets_for_sel_ldr.size(); i++) { 720 for (size_t i = 0; i < internal_->sockets_for_sel_ldr.size(); i++) {
721 if (!ShareHandleToSelLdr(data.handle, 721 if (!ShareHandleToSelLdr(data.handle,
722 internal_->sockets_for_sel_ldr[i], true, 722 internal_->sockets_for_sel_ldr[i], true,
723 &params.handles)) { 723 &params.handles)) {
724 return false; 724 return false;
725 } 725 }
726 } 726 }
727 727
728 // Send over the IRT file handle. We don't close our own copy! 728 if (params.uses_irt) {
729 if (!ShareHandleToSelLdr(data.handle, irt_file, false, &params.handles)) 729 // Send over the IRT file handle. We don't close our own copy!
Mark Seaborn 2013/01/04 17:40:54 I think this comment should stay next to the Share
jvoung (off chromium) 2013/01/04 17:59:27 Done.
730 return false; 730 base::PlatformFile irt_file = nacl_browser->IrtFile();
731 CHECK_NE(irt_file, base::kInvalidPlatformFileValue);
732
733 if (!ShareHandleToSelLdr(data.handle, irt_file, false, &params.handles))
734 return false;
735 }
731 736
732 #if defined(OS_MACOSX) 737 #if defined(OS_MACOSX)
733 // For dynamic loading support, NaCl requires a file descriptor that 738 // For dynamic loading support, NaCl requires a file descriptor that
734 // was created in /tmp, since those created with shm_open() are not 739 // was created in /tmp, since those created with shm_open() are not
735 // mappable with PROT_EXEC. Rather than requiring an extra IPC 740 // mappable with PROT_EXEC. Rather than requiring an extra IPC
736 // round trip out of the sandbox, we create an FD here. 741 // round trip out of the sandbox, we create an FD here.
737 base::SharedMemory memory_buffer; 742 base::SharedMemory memory_buffer;
738 base::SharedMemoryCreateOptions options; 743 base::SharedMemoryCreateOptions options;
739 options.size = 1; 744 options.size = 1;
740 options.executable = true; 745 options.executable = true;
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 } else { 934 } else {
930 NaClStartDebugExceptionHandlerThread( 935 NaClStartDebugExceptionHandlerThread(
931 process_handle.Take(), info, 936 process_handle.Take(), info,
932 base::MessageLoopProxy::current(), 937 base::MessageLoopProxy::current(),
933 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, 938 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker,
934 weak_factory_.GetWeakPtr())); 939 weak_factory_.GetWeakPtr()));
935 return true; 940 return true;
936 } 941 }
937 } 942 }
938 #endif 943 #endif
OLDNEW
« no previous file with comments | « chrome/browser/nacl_host/nacl_process_host.h ('k') | chrome/browser/renderer_host/chrome_render_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698