Commit 10bca423 authored by Ken Rockot's avatar Ken Rockot Committed by Commit Bot

Reland "Move GPU and Plugin processes off Service Manager"

This is a reland of bdc39552

Original change's description:
> Move GPU and Plugin processes off Service Manager
>
> This introduces a new mode for Browser/ChildProcessHost where the
> primordial pipe is a simple content.mojom.ChildProcess pipe. This will
> become the new default mode of operation for child processes, and
> eventually will be the only mode of operation once NaCl processes are
> gone.
>
> GPU and plugin processes are ported to this mode here since both
> require only minimal changes. This means that "content_gpu" and
> "content_plugin" services no longer exist.
>
> Bug: 977637
> Change-Id: I39c5d2284bd84246663d5f0eb4cbab3b3483d798
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1918326
> Reviewed-by: Avi Drissman <avi@chromium.org>
> Reviewed-by: Robert Sesek <rsesek@chromium.org>
> Commit-Queue: Ken Rockot <rockot@google.com>
> Cr-Commit-Position: refs/heads/master@{#717857}

NOPRESUBMIT=true

Bug: 977637
Change-Id: Iaefab7950d7f0437b05417a34ff2b1db73576f0b
Tbr: avi@chromium.org
Tbr: rsesek@chromium.org
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1948907Reviewed-by: default avatarKen Rockot <rockot@google.com>
Commit-Queue: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#721374}
parent c1473603
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "content/public/app/content_browser_manifest.h" #include "content/public/app/content_browser_manifest.h"
#include "content/public/app/content_gpu_manifest.h"
#include "content/public/app/content_plugin_manifest.h"
#include "content/public/app/content_renderer_manifest.h" #include "content/public/app/content_renderer_manifest.h"
#include "content/public/app/content_utility_manifest.h" #include "content/public/app/content_utility_manifest.h"
#include "content/public/browser/content_browser_client.h" #include "content/public/browser/content_browser_client.h"
...@@ -45,8 +43,6 @@ const std::vector<service_manager::Manifest>& GetBuiltinServiceManifests() { ...@@ -45,8 +43,6 @@ const std::vector<service_manager::Manifest>& GetBuiltinServiceManifests() {
// browser process, but the distinction between "in-process" and // browser process, but the distinction between "in-process" and
// "out-of-process" manifests is temporary. For now, this is the right // "out-of-process" manifests is temporary. For now, this is the right
// place for these manifests. // place for these manifests.
GetContentGpuManifest(),
GetContentPluginManifest(),
GetContentRendererManifest(), GetContentRendererManifest(),
GetContentUtilityManifest(), GetContentUtilityManifest(),
......
...@@ -41,6 +41,8 @@ class MockChildProcess : public mojom::ChildProcess { ...@@ -41,6 +41,8 @@ class MockChildProcess : public mojom::ChildProcess {
void(mojo::PendingReceiver< void(mojo::PendingReceiver<
tracing::mojom::BackgroundTracingAgentProvider>)); tracing::mojom::BackgroundTracingAgentProvider>));
MOCK_METHOD0(CrashHungProcess, void()); MOCK_METHOD0(CrashHungProcess, void());
MOCK_METHOD1(BootstrapLegacyIpc,
void(mojo::PendingReceiver<IPC::mojom::ChannelBootstrap>));
MOCK_METHOD2(RunService, MOCK_METHOD2(RunService,
void(const std::string&, void(const std::string&,
mojo::PendingReceiver<service_manager::mojom::Service>)); mojo::PendingReceiver<service_manager::mojom::Service>));
......
...@@ -42,11 +42,9 @@ ...@@ -42,11 +42,9 @@
#include "content/browser/gpu/gpu_main_thread_factory.h" #include "content/browser/gpu/gpu_main_thread_factory.h"
#include "content/browser/gpu/gpu_memory_buffer_manager_singleton.h" #include "content/browser/gpu/gpu_memory_buffer_manager_singleton.h"
#include "content/browser/gpu/shader_cache_factory.h" #include "content/browser/gpu/shader_cache_factory.h"
#include "content/browser/service_manager/service_manager_context.h"
#include "content/common/child_process.mojom.h" #include "content/common/child_process.mojom.h"
#include "content/common/child_process_host_impl.h" #include "content/common/child_process_host_impl.h"
#include "content/common/in_process_child_thread_params.h" #include "content/common/in_process_child_thread_params.h"
#include "content/common/service_manager/child_connection.h"
#include "content/common/view_messages.h" #include "content/common/view_messages.h"
#include "content/public/browser/browser_main_runner.h" #include "content/public/browser/browser_main_runner.h"
#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_task_traits.h"
...@@ -58,8 +56,6 @@ ...@@ -58,8 +56,6 @@
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "content/public/common/result_codes.h" #include "content/public/common/result_codes.h"
#include "content/public/common/sandboxed_process_launcher_delegate.h" #include "content/public/common/sandboxed_process_launcher_delegate.h"
#include "content/public/common/service_manager_connection.h"
#include "content/public/common/service_names.mojom.h"
#include "gpu/command_buffer/service/gpu_switches.h" #include "gpu/command_buffer/service/gpu_switches.h"
#include "gpu/config/gpu_driver_bug_list.h" #include "gpu/config/gpu_driver_bug_list.h"
#include "gpu/config/gpu_driver_bug_workaround_type.h" #include "gpu/config/gpu_driver_bug_workaround_type.h"
...@@ -650,8 +646,8 @@ GpuProcessHost::GpuProcessHost(int host_id, GpuProcessKind kind) ...@@ -650,8 +646,8 @@ GpuProcessHost::GpuProcessHost(int host_id, GpuProcessKind kind)
g_gpu_process_hosts[kind] = this; g_gpu_process_hosts[kind] = this;
process_.reset(new BrowserChildProcessHostImpl(PROCESS_TYPE_GPU, this, process_.reset(new BrowserChildProcessHostImpl(
mojom::kGpuServiceName)); PROCESS_TYPE_GPU, this, ChildProcessHost::IpcMode::kNormal));
} }
GpuProcessHost::~GpuProcessHost() { GpuProcessHost::~GpuProcessHost() {
...@@ -789,10 +785,8 @@ bool GpuProcessHost::Init() { ...@@ -789,10 +785,8 @@ bool GpuProcessHost::Init() {
GpuDataManagerImpl::GetInstance()->UpdateGpuPreferences( GpuDataManagerImpl::GetInstance()->UpdateGpuPreferences(
&gpu_preferences, GPU_PROCESS_KIND_SANDBOXED); &gpu_preferences, GPU_PROCESS_KIND_SANDBOXED);
in_process_gpu_thread_.reset(GetGpuMainThreadFactory()( in_process_gpu_thread_.reset(GetGpuMainThreadFactory()(
InProcessChildThreadParams( InProcessChildThreadParams(base::ThreadTaskRunnerHandle::Get(),
base::ThreadTaskRunnerHandle::Get(), process_->GetInProcessMojoInvitation()),
process_->GetInProcessMojoInvitation(),
process_->child_connection()->service_token()),
gpu_preferences)); gpu_preferences));
base::Thread::Options options; base::Thread::Options options;
#if defined(OS_WIN) || defined(OS_MACOSX) #if defined(OS_WIN) || defined(OS_MACOSX)
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include "content/public/common/pepper_plugin_info.h" #include "content/public/common/pepper_plugin_info.h"
#include "content/public/common/process_type.h" #include "content/public/common/process_type.h"
#include "content/public/common/sandboxed_process_launcher_delegate.h" #include "content/public/common/sandboxed_process_launcher_delegate.h"
#include "content/public/common/service_names.mojom.h"
#include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/shared_impl/ppapi_permissions.h" #include "ppapi/shared_impl/ppapi_permissions.h"
#include "services/network/public/cpp/network_connection_tracker.h" #include "services/network/public/cpp/network_connection_tracker.h"
...@@ -322,7 +321,7 @@ PpapiPluginProcessHost::PpapiPluginProcessHost( ...@@ -322,7 +321,7 @@ PpapiPluginProcessHost::PpapiPluginProcessHost(
permissions_ = ppapi::PpapiPermissions::GetForCommandLine(base_permissions); permissions_ = ppapi::PpapiPermissions::GetForCommandLine(base_permissions);
process_ = std::make_unique<BrowserChildProcessHostImpl>( process_ = std::make_unique<BrowserChildProcessHostImpl>(
PROCESS_TYPE_PPAPI_PLUGIN, this, mojom::kPluginServiceName); PROCESS_TYPE_PPAPI_PLUGIN, this, ChildProcessHost::IpcMode::kNormal);
host_impl_ = std::make_unique<BrowserPpapiHostImpl>( host_impl_ = std::make_unique<BrowserPpapiHostImpl>(
this, permissions_, info.name, info.path, profile_data_directory, this, permissions_, info.name, info.path, profile_data_directory,
...@@ -341,7 +340,7 @@ PpapiPluginProcessHost::PpapiPluginProcessHost( ...@@ -341,7 +340,7 @@ PpapiPluginProcessHost::PpapiPluginProcessHost(
PpapiPluginProcessHost::PpapiPluginProcessHost() : is_broker_(true) { PpapiPluginProcessHost::PpapiPluginProcessHost() : is_broker_(true) {
process_ = std::make_unique<BrowserChildProcessHostImpl>( process_ = std::make_unique<BrowserChildProcessHostImpl>(
PROCESS_TYPE_PPAPI_BROKER, this, mojom::kPluginServiceName); PROCESS_TYPE_PPAPI_BROKER, this, ChildProcessHost::IpcMode::kNormal);
ppapi::PpapiPermissions permissions; // No permissions. ppapi::PpapiPermissions permissions; // No permissions.
// The plugin name, path and profile data directory shouldn't be needed for // The plugin name, path and profile data directory shouldn't be needed for
......
...@@ -287,11 +287,20 @@ class ChildThreadImpl::IOThreadState ...@@ -287,11 +287,20 @@ class ChildThreadImpl::IOThreadState
wait_for_interface_binders_(wait_for_interface_binders), wait_for_interface_binders_(wait_for_interface_binders),
host_receiver_(std::move(host_receiver)) {} host_receiver_(std::move(host_receiver)) {}
// Used only in the deprecated Service Manager IPC mode.
void BindChildProcessReceiver( void BindChildProcessReceiver(
mojo::PendingReceiver<mojom::ChildProcess> receiver) { mojo::PendingReceiver<mojom::ChildProcess> receiver) {
receiver_.Bind(std::move(receiver)); receiver_.Bind(std::move(receiver));
} }
// Used in non-Service Manager IPC mode.
void BindChildProcessReceiverAndLegacyIpc(
mojo::PendingReceiver<mojom::ChildProcess> receiver,
mojo::PendingRemote<IPC::mojom::ChannelBootstrap> legacy_ipc_bootstrap) {
legacy_ipc_bootstrap_ = std::move(legacy_ipc_bootstrap);
receiver_.Bind(std::move(receiver));
}
void ExposeInterfacesToBrowser(mojo::BinderMap binders) { void ExposeInterfacesToBrowser(mojo::BinderMap binders) {
DCHECK(wait_for_interface_binders_); DCHECK(wait_for_interface_binders_);
wait_for_interface_binders_ = false; wait_for_interface_binders_ = false;
...@@ -359,6 +368,12 @@ class ChildThreadImpl::IOThreadState ...@@ -359,6 +368,12 @@ class ChildThreadImpl::IOThreadState
IMMEDIATE_CRASH(); IMMEDIATE_CRASH();
} }
void BootstrapLegacyIpc(
mojo::PendingReceiver<IPC::mojom::ChannelBootstrap> receiver) override {
DCHECK(legacy_ipc_bootstrap_);
mojo::FusePipes(std::move(receiver), std::move(legacy_ipc_bootstrap_));
}
void RunService(const std::string& service_name, void RunService(const std::string& service_name,
mojo::PendingReceiver<service_manager::mojom::Service> mojo::PendingReceiver<service_manager::mojom::Service>
receiver) override { receiver) override {
...@@ -420,6 +435,11 @@ class ChildThreadImpl::IOThreadState ...@@ -420,6 +435,11 @@ class ChildThreadImpl::IOThreadState
mojo::Receiver<mojom::ChildProcess> receiver_{this}; mojo::Receiver<mojom::ChildProcess> receiver_{this};
mojo::PendingReceiver<mojom::ChildProcessHost> host_receiver_; mojo::PendingReceiver<mojom::ChildProcessHost> host_receiver_;
// The pending legacy IPC channel endpoint to fuse with one we will eventually
// receiver on the ChildProcess interface. Only used when not in the
// deprecated Service Manager IPC mode.
mojo::PendingRemote<IPC::mojom::ChannelBootstrap> legacy_ipc_bootstrap_;
// Binding requests which should be handled by |interface_binders|, but which // Binding requests which should be handled by |interface_binders|, but which
// have been queued because |allow_interface_binders_| is still |false|. // have been queued because |allow_interface_binders_| is still |false|.
std::vector<mojo::GenericPendingReceiver> pending_binding_requests_; std::vector<mojo::GenericPendingReceiver> pending_binding_requests_;
...@@ -552,7 +572,7 @@ void ChildThreadImpl::OnFieldTrialGroupFinalized( ...@@ -552,7 +572,7 @@ void ChildThreadImpl::OnFieldTrialGroupFinalized(
field_trial_recorder->FieldTrialActivated(trial_name); field_trial_recorder->FieldTrialActivated(trial_name);
} }
void ChildThreadImpl::ConnectChannel() { void ChildThreadImpl::ConnectLegacyIpcChannelThroughServiceManager() {
DCHECK(service_manager_connection_); DCHECK(service_manager_connection_);
mojo::PendingRemote<IPC::mojom::ChannelBootstrap> bootstrap; mojo::PendingRemote<IPC::mojom::ChannelBootstrap> bootstrap;
mojo::ScopedMessagePipeHandle handle = mojo::ScopedMessagePipeHandle handle =
...@@ -589,6 +609,10 @@ void ChildThreadImpl::Init(const Options& options) { ...@@ -589,6 +609,10 @@ void ChildThreadImpl::Init(const Options& options) {
IPC::Logging::GetInstance()->SetIPCSender(this); IPC::Logging::GetInstance()->SetIPCSender(this);
#endif #endif
// Only one of these will be made valid by the block below. This determines
// whether we were launched in normal IPC mode or deprecated Service Manager
// IPC mode.
mojo::ScopedMessagePipeHandle child_process_pipe;
mojo::ScopedMessagePipeHandle service_request_pipe; mojo::ScopedMessagePipeHandle service_request_pipe;
if (!IsInBrowserProcess()) { if (!IsInBrowserProcess()) {
mojo_ipc_support_.reset(new mojo::core::ScopedIPCSupport( mojo_ipc_support_.reset(new mojo::core::ScopedIPCSupport(
...@@ -601,13 +625,21 @@ void ChildThreadImpl::Init(const Options& options) { ...@@ -601,13 +625,21 @@ void ChildThreadImpl::Init(const Options& options) {
if (!service_request_token.empty()) { if (!service_request_token.empty()) {
service_request_pipe = service_request_pipe =
invitation.ExtractMessagePipe(service_request_token); invitation.ExtractMessagePipe(service_request_token);
} else {
child_process_pipe = invitation.ExtractMessagePipe(0);
} }
} else { } else {
service_request_pipe = options.mojo_invitation->ExtractMessagePipe( if (!options.in_process_service_request_token.empty()) {
options.in_process_service_request_token); service_request_pipe = options.mojo_invitation->ExtractMessagePipe(
options.in_process_service_request_token);
} else {
child_process_pipe = options.mojo_invitation->ExtractMessagePipe(0);
}
} }
if (service_request_pipe.is_valid()) { if (service_request_pipe.is_valid()) {
// We're in deprecated legacy IPC mode. Initialize a connection to the
// Service Manager.
service_manager_connection_ = ServiceManagerConnection::Create( service_manager_connection_ = ServiceManagerConnection::Create(
service_manager::mojom::ServiceRequest(std::move(service_request_pipe)), service_manager::mojom::ServiceRequest(std::move(service_request_pipe)),
GetIOTaskRunner()); GetIOTaskRunner());
...@@ -617,14 +649,6 @@ void ChildThreadImpl::Init(const Options& options) { ...@@ -617,14 +649,6 @@ void ChildThreadImpl::Init(const Options& options) {
thread_safe_sender_ = thread_safe_sender_ =
new ThreadSafeSender(main_thread_runner_, sync_message_filter_.get()); new ThreadSafeSender(main_thread_runner_, sync_message_filter_.get());
auto registry = std::make_unique<service_manager::BinderRegistry>();
registry->AddInterface(
base::BindRepeating(&IOThreadState::BindChildProcessReceiver,
io_thread_state_),
ChildThreadImpl::GetIOTaskRunner());
service_manager_connection_->AddConnectionFilter(
std::make_unique<SimpleConnectionFilter>(std::move(registry)));
// In single process mode, browser-side tracing and memory will cover the // In single process mode, browser-side tracing and memory will cover the
// whole process including renderers. // whole process including renderers.
if (!IsInBrowserProcess()) { if (!IsInBrowserProcess()) {
...@@ -667,12 +691,40 @@ void ChildThreadImpl::Init(const Options& options) { ...@@ -667,12 +691,40 @@ void ChildThreadImpl::Init(const Options& options) {
channel_->AddFilter(startup_filter); channel_->AddFilter(startup_filter);
} }
ConnectChannel(); if (service_manager_connection_) {
auto registry = std::make_unique<service_manager::BinderRegistry>();
registry->AddInterface(
base::BindRepeating(&IOThreadState::BindChildProcessReceiver,
io_thread_state_),
ChildThreadImpl::GetIOTaskRunner());
service_manager_connection_->AddConnectionFilter(
std::make_unique<SimpleConnectionFilter>(std::move(registry)));
// This must always be done after ConnectChannel, because ConnectChannel() may ConnectLegacyIpcChannelThroughServiceManager();
// add a ConnectionFilter to the connection.
if (service_manager_connection_)
StartServiceManagerConnection(); StartServiceManagerConnection();
} else {
// We're in normal IPC mode. Set up the ChildProcess receiver and legacy IPC
// Channel.
DCHECK(child_process_pipe.is_valid());
mojo::PendingRemote<IPC::mojom::ChannelBootstrap> legacy_ipc_bootstrap;
mojo::ScopedMessagePipeHandle legacy_ipc_channel_handle =
legacy_ipc_bootstrap.InitWithNewPipeAndPassReceiver().PassPipe();
channel_->Init(IPC::ChannelMojo::CreateClientFactory(
std::move(legacy_ipc_channel_handle),
ChildProcess::current()->io_task_runner(),
ipc_task_runner_ ? ipc_task_runner_
: base::ThreadTaskRunnerHandle::Get()),
/*create_pipe_now=*/true);
ChildThreadImpl::GetIOTaskRunner()->PostTask(
FROM_HERE,
base::BindOnce(&IOThreadState::BindChildProcessReceiverAndLegacyIpc,
io_thread_state_,
mojo::PendingReceiver<mojom::ChildProcess>(
std::move(child_process_pipe)),
std::move(legacy_ipc_bootstrap)));
}
int connection_timeout = kConnectionTimeoutS; int connection_timeout = kConnectionTimeoutS;
std::string connection_override = std::string connection_override =
......
...@@ -200,7 +200,7 @@ class CONTENT_EXPORT ChildThreadImpl ...@@ -200,7 +200,7 @@ class CONTENT_EXPORT ChildThreadImpl
// We create the channel first without connecting it so we can add filters // We create the channel first without connecting it so we can add filters
// prior to any messages being received, then connect it afterwards. // prior to any messages being received, then connect it afterwards.
void ConnectChannel(); void ConnectLegacyIpcChannelThroughServiceManager();
// IPC message handlers. // IPC message handlers.
......
...@@ -501,6 +501,7 @@ mojom("mojo_bindings") { ...@@ -501,6 +501,7 @@ mojom("mojo_bindings") {
"//components/tracing/common:interfaces", "//components/tracing/common:interfaces",
"//content/public/common:interfaces", "//content/public/common:interfaces",
"//content/public/common:resource_type_bindings", "//content/public/common:resource_type_bindings",
"//ipc:mojom",
"//ipc:mojom_constants", "//ipc:mojom_constants",
"//media/capture/mojom:video_capture", "//media/capture/mojom:video_capture",
"//media/mojo/mojom", "//media/mojo/mojom",
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
module content.mojom; module content.mojom;
import "components/tracing/common/background_tracing_agent.mojom"; import "components/tracing/common/background_tracing_agent.mojom";
import "ipc/ipc.mojom";
import "mojo/public/mojom/base/file.mojom"; import "mojo/public/mojom/base/file.mojom";
import "mojo/public/mojom/base/generic_pending_receiver.mojom"; import "mojo/public/mojom/base/generic_pending_receiver.mojom";
import "services/service_manager/public/mojom/service.mojom"; import "services/service_manager/public/mojom/service.mojom";
...@@ -61,6 +62,9 @@ interface ChildProcess { ...@@ -61,6 +62,9 @@ interface ChildProcess {
// cleanup, generating a crash report). // cleanup, generating a crash report).
CrashHungProcess(); CrashHungProcess();
// Binds the legacy IPC Channel bootstrapping pipe.
BootstrapLegacyIpc(pending_receiver<IPC.mojom.ChannelBootstrap> receiver);
// Tells the child process to run an instance of a service named // Tells the child process to run an instance of a service named
// |service_name|, binding it to |receiver|. This is used by the browser to // |service_name|, binding it to |receiver|. This is used by the browser to
// support launching of packaged services within Utility or GPU processes. // support launching of packaged services within Utility or GPU processes.
......
...@@ -123,6 +123,10 @@ ChildProcessHostImpl::ChildProcessHostImpl(ChildProcessHostDelegate* delegate, ...@@ -123,6 +123,10 @@ ChildProcessHostImpl::ChildProcessHostImpl(ChildProcessHostDelegate* delegate,
base::ThreadTaskRunnerHandle::Get(), base::ThreadTaskRunnerHandle::Get(),
base::ThreadTaskRunnerHandle::Get(), base::ThreadTaskRunnerHandle::Get(),
mojo::internal::MessageQuotaChecker::MaybeCreate()); mojo::internal::MessageQuotaChecker::MaybeCreate());
} else if (ipc_mode_ == IpcMode::kNormal) {
child_process_.Bind(mojo::PendingRemote<mojom::ChildProcess>(
mojo_invitation_->AttachMessagePipe(0), /*version=*/0));
child_process_->Initialize(bootstrap_receiver_.BindNewPipeAndPassRemote());
} }
} }
...@@ -176,10 +180,21 @@ void ChildProcessHostImpl::CreateChannelMojo() { ...@@ -176,10 +180,21 @@ void ChildProcessHostImpl::CreateChannelMojo() {
// not bound through the Service Manager. // not bound through the Service Manager.
if (ipc_mode_ != IpcMode::kLegacy) { if (ipc_mode_ != IpcMode::kLegacy) {
DCHECK(!channel_); DCHECK(!channel_);
mojo::MessagePipe pipe;
BindInterface(IPC::mojom::ChannelBootstrap::Name_, std::move(pipe.handle1)); mojo::PendingRemote<IPC::mojom::ChannelBootstrap> bootstrap;
auto bootstrap_receiver = bootstrap.InitWithNewPipeAndPassReceiver();
if (ipc_mode_ == IpcMode::kServiceManager) {
BindInterface(IPC::mojom::ChannelBootstrap::Name_,
bootstrap_receiver.PassPipe());
} else {
DCHECK_EQ(ipc_mode_, IpcMode::kNormal);
DCHECK(child_process_);
child_process_->BootstrapLegacyIpc(std::move(bootstrap_receiver));
}
channel_ = IPC::ChannelMojo::Create( channel_ = IPC::ChannelMojo::Create(
std::move(pipe.handle0), IPC::Channel::MODE_SERVER, this, bootstrap.PassPipe(), IPC::Channel::MODE_SERVER, this,
base::ThreadTaskRunnerHandle::Get(), base::ThreadTaskRunnerHandle::Get(),
base::ThreadTaskRunnerHandle::Get(), base::ThreadTaskRunnerHandle::Get(),
mojo::internal::MessageQuotaChecker::MaybeCreate()); mojo::internal::MessageQuotaChecker::MaybeCreate());
...@@ -200,8 +215,10 @@ bool ChildProcessHostImpl::InitChannel() { ...@@ -200,8 +215,10 @@ bool ChildProcessHostImpl::InitChannel() {
delegate_->OnChannelInitialized(channel_.get()); delegate_->OnChannelInitialized(channel_.get());
// In legacy mode, |child_process_| endpoint is already bound to a // In legacy mode, |child_process_| endpoint is already bound to a
// disconnected pipe and will remain dysfunctional. // disconnected pipe and will remain dysfunctional. In normal mode, it's bound
// in the constructor.
if (!child_process_) { if (!child_process_) {
DCHECK_EQ(ipc_mode_, IpcMode::kServiceManager);
// We want to bind this interface as early as possible, but the constructor // We want to bind this interface as early as possible, but the constructor
// is too early. |delegate_| may not be fully initialized at that point and // is too early. |delegate_| may not be fully initialized at that point and
// thus may be unable to properly fulfill the BindInterface() call. Instead // thus may be unable to properly fulfill the BindInterface() call. Instead
......
...@@ -22,7 +22,7 @@ class CONTENT_EXPORT InProcessChildThreadParams { ...@@ -22,7 +22,7 @@ class CONTENT_EXPORT InProcessChildThreadParams {
InProcessChildThreadParams( InProcessChildThreadParams(
scoped_refptr<base::SingleThreadTaskRunner> io_runner, scoped_refptr<base::SingleThreadTaskRunner> io_runner,
mojo::OutgoingInvitation* mojo_invitation, mojo::OutgoingInvitation* mojo_invitation,
const std::string& service_request_token); const std::string& service_request_token = {});
InProcessChildThreadParams(const InProcessChildThreadParams& other); InProcessChildThreadParams(const InProcessChildThreadParams& other);
~InProcessChildThreadParams(); ~InProcessChildThreadParams();
......
...@@ -193,38 +193,6 @@ source_set("content_browser_manifest") { ...@@ -193,38 +193,6 @@ source_set("content_browser_manifest") {
] ]
} }
source_set("content_gpu_manifest") {
sources = [
"content_gpu_manifest.cc",
"content_gpu_manifest.h",
]
deps = [
"//base",
"//content/public/common:service_names",
]
public_deps = [
"//services/service_manager/public/cpp",
]
}
source_set("content_plugin_manifest") {
sources = [
"content_plugin_manifest.cc",
"content_plugin_manifest.h",
]
deps = [
"//base",
"//content/public/common:service_names",
]
public_deps = [
"//services/service_manager/public/cpp",
]
}
source_set("content_renderer_manifest") { source_set("content_renderer_manifest") {
sources = [ sources = [
"content_renderer_manifest.cc", "content_renderer_manifest.cc",
...@@ -280,8 +248,6 @@ source_set("v8_snapshot_overlay_manifest") { ...@@ -280,8 +248,6 @@ source_set("v8_snapshot_overlay_manifest") {
group("service_manifests") { group("service_manifests") {
public_deps = [ public_deps = [
":content_browser_manifest", ":content_browser_manifest",
":content_gpu_manifest",
":content_plugin_manifest",
":content_renderer_manifest", ":content_renderer_manifest",
":content_utility_manifest", ":content_utility_manifest",
] ]
......
...@@ -6,16 +6,6 @@ per-file content_browser_manifest.cc=file://ipc/SECURITY_OWNERS ...@@ -6,16 +6,6 @@ per-file content_browser_manifest.cc=file://ipc/SECURITY_OWNERS
per-file content_browser_manifest.h=set noparent per-file content_browser_manifest.h=set noparent
per-file content_browser_manifest.h=file://ipc/SECURITY_OWNERS per-file content_browser_manifest.h=file://ipc/SECURITY_OWNERS
per-file content_gpu_manifest.cc=set noparent
per-file content_gpu_manifest.cc=file://ipc/SECURITY_OWNERS
per-file content_gpu_manifest.h=set noparent
per-file content_gpu_manifest.h=file://ipc/SECURITY_OWNERS
per-file content_plugin_manifest.cc=set noparent
per-file content_plugin_manifest.cc=file://ipc/SECURITY_OWNERS
per-file content_plugin_manifest.h=set noparent
per-file content_plugin_manifest.h=file://ipc/SECURITY_OWNERS
per-file content_renderer_manifest.cc=set noparent per-file content_renderer_manifest.cc=set noparent
per-file content_renderer_manifest.cc=file://ipc/SECURITY_OWNERS per-file content_renderer_manifest.cc=file://ipc/SECURITY_OWNERS
per-file content_renderer_manifest.h=set noparent per-file content_renderer_manifest.h=set noparent
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/public/app/content_gpu_manifest.h"
#include "base/no_destructor.h"
#include "content/public/common/service_names.mojom.h"
#include "services/service_manager/public/cpp/manifest_builder.h"
namespace content {
const service_manager::Manifest& GetContentGpuManifest() {
static base::NoDestructor<service_manager::Manifest> manifest{
service_manager::ManifestBuilder()
.WithServiceName(mojom::kGpuServiceName)
.WithDisplayName("Content (GPU process)")
.ExposeCapability("browser",
std::set<const char*>{
"content.mojom.Child",
"content.mojom.ChildHistogramFetcher",
"content.mojom.ChildHistogramFetcherFactory",
"content.mojom.ChildProcess",
"content.mojom.ResourceUsageReporter",
"IPC.mojom.ChannelBootstrap",
"ui.ozone.mojom.DeviceCursor",
"ui.ozone.mojom.DrmDevice",
"ui.ozone.mojom.WaylandBufferManagerGpu",
"ui.mojom.ScenicGpuService",
"viz.mojom.CompositingModeReporter",
"viz.mojom.VizMain",
})
.RequireCapability("device", "device:power_monitor")
.RequireCapability(mojom::kSystemServiceName, "dwrite_font_proxy")
.RequireCapability(mojom::kSystemServiceName, "field_trials")
.RequireCapability(mojom::kSystemServiceName, "gpu")
.RequireCapability("ui", "discardable_memory")
.RequireCapability("*", "app")
.RequireCapability("metrics", "url_keyed_metrics")
.Build()};
return *manifest;
}
} // namespace content
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_PUBLIC_APP_CONTENT_GPU_MANIFEST_H_
#define CONTENT_PUBLIC_APP_CONTENT_GPU_MANIFEST_H_
#include "services/service_manager/public/cpp/manifest.h"
namespace content {
// Returns the service manifest for the "content_gpu" service. Every GPU process
// is an instance of this service, so this manifest determines what capabilities
// are directly exposed and required by GPU processes through the Service
// Manager.
const service_manager::Manifest& GetContentGpuManifest();
} // namespace content
#endif // CONTENT_PUBLIC_APP_CONTENT_GPU_MANIFEST_H_
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/public/app/content_plugin_manifest.h"
#include "base/no_destructor.h"
#include "content/public/common/service_names.mojom.h"
#include "services/service_manager/public/cpp/manifest_builder.h"
namespace content {
const service_manager::Manifest& GetContentPluginManifest() {
static base::NoDestructor<service_manager::Manifest> manifest{
service_manager::ManifestBuilder()
.WithServiceName(mojom::kPluginServiceName)
.WithDisplayName("Content (plugin process)")
.ExposeCapability("browser",
std::set<const char*>{
"content.mojom.Child",
"content.mojom.ChildHistogramFetcher",
"content.mojom.ChildHistogramFetcherFactory",
"content.mojom.ChildProcess",
"content.mojom.ResourceUsageReporter",
"IPC.mojom.ChannelBootstrap",
})
.RequireCapability("device", "device:power_monitor")
.RequireCapability(mojom::kSystemServiceName, "dwrite_font_proxy")
.RequireCapability(mojom::kSystemServiceName, "field_trials")
.RequireCapability(mojom::kSystemServiceName, "font_cache")
.RequireCapability(mojom::kSystemServiceName, "plugin")
.RequireCapability(mojom::kSystemServiceName, "sandbox_support")
.RequireCapability("ui", "discardable_memory")
.RequireCapability("*", "app")
.RequireCapability("font_service", "font_service")
.Build()};
return *manifest;
}
} // namespace content
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_PUBLIC_APP_CONTENT_PLUGIN_MANIFEST_H_
#define CONTENT_PUBLIC_APP_CONTENT_PLUGIN_MANIFEST_H_
#include "services/service_manager/public/cpp/manifest.h"
namespace content {
// Returns the service manifest for the "content_plugin" service. Every
// plugin process is an instance of this service, so this manifest determines
// what capabilities are directly exposed and required by plugin processes
// through the Service Manager.
const service_manager::Manifest& GetContentPluginManifest();
} // namespace content
#endif // CONTENT_PUBLIC_APP_CONTENT_PLUGIN_MANIFEST_H_
...@@ -54,11 +54,18 @@ class CONTENT_EXPORT ChildProcessHost : public IPC::Sender { ...@@ -54,11 +54,18 @@ class CONTENT_EXPORT ChildProcessHost : public IPC::Sender {
// This enum (given to |Create()|) determines how the ChildProcessHost uses // This enum (given to |Create()|) determines how the ChildProcessHost uses
// the pipe. // the pipe.
enum class IpcMode { enum class IpcMode {
// In this mode, the primordial pipe is a content.mojom.ChildProcess pipe.
// The ChildProcessHost is fully functional in this mode, and all new
// process hosts should prefer to use this mode.
kNormal,
// In this mode, the primordial pipe is a service_manager.mojom.Service // In this mode, the primordial pipe is a service_manager.mojom.Service
// pipe, and the owner of the ChildProcessHost is expected to pass the // pipe, and the owner of the ChildProcessHost is expected to pass the
// Mojo invitation along to a content::ChildProcessConnection. // Mojo invitation along to a content::ChildProcessConnection.
// //
// In this mode, the ChildProcessHost is fully functional. // In this mode, the ChildProcessHost is fully functional.
//
// DEPRECATED: Do not introduce new uses of this mode.
kServiceManager, kServiceManager,
// In this mode, the primordial pipe is a legacy IPC Channel bootstrapping // In this mode, the primordial pipe is a legacy IPC Channel bootstrapping
......
...@@ -15,18 +15,10 @@ const string kSystemServiceName = "content_system"; ...@@ -15,18 +15,10 @@ const string kSystemServiceName = "content_system";
// for that BrowserContext. // for that BrowserContext.
const string kBrowserServiceName = "content_browser"; const string kBrowserServiceName = "content_browser";
// The default service name used to identify the gpu process when connecting it
// to the Service Manager.
const string kGpuServiceName = "content_gpu";
// The service name used to identify the browser process's singleton service // The service name used to identify the browser process's singleton service
// instance which packages other browser-wide services. // instance which packages other browser-wide services.
const string kPackagedServicesServiceName = "content_packaged_services"; const string kPackagedServicesServiceName = "content_packaged_services";
// The default service name used to identify plugin processes when connecting
// them to the Service Manager.
const string kPluginServiceName = "content_plugin";
// The default service name used to identify render processes when connecting // The default service name used to identify render processes when connecting
// them to the Service Manager. // them to the Service Manager.
const string kRendererServiceName = "content_renderer"; const string kRendererServiceName = "content_renderer";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment