OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
7 | 7 |
8 #include "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 // proxy. It is currently done this way due to concerns about race | 669 // proxy. It is currently done this way due to concerns about race |
670 // conditions. | 670 // conditions. |
671 ZygoteHostImpl::GetInstance()->SetRendererSandboxStatus( | 671 ZygoteHostImpl::GetInstance()->SetRendererSandboxStatus( |
672 (*GetGenericZygote())->GetSandboxStatus()); | 672 (*GetGenericZygote())->GetSandboxStatus()); |
673 } | 673 } |
674 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) | 674 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) |
675 | 675 |
676 RenderProcessHostImpl::RenderProcessHostImpl( | 676 RenderProcessHostImpl::RenderProcessHostImpl( |
677 BrowserContext* browser_context, | 677 BrowserContext* browser_context, |
678 StoragePartitionImpl* storage_partition_impl, | 678 StoragePartitionImpl* storage_partition_impl, |
679 bool is_for_guests_only) | 679 bool is_for_guests_only, |
| 680 int child_process_param_id) |
680 : fast_shutdown_started_(false), | 681 : fast_shutdown_started_(false), |
681 deleting_soon_(false), | 682 deleting_soon_(false), |
682 #ifndef NDEBUG | 683 #ifndef NDEBUG |
683 is_self_deleted_(false), | 684 is_self_deleted_(false), |
684 #endif | 685 #endif |
685 pending_views_(0), | 686 pending_views_(0), |
686 service_worker_ref_count_(0), | 687 service_worker_ref_count_(0), |
687 shared_worker_ref_count_(0), | 688 shared_worker_ref_count_(0), |
688 is_worker_ref_count_disabled_(false), | 689 is_worker_ref_count_disabled_(false), |
689 route_provider_binding_(this), | 690 route_provider_binding_(this), |
690 visible_widgets_(0), | 691 visible_widgets_(0), |
691 is_process_backgrounded_(false), | 692 is_process_backgrounded_(false), |
692 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), | 693 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), |
| 694 child_process_param_id_(child_process_param_id), |
693 browser_context_(browser_context), | 695 browser_context_(browser_context), |
694 storage_partition_impl_(storage_partition_impl), | 696 storage_partition_impl_(storage_partition_impl), |
695 sudden_termination_allowed_(true), | 697 sudden_termination_allowed_(true), |
696 ignore_input_events_(false), | 698 ignore_input_events_(false), |
697 is_for_guests_only_(is_for_guests_only), | 699 is_for_guests_only_(is_for_guests_only), |
698 gpu_observer_registered_(false), | 700 gpu_observer_registered_(false), |
699 delayed_cleanup_needed_(false), | 701 delayed_cleanup_needed_(false), |
700 within_process_died_observer_(false), | 702 within_process_died_observer_(false), |
701 #if BUILDFLAG(ENABLE_WEBRTC) | 703 #if BUILDFLAG(ENABLE_WEBRTC) |
702 webrtc_eventlog_host_(id_), | 704 webrtc_eventlog_host_(id_), |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 // first so the process type argument will appear first. | 913 // first so the process type argument will appear first. |
912 std::unique_ptr<base::CommandLine> cmd_line = | 914 std::unique_ptr<base::CommandLine> cmd_line = |
913 base::MakeUnique<base::CommandLine>(renderer_path); | 915 base::MakeUnique<base::CommandLine>(renderer_path); |
914 if (!renderer_prefix.empty()) | 916 if (!renderer_prefix.empty()) |
915 cmd_line->PrependWrapper(renderer_prefix); | 917 cmd_line->PrependWrapper(renderer_prefix); |
916 AppendRendererCommandLine(cmd_line.get()); | 918 AppendRendererCommandLine(cmd_line.get()); |
917 | 919 |
918 // Spawn the child process asynchronously to avoid blocking the UI thread. | 920 // Spawn the child process asynchronously to avoid blocking the UI thread. |
919 // As long as there's no renderer prefix, we can use the zygote process | 921 // As long as there's no renderer prefix, we can use the zygote process |
920 // at this stage. | 922 // at this stage. |
| 923 constexpr bool terminate_on_shutdown = true; |
921 child_process_launcher_.reset(new ChildProcessLauncher( | 924 child_process_launcher_.reset(new ChildProcessLauncher( |
922 base::MakeUnique<RendererSandboxedProcessLauncherDelegate>(), | 925 base::MakeUnique<RendererSandboxedProcessLauncherDelegate>(), |
923 std::move(cmd_line), GetID(), this, std::move(pending_connection_), | 926 std::move(cmd_line), GetID(), this, std::move(pending_connection_), |
924 base::Bind(&RenderProcessHostImpl::OnMojoError, id_))); | 927 base::Bind(&RenderProcessHostImpl::OnMojoError, id_), |
| 928 terminate_on_shutdown, child_process_param_id_)); |
925 channel_->Pause(); | 929 channel_->Pause(); |
926 | 930 |
927 fast_shutdown_started_ = false; | 931 fast_shutdown_started_ = false; |
928 } | 932 } |
929 | 933 |
930 if (!gpu_observer_registered_) { | 934 if (!gpu_observer_registered_) { |
931 gpu_observer_registered_ = true; | 935 gpu_observer_registered_ = true; |
932 ui::GpuSwitchingManager::GetInstance()->AddObserver(this); | 936 ui::GpuSwitchingManager::GetInstance()->AddObserver(this); |
933 } | 937 } |
934 | 938 |
(...skipping 2136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3071 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 3075 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
3072 | 3076 |
3073 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. | 3077 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. |
3074 // Capture the error message in a crash key value. | 3078 // Capture the error message in a crash key value. |
3075 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); | 3079 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); |
3076 bad_message::ReceivedBadMessage(render_process_id, | 3080 bad_message::ReceivedBadMessage(render_process_id, |
3077 bad_message::RPH_MOJO_PROCESS_ERROR); | 3081 bad_message::RPH_MOJO_PROCESS_ERROR); |
3078 } | 3082 } |
3079 | 3083 |
3080 } // namespace content | 3084 } // namespace content |
OLD | NEW |