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

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 them.
Mark Seaborn 2014/06/18 19:53:12 Nit: 'them' -> 'it', since you're referring to one
hidehiko 2014/06/19 07:01:59 Done.
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 // Note: nexe_file_ still keeps the ownership at this moment, because
Mark Seaborn 2014/06/18 19:53:12 Is this because a base::File can't be used as a pa
hidehiko 2014/06/19 07:01:59 Done.
834 // this params may just be destructed before sending IPC is properly
Mark Seaborn 2014/06/18 19:53:12 Nit: 'destroyed' rather than 'destructed'? Also "
hidehiko 2014/06/19 07:01:59 Done.
835 // processed.
836 params.nexe_file =
837 base::FileDescriptor(nexe_file_.GetPlatformFile(), true);
838 #endif
839 } else {
825 params.validation_cache_enabled = nacl_browser->ValidationCacheIsEnabled(); 840 params.validation_cache_enabled = nacl_browser->ValidationCacheIsEnabled();
826 params.validation_cache_key = nacl_browser->GetValidationCacheKey(); 841 params.validation_cache_key = nacl_browser->GetValidationCacheKey();
827 params.version = NaClBrowser::GetDelegate()->GetVersionString(); 842 params.version = NaClBrowser::GetDelegate()->GetVersionString();
828 params.enable_exception_handling = enable_exception_handling_; 843 params.enable_exception_handling = enable_exception_handling_;
829 params.enable_debug_stub = enable_debug_stub_ && 844 params.enable_debug_stub = enable_debug_stub_ &&
830 NaClBrowser::GetDelegate()->URLMatchesDebugPatterns(manifest_url_); 845 NaClBrowser::GetDelegate()->URLMatchesDebugPatterns(manifest_url_);
831 params.uses_irt = uses_irt_; 846 params.uses_irt = uses_irt_;
832 params.enable_dyncode_syscalls = enable_dyncode_syscalls_; 847 params.enable_dyncode_syscalls = enable_dyncode_syscalls_;
833 } 848 }
834 849
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 net::SocketDescriptor server_bound_socket = GetDebugStubSocketHandle(); 892 net::SocketDescriptor server_bound_socket = GetDebugStubSocketHandle();
878 if (server_bound_socket != net::kInvalidSocket) { 893 if (server_bound_socket != net::kInvalidSocket) {
879 params.debug_stub_server_bound_socket = 894 params.debug_stub_server_bound_socket =
880 FileDescriptor(server_bound_socket, true); 895 FileDescriptor(server_bound_socket, true);
881 } 896 }
882 } 897 }
883 #endif 898 #endif
884 899
885 process_->Send(new NaClProcessMsg_Start(params)); 900 process_->Send(new NaClProcessMsg_Start(params));
886 901
902 if (uses_nonsfi_mode_) {
903 // Send() is processed, so we release the ownership of the nexe_file_ here.
904 nexe_file_.TakePlatformFile();
Mark Seaborn 2014/06/18 19:53:11 Wouldn't it be cleaner to do this immediately befo
hidehiko 2014/06/19 07:01:59 Done.
905 }
887 internal_->socket_for_sel_ldr = NACL_INVALID_HANDLE; 906 internal_->socket_for_sel_ldr = NACL_INVALID_HANDLE;
888 return true; 907 return true;
889 } 908 }
890 909
891 // This method is called when NaClProcessHostMsg_PpapiChannelCreated is 910 // This method is called when NaClProcessHostMsg_PpapiChannelCreated is
892 // received. 911 // received.
893 void NaClProcessHost::OnPpapiChannelsCreated( 912 void NaClProcessHost::OnPpapiChannelsCreated(
894 const IPC::ChannelHandle& browser_channel_handle, 913 const IPC::ChannelHandle& browser_channel_handle,
895 const IPC::ChannelHandle& ppapi_renderer_channel_handle, 914 const IPC::ChannelHandle& ppapi_renderer_channel_handle,
896 const IPC::ChannelHandle& trusted_renderer_channel_handle, 915 const IPC::ChannelHandle& trusted_renderer_channel_handle,
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 process_handle.Take(), info, 1150 process_handle.Take(), info,
1132 base::MessageLoopProxy::current(), 1151 base::MessageLoopProxy::current(),
1133 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, 1152 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker,
1134 weak_factory_.GetWeakPtr())); 1153 weak_factory_.GetWeakPtr()));
1135 return true; 1154 return true;
1136 } 1155 }
1137 } 1156 }
1138 #endif 1157 #endif
1139 1158
1140 } // namespace nacl 1159 } // namespace nacl
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698