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

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

Issue 337463002: Remove LoadModule SRPC for non-SFI mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 : socket_for_renderer(NACL_INVALID_HANDLE), 250 : socket_for_renderer(NACL_INVALID_HANDLE),
251 socket_for_sel_ldr(NACL_INVALID_HANDLE) { } 251 socket_for_sel_ldr(NACL_INVALID_HANDLE) { }
252 }; 252 };
253 253
254 // ----------------------------------------------------------------------------- 254 // -----------------------------------------------------------------------------
255 255
256 unsigned NaClProcessHost::keepalive_throttle_interval_milliseconds_ = 256 unsigned NaClProcessHost::keepalive_throttle_interval_milliseconds_ =
257 ppapi::kKeepaliveThrottleIntervalDefaultMilliseconds; 257 ppapi::kKeepaliveThrottleIntervalDefaultMilliseconds;
258 258
259 NaClProcessHost::NaClProcessHost(const GURL& manifest_url, 259 NaClProcessHost::NaClProcessHost(const GURL& manifest_url,
260 base::File nexe_file,
260 int render_view_id, 261 int render_view_id,
261 uint32 permission_bits, 262 uint32 permission_bits,
262 bool uses_irt, 263 bool uses_irt,
263 bool uses_nonsfi_mode, 264 bool uses_nonsfi_mode,
264 bool enable_dyncode_syscalls, 265 bool enable_dyncode_syscalls,
265 bool enable_exception_handling, 266 bool enable_exception_handling,
266 bool enable_crash_throttling, 267 bool enable_crash_throttling,
267 bool off_the_record, 268 bool off_the_record,
268 const base::FilePath& profile_directory) 269 const base::FilePath& profile_directory)
269 : manifest_url_(manifest_url), 270 : manifest_url_(manifest_url),
271 nexe_file_(nexe_file.Pass()),
270 permissions_(GetNaClPermissions(permission_bits)), 272 permissions_(GetNaClPermissions(permission_bits)),
271 #if defined(OS_WIN) 273 #if defined(OS_WIN)
272 process_launched_by_broker_(false), 274 process_launched_by_broker_(false),
273 #endif 275 #endif
274 reply_msg_(NULL), 276 reply_msg_(NULL),
275 #if defined(OS_WIN) 277 #if defined(OS_WIN)
276 debug_exception_handler_requested_(false), 278 debug_exception_handler_requested_(false),
277 #endif 279 #endif
278 internal_(new NaClInternal()), 280 internal_(new NaClInternal()),
279 weak_factory_(this), 281 weak_factory_(this),
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 450
449 if (!nonsfi_mode_enabled) { 451 if (!nonsfi_mode_enabled) {
450 SendErrorToRenderer( 452 SendErrorToRenderer(
451 "NaCl non-SFI mode is not available for this platform" 453 "NaCl non-SFI mode is not available for this platform"
452 " and NaCl module."); 454 " and NaCl module.");
453 delete this; 455 delete this;
454 return; 456 return;
455 } 457 }
456 } 458 }
457 459
460 // TODO(hidehiko): We no longer use imc socket channel for non-SFI mode.
461 // Do not create it.
462
458 // Rather than creating a socket pair in the renderer, and passing 463 // Rather than creating a socket pair in the renderer, and passing
459 // one side through the browser to sel_ldr, socket pairs are created 464 // one side through the browser to sel_ldr, socket pairs are created
460 // in the browser and then passed to the renderer and sel_ldr. 465 // in the browser and then passed to the renderer and sel_ldr.
461 // 466 //
462 // This is mainly for the benefit of Windows, where sockets cannot 467 // This is mainly for the benefit of Windows, where sockets cannot
463 // be passed in messages, but are copied via DuplicateHandle(). 468 // be passed in messages, but are copied via DuplicateHandle().
464 // This means the sandboxed renderer cannot send handles to the 469 // This means the sandboxed renderer cannot send handles to the
465 // browser process. 470 // browser process.
466 471
467 NaClHandle pair[2]; 472 NaClHandle pair[2];
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 void NaClProcessHost::OnDebugStubPortSelected(uint16_t debug_stub_port) { 817 void NaClProcessHost::OnDebugStubPortSelected(uint16_t debug_stub_port) {
813 CHECK(!uses_nonsfi_mode_); 818 CHECK(!uses_nonsfi_mode_);
814 SetDebugStubPort(debug_stub_port); 819 SetDebugStubPort(debug_stub_port);
815 } 820 }
816 #endif 821 #endif
817 822
818 bool NaClProcessHost::StartNaClExecution() { 823 bool NaClProcessHost::StartNaClExecution() {
819 NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); 824 NaClBrowser* nacl_browser = NaClBrowser::GetInstance();
820 825
821 NaClStartParams params; 826 NaClStartParams params;
827
822 // Enable PPAPI proxy channel creation only for renderer processes. 828 // Enable PPAPI proxy channel creation only for renderer processes.
823 params.enable_ipc_proxy = enable_ppapi_proxy(); 829 params.enable_ipc_proxy = enable_ppapi_proxy();
824 if (!uses_nonsfi_mode_) { 830 if (uses_nonsfi_mode_) {
831 // Currently, non-SFI mode is supported only on Linux.
832 #if defined(OS_LINUX)
833 // nexe_file_ still keeps the ownership at this moment, because |params|
834 // may just be destroyed before sending IPC is properly processed.
835 // Note that although we set auto_close=true for FileDescriptor's
836 // constructor, it is not automatically handled in its destructor as RAII.
837 params.nexe_file =
838 base::FileDescriptor(nexe_file_.GetPlatformFile(), true);
839 #endif
840 } else {
825 params.validation_cache_enabled = nacl_browser->ValidationCacheIsEnabled(); 841 params.validation_cache_enabled = nacl_browser->ValidationCacheIsEnabled();
826 params.validation_cache_key = nacl_browser->GetValidationCacheKey(); 842 params.validation_cache_key = nacl_browser->GetValidationCacheKey();
827 params.version = NaClBrowser::GetDelegate()->GetVersionString(); 843 params.version = NaClBrowser::GetDelegate()->GetVersionString();
828 params.enable_exception_handling = enable_exception_handling_; 844 params.enable_exception_handling = enable_exception_handling_;
829 params.enable_debug_stub = enable_debug_stub_ && 845 params.enable_debug_stub = enable_debug_stub_ &&
830 NaClBrowser::GetDelegate()->URLMatchesDebugPatterns(manifest_url_); 846 NaClBrowser::GetDelegate()->URLMatchesDebugPatterns(manifest_url_);
831 params.uses_irt = uses_irt_; 847 params.uses_irt = uses_irt_;
832 params.enable_dyncode_syscalls = enable_dyncode_syscalls_; 848 params.enable_dyncode_syscalls = enable_dyncode_syscalls_;
833 } 849 }
834 850
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 #if defined(OS_POSIX) 891 #if defined(OS_POSIX)
876 if (params.enable_debug_stub) { 892 if (params.enable_debug_stub) {
877 net::SocketDescriptor server_bound_socket = GetDebugStubSocketHandle(); 893 net::SocketDescriptor server_bound_socket = GetDebugStubSocketHandle();
878 if (server_bound_socket != net::kInvalidSocket) { 894 if (server_bound_socket != net::kInvalidSocket) {
879 params.debug_stub_server_bound_socket = 895 params.debug_stub_server_bound_socket =
880 FileDescriptor(server_bound_socket, true); 896 FileDescriptor(server_bound_socket, true);
881 } 897 }
882 } 898 }
883 #endif 899 #endif
884 900
901 // Here we are about sending the IPC, so release file descriptors to delegate
Mark Seaborn 2014/06/19 22:36:48 Nit: "about to send the IPC"
hidehiko 2014/06/20 04:02:50 Done.
902 // the ownership to the message.
903 if (uses_nonsfi_mode_) {
904 nexe_file_.TakePlatformFile();
905 }
906 internal_->socket_for_sel_ldr = NACL_INVALID_HANDLE;
907
885 process_->Send(new NaClProcessMsg_Start(params)); 908 process_->Send(new NaClProcessMsg_Start(params));
886
887 internal_->socket_for_sel_ldr = NACL_INVALID_HANDLE;
888 return true; 909 return true;
889 } 910 }
890 911
891 // This method is called when NaClProcessHostMsg_PpapiChannelCreated is 912 // This method is called when NaClProcessHostMsg_PpapiChannelCreated is
892 // received. 913 // received.
893 void NaClProcessHost::OnPpapiChannelsCreated( 914 void NaClProcessHost::OnPpapiChannelsCreated(
894 const IPC::ChannelHandle& browser_channel_handle, 915 const IPC::ChannelHandle& browser_channel_handle,
895 const IPC::ChannelHandle& ppapi_renderer_channel_handle, 916 const IPC::ChannelHandle& ppapi_renderer_channel_handle,
896 const IPC::ChannelHandle& trusted_renderer_channel_handle, 917 const IPC::ChannelHandle& trusted_renderer_channel_handle,
897 const IPC::ChannelHandle& manifest_service_channel_handle) { 918 const IPC::ChannelHandle& manifest_service_channel_handle) {
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 process_handle.Take(), info, 1152 process_handle.Take(), info,
1132 base::MessageLoopProxy::current(), 1153 base::MessageLoopProxy::current(),
1133 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, 1154 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker,
1134 weak_factory_.GetWeakPtr())); 1155 weak_factory_.GetWeakPtr()));
1135 return true; 1156 return true;
1136 } 1157 }
1137 } 1158 }
1138 #endif 1159 #endif
1139 1160
1140 } // namespace nacl 1161 } // namespace nacl
OLDNEW
« no previous file with comments | « components/nacl/browser/nacl_process_host.h ('k') | components/nacl/common/nacl_host_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698