| OLD | NEW |
| 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 <string.h> | 7 #include <string.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/base_switches.h" | 13 #include "base/base_switches.h" |
| 14 #include "base/bind.h" | 14 #include "base/bind.h" |
| 15 #include "base/callback_helpers.h" |
| 15 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 16 #include "base/files/file_util.h" | 17 #include "base/files/file_util.h" |
| 17 #include "base/location.h" | 18 #include "base/location.h" |
| 18 #include "base/macros.h" | 19 #include "base/macros.h" |
| 19 #include "base/memory/ptr_util.h" | 20 #include "base/memory/ptr_util.h" |
| 20 #include "base/metrics/histogram_macros.h" | 21 #include "base/metrics/histogram_macros.h" |
| 21 #include "base/path_service.h" | 22 #include "base/path_service.h" |
| 22 #include "base/process/launch.h" | 23 #include "base/process/launch.h" |
| 23 #include "base/process/process_iterator.h" | 24 #include "base/process/process_iterator.h" |
| 24 #include "base/rand_util.h" | 25 #include "base/rand_util.h" |
| 25 #include "base/single_thread_task_runner.h" | 26 #include "base/single_thread_task_runner.h" |
| 26 #include "base/stl_util.h" | 27 #include "base/stl_util.h" |
| 27 #include "base/strings/string_number_conversions.h" | 28 #include "base/strings/string_number_conversions.h" |
| 28 #include "base/strings/string_split.h" | 29 #include "base/strings/string_split.h" |
| 29 #include "base/strings/string_util.h" | 30 #include "base/strings/string_util.h" |
| 30 #include "base/strings/stringprintf.h" | 31 #include "base/strings/stringprintf.h" |
| 31 #include "base/strings/utf_string_conversions.h" | 32 #include "base/strings/utf_string_conversions.h" |
| 32 #include "base/sys_byteorder.h" | 33 #include "base/sys_byteorder.h" |
| 33 #include "base/threading/sequenced_worker_pool.h" | 34 #include "base/threading/sequenced_worker_pool.h" |
| 34 #include "base/threading/thread_task_runner_handle.h" | 35 #include "base/threading/thread_task_runner_handle.h" |
| 35 #include "build/build_config.h" | 36 #include "build/build_config.h" |
| 36 #include "components/nacl/browser/nacl_browser.h" | 37 #include "components/nacl/browser/nacl_browser.h" |
| 37 #include "components/nacl/browser/nacl_browser_delegate.h" | 38 #include "components/nacl/browser/nacl_browser_delegate.h" |
| 38 #include "components/nacl/browser/nacl_host_message_filter.h" | |
| 39 #include "components/nacl/common/nacl_cmd_line.h" | 39 #include "components/nacl/common/nacl_cmd_line.h" |
| 40 #include "components/nacl/common/nacl_constants.h" | 40 #include "components/nacl/common/nacl_constants.h" |
| 41 #include "components/nacl/common/nacl_host_messages.h" | |
| 42 #include "components/nacl/common/nacl_messages.h" | 41 #include "components/nacl/common/nacl_messages.h" |
| 43 #include "components/nacl/common/nacl_process_type.h" | 42 #include "components/nacl/common/nacl_process_type.h" |
| 44 #include "components/nacl/common/nacl_switches.h" | 43 #include "components/nacl/common/nacl_switches.h" |
| 45 #include "components/url_formatter/url_formatter.h" | 44 #include "components/url_formatter/url_formatter.h" |
| 46 #include "content/public/browser/browser_child_process_host.h" | 45 #include "content/public/browser/browser_child_process_host.h" |
| 47 #include "content/public/browser/browser_ppapi_host.h" | 46 #include "content/public/browser/browser_ppapi_host.h" |
| 47 #include "content/public/browser/browser_thread.h" |
| 48 #include "content/public/browser/child_process_data.h" | 48 #include "content/public/browser/child_process_data.h" |
| 49 #include "content/public/browser/plugin_service.h" | 49 #include "content/public/browser/plugin_service.h" |
| 50 #include "content/public/browser/render_process_host.h" | 50 #include "content/public/browser/render_process_host.h" |
| 51 #include "content/public/browser/web_contents.h" | 51 #include "content/public/browser/web_contents.h" |
| 52 #include "content/public/common/child_process_host.h" | 52 #include "content/public/common/child_process_host.h" |
| 53 #include "content/public/common/content_switches.h" | 53 #include "content/public/common/content_switches.h" |
| 54 #include "content/public/common/mojo_channel_switches.h" | 54 #include "content/public/common/mojo_channel_switches.h" |
| 55 #include "content/public/common/process_type.h" | 55 #include "content/public/common/process_type.h" |
| 56 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 56 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
| 57 #include "ipc/ipc_channel.h" | 57 #include "ipc/ipc_channel.h" |
| 58 #include "mojo/edk/embedder/embedder.h" | 58 #include "mojo/edk/embedder/embedder.h" |
| 59 #include "mojo/public/cpp/system/platform_handle.h" |
| 59 #include "net/socket/socket_descriptor.h" | 60 #include "net/socket/socket_descriptor.h" |
| 60 #include "ppapi/host/host_factory.h" | 61 #include "ppapi/host/host_factory.h" |
| 61 #include "ppapi/host/ppapi_host.h" | 62 #include "ppapi/host/ppapi_host.h" |
| 62 #include "ppapi/proxy/ppapi_messages.h" | 63 #include "ppapi/proxy/ppapi_messages.h" |
| 63 #include "ppapi/shared_impl/ppapi_constants.h" | 64 #include "ppapi/shared_impl/ppapi_constants.h" |
| 64 #include "ppapi/shared_impl/ppapi_nacl_plugin_args.h" | 65 #include "ppapi/shared_impl/ppapi_nacl_plugin_args.h" |
| 65 | 66 |
| 66 #if defined(OS_POSIX) | 67 #if defined(OS_POSIX) |
| 67 | 68 |
| 68 #include <arpa/inet.h> | 69 #include <arpa/inet.h> |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 199 |
| 199 unsigned NaClProcessHost::keepalive_throttle_interval_milliseconds_ = | 200 unsigned NaClProcessHost::keepalive_throttle_interval_milliseconds_ = |
| 200 ppapi::kKeepaliveThrottleIntervalDefaultMilliseconds; | 201 ppapi::kKeepaliveThrottleIntervalDefaultMilliseconds; |
| 201 | 202 |
| 202 NaClProcessHost::NaClProcessHost( | 203 NaClProcessHost::NaClProcessHost( |
| 203 const GURL& manifest_url, | 204 const GURL& manifest_url, |
| 204 base::File nexe_file, | 205 base::File nexe_file, |
| 205 const NaClFileToken& nexe_token, | 206 const NaClFileToken& nexe_token, |
| 206 const std::vector<NaClResourcePrefetchResult>& prefetched_resource_files, | 207 const std::vector<NaClResourcePrefetchResult>& prefetched_resource_files, |
| 207 ppapi::PpapiPermissions permissions, | 208 ppapi::PpapiPermissions permissions, |
| 209 int render_process_id, |
| 208 int render_view_id, | 210 int render_view_id, |
| 209 uint32_t permission_bits, | 211 uint32_t permission_bits, |
| 210 bool uses_nonsfi_mode, | 212 bool uses_nonsfi_mode, |
| 211 bool off_the_record, | 213 bool off_the_record, |
| 212 NaClAppProcessType process_type, | 214 NaClAppProcessType process_type, |
| 213 const base::FilePath& profile_directory) | 215 const base::FilePath& profile_directory) |
| 214 : manifest_url_(manifest_url), | 216 : manifest_url_(manifest_url), |
| 215 nexe_file_(std::move(nexe_file)), | 217 nexe_file_(std::move(nexe_file)), |
| 216 nexe_token_(nexe_token), | 218 nexe_token_(nexe_token), |
| 217 prefetched_resource_files_(prefetched_resource_files), | 219 prefetched_resource_files_(prefetched_resource_files), |
| 218 permissions_(permissions), | 220 permissions_(permissions), |
| 219 #if defined(OS_WIN) | 221 #if defined(OS_WIN) |
| 220 process_launched_by_broker_(false), | 222 process_launched_by_broker_(false), |
| 221 #endif | 223 #endif |
| 222 reply_msg_(NULL), | |
| 223 #if defined(OS_WIN) | 224 #if defined(OS_WIN) |
| 224 debug_exception_handler_requested_(false), | 225 debug_exception_handler_requested_(false), |
| 225 #endif | 226 #endif |
| 226 uses_nonsfi_mode_(uses_nonsfi_mode), | 227 uses_nonsfi_mode_(uses_nonsfi_mode), |
| 227 enable_debug_stub_(false), | 228 enable_debug_stub_(false), |
| 228 enable_crash_throttling_(false), | 229 enable_crash_throttling_(false), |
| 229 off_the_record_(off_the_record), | 230 off_the_record_(off_the_record), |
| 230 process_type_(process_type), | 231 process_type_(process_type), |
| 231 profile_directory_(profile_directory), | 232 profile_directory_(profile_directory), |
| 233 render_process_id_(render_process_id), |
| 232 render_view_id_(render_view_id), | 234 render_view_id_(render_view_id), |
| 233 weak_factory_(this) { | 235 weak_factory_(this) { |
| 234 process_.reset(content::BrowserChildProcessHost::Create( | 236 process_.reset(content::BrowserChildProcessHost::Create( |
| 235 static_cast<content::ProcessType>(PROCESS_TYPE_NACL_LOADER), this, | 237 static_cast<content::ProcessType>(PROCESS_TYPE_NACL_LOADER), this, |
| 236 kNaClLoaderServiceName)); | 238 kNaClLoaderServiceName)); |
| 237 | 239 |
| 238 // Set the display name so the user knows what plugin the process is running. | 240 // Set the display name so the user knows what plugin the process is running. |
| 239 // We aren't on the UI thread so getting the pref locale for language | 241 // We aren't on the UI thread so getting the pref locale for language |
| 240 // formatting isn't possible, so IDN will be lost, but this is probably OK | 242 // formatting isn't possible, so IDN will be lost, but this is probably OK |
| 241 // for this use case. | 243 // for this use case. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 content::BrowserThread::GetBlockingPool()->PostTask( | 278 content::BrowserThread::GetBlockingPool()->PostTask( |
| 277 FROM_HERE, base::Bind(&CloseFile, base::Passed(std::move(file)))); | 279 FROM_HERE, base::Bind(&CloseFile, base::Passed(std::move(file)))); |
| 278 } | 280 } |
| 279 #endif | 281 #endif |
| 280 // Open files need to be closed on the blocking pool. | 282 // Open files need to be closed on the blocking pool. |
| 281 if (nexe_file_.IsValid()) { | 283 if (nexe_file_.IsValid()) { |
| 282 content::BrowserThread::GetBlockingPool()->PostTask( | 284 content::BrowserThread::GetBlockingPool()->PostTask( |
| 283 FROM_HERE, base::Bind(&CloseFile, base::Passed(std::move(nexe_file_)))); | 285 FROM_HERE, base::Bind(&CloseFile, base::Passed(std::move(nexe_file_)))); |
| 284 } | 286 } |
| 285 | 287 |
| 286 if (reply_msg_) { | 288 if (!launch_callback_.is_null()) { |
| 287 // The process failed to launch for some reason. | 289 // The process failed to launch for some reason. |
| 288 // Don't keep the renderer hanging. | 290 // Don't keep the renderer hanging. |
| 289 reply_msg_->set_reply_error(); | 291 SendMessageToRenderer(mojom::NaClLaunchResultPtr(), ""); |
| 290 nacl_host_message_filter_->Send(reply_msg_); | |
| 291 } | 292 } |
| 292 #if defined(OS_WIN) | 293 #if defined(OS_WIN) |
| 293 if (process_launched_by_broker_) { | 294 if (process_launched_by_broker_) { |
| 294 NaClBrokerService::GetInstance()->OnLoaderDied(); | 295 NaClBrokerService::GetInstance()->OnLoaderDied(); |
| 295 } | 296 } |
| 296 #endif | 297 #endif |
| 297 } | 298 } |
| 298 | 299 |
| 299 void NaClProcessHost::OnProcessCrashed(int exit_status) { | 300 void NaClProcessHost::OnProcessCrashed(int exit_status) { |
| 300 if (enable_crash_throttling_ && | 301 if (enable_crash_throttling_ && |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 } | 344 } |
| 344 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) | 345 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) |
| 345 | 346 |
| 346 // static | 347 // static |
| 347 void NaClProcessHost::SetPpapiKeepAliveThrottleForTesting( | 348 void NaClProcessHost::SetPpapiKeepAliveThrottleForTesting( |
| 348 unsigned milliseconds) { | 349 unsigned milliseconds) { |
| 349 keepalive_throttle_interval_milliseconds_ = milliseconds; | 350 keepalive_throttle_interval_milliseconds_ = milliseconds; |
| 350 } | 351 } |
| 351 | 352 |
| 352 void NaClProcessHost::Launch( | 353 void NaClProcessHost::Launch( |
| 353 NaClHostMessageFilter* nacl_host_message_filter, | 354 const base::FilePath& manifest_path, |
| 354 IPC::Message* reply_msg, | 355 const mojom::NaClHost::LaunchNaClCallback& callback) { |
| 355 const base::FilePath& manifest_path) { | 356 launch_callback_ = callback; |
| 356 nacl_host_message_filter_ = nacl_host_message_filter; | |
| 357 reply_msg_ = reply_msg; | |
| 358 manifest_path_ = manifest_path; | 357 manifest_path_ = manifest_path; |
| 359 | 358 |
| 360 // Do not launch the requested NaCl module if NaCl is marked "unstable" due | 359 // Do not launch the requested NaCl module if NaCl is marked "unstable" due |
| 361 // to too many crashes within a given time period. | 360 // to too many crashes within a given time period. |
| 362 if (enable_crash_throttling_ && | 361 if (enable_crash_throttling_ && |
| 363 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 362 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 364 switches::kDisablePnaclCrashThrottling) && | 363 switches::kDisablePnaclCrashThrottling) && |
| 365 NaClBrowser::GetInstance()->IsThrottled()) { | 364 NaClBrowser::GetInstance()->IsThrottled()) { |
| 366 SendErrorToRenderer("Process creation was throttled due to excessive" | 365 SendErrorToRenderer("Process creation was throttled due to excessive" |
| 367 " crashes"); | 366 " crashes"); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 398 | 397 |
| 399 if (uses_nonsfi_mode_) { | 398 if (uses_nonsfi_mode_) { |
| 400 bool nonsfi_mode_forced_by_command_line = false; | 399 bool nonsfi_mode_forced_by_command_line = false; |
| 401 bool nonsfi_mode_allowed = false; | 400 bool nonsfi_mode_allowed = false; |
| 402 #if defined(OS_LINUX) | 401 #if defined(OS_LINUX) |
| 403 nonsfi_mode_forced_by_command_line = | 402 nonsfi_mode_forced_by_command_line = |
| 404 cmd->HasSwitch(switches::kEnableNaClNonSfiMode); | 403 cmd->HasSwitch(switches::kEnableNaClNonSfiMode); |
| 405 #if defined(OS_CHROMEOS) && \ | 404 #if defined(OS_CHROMEOS) && \ |
| 406 (defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARMEL)) | 405 (defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARMEL)) |
| 407 nonsfi_mode_allowed = NaClBrowser::GetDelegate()->IsNonSfiModeAllowed( | 406 nonsfi_mode_allowed = NaClBrowser::GetDelegate()->IsNonSfiModeAllowed( |
| 408 nacl_host_message_filter->profile_directory(), manifest_url_); | 407 profile_directory_, manifest_url_); |
| 409 #endif | 408 #endif |
| 410 #endif | 409 #endif |
| 411 bool nonsfi_mode_enabled = | 410 bool nonsfi_mode_enabled = |
| 412 nonsfi_mode_forced_by_command_line || nonsfi_mode_allowed; | 411 nonsfi_mode_forced_by_command_line || nonsfi_mode_allowed; |
| 413 | 412 |
| 414 if (!nonsfi_mode_enabled) { | 413 if (!nonsfi_mode_enabled) { |
| 415 SendErrorToRenderer( | 414 SendErrorToRenderer( |
| 416 "NaCl non-SFI mode is not available for this platform" | 415 "NaCl non-SFI mode is not available for this platform" |
| 417 " and NaCl module."); | 416 " and NaCl module."); |
| 418 delete this; | 417 delete this; |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 delete this; | 627 delete this; |
| 629 } else if (!StartNaClExecution()) { | 628 } else if (!StartNaClExecution()) { |
| 630 delete this; | 629 delete this; |
| 631 } | 630 } |
| 632 } | 631 } |
| 633 | 632 |
| 634 void NaClProcessHost::ReplyToRenderer( | 633 void NaClProcessHost::ReplyToRenderer( |
| 635 mojo::ScopedMessagePipeHandle ppapi_channel_handle, | 634 mojo::ScopedMessagePipeHandle ppapi_channel_handle, |
| 636 mojo::ScopedMessagePipeHandle trusted_channel_handle, | 635 mojo::ScopedMessagePipeHandle trusted_channel_handle, |
| 637 mojo::ScopedMessagePipeHandle manifest_service_channel_handle) { | 636 mojo::ScopedMessagePipeHandle manifest_service_channel_handle) { |
| 638 // Hereafter, we always send an IPC message with handles created above | |
| 639 // which, on Windows, are not closable in this process. | |
| 640 std::string error_message; | |
| 641 base::SharedMemoryHandle crash_info_shmem_renderer_handle; | |
| 642 if (!crash_info_shmem_.ShareToProcess(nacl_host_message_filter_->PeerHandle(), | |
| 643 &crash_info_shmem_renderer_handle)) { | |
| 644 // On error, we do not send "IPC::ChannelHandle"s to the renderer process. | |
| 645 // Note that some other FDs/handles still get sent to the renderer, but | |
| 646 // will be closed there. | |
| 647 ppapi_channel_handle.reset(); | |
| 648 trusted_channel_handle.reset(); | |
| 649 manifest_service_channel_handle.reset(); | |
| 650 error_message = "ShareToProcess() failed"; | |
| 651 } | |
| 652 | |
| 653 const ChildProcessData& data = process_->GetData(); | 637 const ChildProcessData& data = process_->GetData(); |
| 654 SendMessageToRenderer( | 638 auto result = mojom::NaClLaunchResult::New(); |
| 655 NaClLaunchResult(ppapi_channel_handle.release(), | 639 result->ppapi_ipc_channel_handle = std::move(ppapi_channel_handle); |
| 656 trusted_channel_handle.release(), | 640 result->trusted_ipc_channel_handle = |
| 657 manifest_service_channel_handle.release(), | 641 mojo::MakeRequest<mojom::NaClRendererHost>( |
| 658 base::GetProcId(data.handle), | 642 std::move(trusted_channel_handle)); |
| 659 data.id, | 643 result->manifest_service_ipc_channel_handle = |
| 660 crash_info_shmem_renderer_handle), | 644 std::move(manifest_service_channel_handle); |
| 661 error_message); | 645 result->plugin_pid = base::GetProcId(data.handle); |
| 646 result->plugin_child_id = data.id; |
| 647 result->crash_info_shmem_handle = mojo::WrapSharedMemoryHandle( |
| 648 crash_info_shmem_.TakeHandle(), kNaClCrashInfoShmemSize, false); |
| 649 SendMessageToRenderer(std::move(result), ""); |
| 662 | 650 |
| 663 // Now that the crash information shmem handles have been shared with the | 651 // Now that the crash information shmem handles have been shared with the |
| 664 // plugin and the renderer, the browser can close its handle. | 652 // plugin and the renderer, the browser can close its handle. |
| 665 crash_info_shmem_.Close(); | 653 crash_info_shmem_.Close(); |
| 666 } | 654 } |
| 667 | 655 |
| 668 void NaClProcessHost::SendErrorToRenderer(const std::string& error_message) { | 656 void NaClProcessHost::SendErrorToRenderer(const std::string& error_message) { |
| 669 LOG(ERROR) << "NaCl process launch failed: " << error_message; | 657 LOG(ERROR) << "NaCl process launch failed: " << error_message; |
| 670 SendMessageToRenderer(NaClLaunchResult(), error_message); | 658 SendMessageToRenderer(mojom::NaClLaunchResultPtr(), error_message); |
| 671 } | 659 } |
| 672 | 660 |
| 673 void NaClProcessHost::SendMessageToRenderer( | 661 void NaClProcessHost::SendMessageToRenderer(mojom::NaClLaunchResultPtr result, |
| 674 const NaClLaunchResult& result, | 662 const std::string& error_message) { |
| 675 const std::string& error_message) { | 663 DCHECK(!launch_callback_.is_null()); |
| 676 DCHECK(nacl_host_message_filter_.get()); | 664 if (launch_callback_.is_null()) { |
| 677 DCHECK(reply_msg_); | |
| 678 if (nacl_host_message_filter_.get() == NULL || reply_msg_ == NULL) { | |
| 679 // As DCHECKed above, this case should not happen in general. | 665 // As DCHECKed above, this case should not happen in general. |
| 680 // Though, in this case, unfortunately there is no proper way to release | |
| 681 // resources which are already created in |result|. We just give up on | |
| 682 // releasing them, and leak them. | |
| 683 return; | 666 return; |
| 684 } | 667 } |
| 685 | 668 |
| 686 NaClHostMsg_LaunchNaCl::WriteReplyParams(reply_msg_, result, error_message); | 669 base::ResetAndReturn(&launch_callback_).Run(std::move(result), error_message); |
| 687 nacl_host_message_filter_->Send(reply_msg_); | |
| 688 nacl_host_message_filter_ = NULL; | |
| 689 reply_msg_ = NULL; | |
| 690 } | 670 } |
| 691 | 671 |
| 692 void NaClProcessHost::SetDebugStubPort(int port) { | 672 void NaClProcessHost::SetDebugStubPort(int port) { |
| 693 NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); | 673 NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); |
| 694 nacl_browser->SetProcessGdbDebugStubPort(process_->GetData().id, port); | 674 nacl_browser->SetProcessGdbDebugStubPort(process_->GetData().id, port); |
| 695 } | 675 } |
| 696 | 676 |
| 697 #if defined(OS_POSIX) | 677 #if defined(OS_POSIX) |
| 698 // TCP port we chose for NaCl debug stub. It can be any other number. | 678 // TCP port we chose for NaCl debug stub. It can be any other number. |
| 699 static const uint16_t kInitialDebugStubPort = 4014; | 679 static const uint16_t kInitialDebugStubPort = 4014; |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 | 900 |
| 921 DCHECK_EQ(PROCESS_TYPE_NACL_LOADER, process_->GetData().process_type); | 901 DCHECK_EQ(PROCESS_TYPE_NACL_LOADER, process_->GetData().process_type); |
| 922 | 902 |
| 923 ipc_proxy_channel_ = IPC::ChannelProxy::Create( | 903 ipc_proxy_channel_ = IPC::ChannelProxy::Create( |
| 924 channel_handle.release(), IPC::Channel::MODE_CLIENT, NULL, | 904 channel_handle.release(), IPC::Channel::MODE_CLIENT, NULL, |
| 925 base::ThreadTaskRunnerHandle::Get().get()); | 905 base::ThreadTaskRunnerHandle::Get().get()); |
| 926 // Create the browser ppapi host and enable PPAPI message dispatching to the | 906 // Create the browser ppapi host and enable PPAPI message dispatching to the |
| 927 // browser process. | 907 // browser process. |
| 928 ppapi_host_.reset(content::BrowserPpapiHost::CreateExternalPluginProcess( | 908 ppapi_host_.reset(content::BrowserPpapiHost::CreateExternalPluginProcess( |
| 929 ipc_proxy_channel_.get(), // sender | 909 ipc_proxy_channel_.get(), // sender |
| 930 permissions_, | 910 permissions_, process_->GetData().handle, ipc_proxy_channel_.get(), |
| 931 process_->GetData().handle, | 911 render_process_id_, render_view_id_, profile_directory_)); |
| 932 ipc_proxy_channel_.get(), | |
| 933 nacl_host_message_filter_->render_process_id(), | |
| 934 render_view_id_, | |
| 935 profile_directory_)); | |
| 936 ppapi_host_->SetOnKeepaliveCallback( | 912 ppapi_host_->SetOnKeepaliveCallback( |
| 937 NaClBrowser::GetDelegate()->GetOnKeepaliveCallback()); | 913 NaClBrowser::GetDelegate()->GetOnKeepaliveCallback()); |
| 938 | 914 |
| 939 ppapi::PpapiNaClPluginArgs args; | 915 ppapi::PpapiNaClPluginArgs args; |
| 940 args.off_the_record = nacl_host_message_filter_->off_the_record(); | 916 args.off_the_record = off_the_record_; |
| 941 args.permissions = permissions_; | 917 args.permissions = permissions_; |
| 942 args.keepalive_throttle_interval_milliseconds = | 918 args.keepalive_throttle_interval_milliseconds = |
| 943 keepalive_throttle_interval_milliseconds_; | 919 keepalive_throttle_interval_milliseconds_; |
| 944 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); | 920 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); |
| 945 DCHECK(cmdline); | 921 DCHECK(cmdline); |
| 946 std::string flag_whitelist[] = { | 922 std::string flag_whitelist[] = { |
| 947 switches::kV, | 923 switches::kV, |
| 948 switches::kVModule, | 924 switches::kVModule, |
| 949 }; | 925 }; |
| 950 for (size_t i = 0; i < arraysize(flag_whitelist); ++i) { | 926 for (size_t i = 0; i < arraysize(flag_whitelist); ++i) { |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1165 NaClStartDebugExceptionHandlerThread( | 1141 NaClStartDebugExceptionHandlerThread( |
| 1166 std::move(process), info, base::ThreadTaskRunnerHandle::Get(), | 1142 std::move(process), info, base::ThreadTaskRunnerHandle::Get(), |
| 1167 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, | 1143 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, |
| 1168 weak_factory_.GetWeakPtr())); | 1144 weak_factory_.GetWeakPtr())); |
| 1169 return true; | 1145 return true; |
| 1170 } | 1146 } |
| 1171 } | 1147 } |
| 1172 #endif | 1148 #endif |
| 1173 | 1149 |
| 1174 } // namespace nacl | 1150 } // namespace nacl |
| OLD | NEW |