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

Unified Diff: content/common/child_process_host_impl.cc

Issue 1801123004: Move attachment broker setup to browser startup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-mach-ports
Patch Set: Maybe fix tests. Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/child_process_host_impl.cc
diff --git a/content/common/child_process_host_impl.cc b/content/common/child_process_host_impl.cc
index d69d5352a285f8a16065536a3f3708fc23f494e9..9654d1bcda54d1943a9e4f2feda32c7b165e4423 100644
--- a/content/common/child_process_host_impl.cc
+++ b/content/common/child_process_host_impl.cc
@@ -86,19 +86,6 @@ ChildProcessHostImpl::ChildProcessHostImpl(ChildProcessHostDelegate* delegate)
#if defined(OS_WIN)
AddFilter(new FontCacheDispatcher());
#endif
-
-#if USE_ATTACHMENT_BROKER
-#if defined(OS_MACOSX) && !defined(OS_IOS)
- // On Mac, the privileged AttachmentBroker needs a reference to the Mach port
- // Provider, which is only available in the chrome/ module. The attachment
- // broker must already be created.
- DCHECK(IPC::AttachmentBroker::GetGlobal());
-#else
- // Construct the privileged attachment broker early in the life cycle of a
- // child process.
- IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded();
-#endif // defined(OS_MACOSX) && !defined(OS_IOS)
-#endif // USE_ATTACHMENT_BROKER
}
ChildProcessHostImpl::~ChildProcessHostImpl() {
@@ -109,8 +96,11 @@ ChildProcessHostImpl::~ChildProcessHostImpl() {
return;
#if USE_ATTACHMENT_BROKER
- IPC::AttachmentBroker::GetGlobal()->DeregisterCommunicationChannel(
- channel_.get());
+ // In unit tests, the attachment broker may not have been initialized.
+ if (IPC::AttachmentBroker::GetGlobal()) {
+ IPC::AttachmentBroker::GetGlobal()->DeregisterCommunicationChannel(
+ channel_.get());
+ }
#endif
for (size_t i = 0; i < filters_.size(); ++i) {
filters_[i]->OnChannelClosing();
@@ -135,8 +125,11 @@ std::string ChildProcessHostImpl::CreateChannel() {
if (!channel_->Connect())
return std::string();
#if USE_ATTACHMENT_BROKER
- IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel(
- channel_.get());
+ // In unit tests, the attachment broker may not have been initialized.
+ if (IPC::AttachmentBroker::GetGlobal()) {
+ IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel(
+ channel_.get());
+ }
#endif
for (size_t i = 0; i < filters_.size(); ++i)
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698