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

Side by Side Diff: trunk/src/components/nacl/browser/nacl_process_host.cc

Issue 413063003: Revert 285028 "Pepper: Remove LOAD_MODULE SRPC call in SFI mode." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 5 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 "components/nacl/browser/nacl_process_host.h" 5 #include "components/nacl/browser/nacl_process_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 socket_for_sel_ldr(NACL_INVALID_HANDLE) { } 243 socket_for_sel_ldr(NACL_INVALID_HANDLE) { }
244 }; 244 };
245 245
246 // ----------------------------------------------------------------------------- 246 // -----------------------------------------------------------------------------
247 247
248 unsigned NaClProcessHost::keepalive_throttle_interval_milliseconds_ = 248 unsigned NaClProcessHost::keepalive_throttle_interval_milliseconds_ =
249 ppapi::kKeepaliveThrottleIntervalDefaultMilliseconds; 249 ppapi::kKeepaliveThrottleIntervalDefaultMilliseconds;
250 250
251 NaClProcessHost::NaClProcessHost(const GURL& manifest_url, 251 NaClProcessHost::NaClProcessHost(const GURL& manifest_url,
252 base::File nexe_file, 252 base::File nexe_file,
253 NaClFileToken nexe_token,
254 ppapi::PpapiPermissions permissions, 253 ppapi::PpapiPermissions permissions,
255 int render_view_id, 254 int render_view_id,
256 uint32 permission_bits, 255 uint32 permission_bits,
257 bool uses_irt, 256 bool uses_irt,
258 bool uses_nonsfi_mode, 257 bool uses_nonsfi_mode,
259 bool enable_dyncode_syscalls, 258 bool enable_dyncode_syscalls,
260 bool enable_exception_handling, 259 bool enable_exception_handling,
261 bool enable_crash_throttling, 260 bool enable_crash_throttling,
262 bool off_the_record, 261 bool off_the_record,
263 const base::FilePath& profile_directory) 262 const base::FilePath& profile_directory)
264 : manifest_url_(manifest_url), 263 : manifest_url_(manifest_url),
265 nexe_file_(nexe_file.Pass()), 264 nexe_file_(nexe_file.Pass()),
266 nexe_token_(nexe_token),
267 permissions_(permissions), 265 permissions_(permissions),
268 #if defined(OS_WIN) 266 #if defined(OS_WIN)
269 process_launched_by_broker_(false), 267 process_launched_by_broker_(false),
270 #endif 268 #endif
271 reply_msg_(NULL), 269 reply_msg_(NULL),
272 #if defined(OS_WIN) 270 #if defined(OS_WIN)
273 debug_exception_handler_requested_(false), 271 debug_exception_handler_requested_(false),
274 #endif 272 #endif
275 internal_(new NaClInternal()), 273 internal_(new NaClInternal()),
276 weak_factory_(this), 274 weak_factory_(this),
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 bool NaClProcessHost::StartNaClExecution() { 813 bool NaClProcessHost::StartNaClExecution() {
816 NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); 814 NaClBrowser* nacl_browser = NaClBrowser::GetInstance();
817 815
818 NaClStartParams params; 816 NaClStartParams params;
819 817
820 // Enable PPAPI proxy channel creation only for renderer processes. 818 // Enable PPAPI proxy channel creation only for renderer processes.
821 params.enable_ipc_proxy = enable_ppapi_proxy(); 819 params.enable_ipc_proxy = enable_ppapi_proxy();
822 if (uses_nonsfi_mode_) { 820 if (uses_nonsfi_mode_) {
823 // Currently, non-SFI mode is supported only on Linux. 821 // Currently, non-SFI mode is supported only on Linux.
824 #if defined(OS_LINUX) 822 #if defined(OS_LINUX)
823 // nexe_file_ still keeps the ownership at this moment, because |params|
824 // may just be destroyed before sending IPC is properly processed.
825 // Note that although we set auto_close=true for FileDescriptor's
826 // constructor, it is not automatically handled in its destructor as RAII.
827 params.nexe_file =
828 base::FileDescriptor(nexe_file_.GetPlatformFile(), true);
825 // In non-SFI mode, we do not use SRPC. Make sure that the socketpair is 829 // In non-SFI mode, we do not use SRPC. Make sure that the socketpair is
826 // not created. 830 // not created.
827 DCHECK_EQ(internal_->socket_for_sel_ldr, NACL_INVALID_HANDLE); 831 DCHECK_EQ(internal_->socket_for_sel_ldr, NACL_INVALID_HANDLE);
828 #endif 832 #endif
829 } else { 833 } else {
830 params.validation_cache_enabled = nacl_browser->ValidationCacheIsEnabled(); 834 params.validation_cache_enabled = nacl_browser->ValidationCacheIsEnabled();
831 params.validation_cache_key = nacl_browser->GetValidationCacheKey(); 835 params.validation_cache_key = nacl_browser->GetValidationCacheKey();
832 params.version = NaClBrowser::GetDelegate()->GetVersionString(); 836 params.version = NaClBrowser::GetDelegate()->GetVersionString();
833 params.enable_exception_handling = enable_exception_handling_; 837 params.enable_exception_handling = enable_exception_handling_;
834 params.enable_debug_stub = enable_debug_stub_ && 838 params.enable_debug_stub = enable_debug_stub_ &&
835 NaClBrowser::GetDelegate()->URLMatchesDebugPatterns(manifest_url_); 839 NaClBrowser::GetDelegate()->URLMatchesDebugPatterns(manifest_url_);
836 params.uses_irt = uses_irt_; 840 params.uses_irt = uses_irt_;
837 params.enable_dyncode_syscalls = enable_dyncode_syscalls_; 841 params.enable_dyncode_syscalls = enable_dyncode_syscalls_;
838 842
839 // TODO(teravest): Resolve the file tokens right now instead of making the
840 // loader send IPC to resolve them later.
841 params.nexe_token_lo = nexe_token_.lo;
842 params.nexe_token_hi = nexe_token_.hi;
843
844 const ChildProcessData& data = process_->GetData(); 843 const ChildProcessData& data = process_->GetData();
845 if (!ShareHandleToSelLdr(data.handle, 844 if (!ShareHandleToSelLdr(data.handle,
846 internal_->socket_for_sel_ldr, true, 845 internal_->socket_for_sel_ldr, true,
847 &params.handles)) { 846 &params.handles)) {
848 return false; 847 return false;
849 } 848 }
850 849
851 if (params.uses_irt) { 850 if (params.uses_irt) {
852 const base::File& irt_file = nacl_browser->IrtFile(); 851 const base::File& irt_file = nacl_browser->IrtFile();
853 CHECK(irt_file.IsValid()); 852 CHECK(irt_file.IsValid());
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 if (params.enable_debug_stub) { 884 if (params.enable_debug_stub) {
886 net::SocketDescriptor server_bound_socket = GetDebugStubSocketHandle(); 885 net::SocketDescriptor server_bound_socket = GetDebugStubSocketHandle();
887 if (server_bound_socket != net::kInvalidSocket) { 886 if (server_bound_socket != net::kInvalidSocket) {
888 params.debug_stub_server_bound_socket = 887 params.debug_stub_server_bound_socket =
889 FileDescriptor(server_bound_socket, true); 888 FileDescriptor(server_bound_socket, true);
890 } 889 }
891 } 890 }
892 #endif 891 #endif
893 } 892 }
894 893
895 if (!uses_nonsfi_mode_) { 894 // Here we are about to send the IPC, so release file descriptors to delegate
895 // the ownership to the message.
896 if (uses_nonsfi_mode_) {
897 nexe_file_.TakePlatformFile();
898 } else {
896 internal_->socket_for_sel_ldr = NACL_INVALID_HANDLE; 899 internal_->socket_for_sel_ldr = NACL_INVALID_HANDLE;
897 } 900 }
898 901
899 params.nexe_file = IPC::TakeFileHandleForProcess(nexe_file_.Pass(),
900 process_->GetData().handle);
901
902 process_->Send(new NaClProcessMsg_Start(params)); 902 process_->Send(new NaClProcessMsg_Start(params));
903 return true; 903 return true;
904 } 904 }
905 905
906 // This method is called when NaClProcessHostMsg_PpapiChannelCreated is 906 // This method is called when NaClProcessHostMsg_PpapiChannelCreated is
907 // received. 907 // received.
908 void NaClProcessHost::OnPpapiChannelsCreated( 908 void NaClProcessHost::OnPpapiChannelsCreated(
909 const IPC::ChannelHandle& browser_channel_handle, 909 const IPC::ChannelHandle& browser_channel_handle,
910 const IPC::ChannelHandle& ppapi_renderer_channel_handle, 910 const IPC::ChannelHandle& ppapi_renderer_channel_handle,
911 const IPC::ChannelHandle& trusted_renderer_channel_handle, 911 const IPC::ChannelHandle& trusted_renderer_channel_handle,
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 process_handle.Take(), info, 1146 process_handle.Take(), info,
1147 base::MessageLoopProxy::current(), 1147 base::MessageLoopProxy::current(),
1148 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, 1148 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker,
1149 weak_factory_.GetWeakPtr())); 1149 weak_factory_.GetWeakPtr()));
1150 return true; 1150 return true;
1151 } 1151 }
1152 } 1152 }
1153 #endif 1153 #endif
1154 1154
1155 } // namespace nacl 1155 } // namespace nacl
OLDNEW
« no previous file with comments | « trunk/src/components/nacl/browser/nacl_process_host.h ('k') | trunk/src/components/nacl/common/nacl_host_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698