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

Unified Diff: content/browser/renderer_host/render_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/browser_main_loop.cc ('k') | content/common/child_process_host_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_process_host_impl.cc
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 4d2111f6f6ae5a306b10f81e7556f076746ee454..450e73dd24154acd1a0ff45cad4631ce0f4191bd 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -158,8 +158,6 @@
#include "gpu/command_buffer/client/gpu_switches.h"
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "gpu/command_buffer/service/gpu_switches.h"
-#include "ipc/attachment_broker.h"
-#include "ipc/attachment_broker_privileged.h"
#include "ipc/ipc_channel.h"
#include "ipc/ipc_logging.h"
#include "ipc/ipc_switches.h"
@@ -198,7 +196,6 @@
#if defined(OS_MACOSX) && !defined(OS_IOS)
#include "content/browser/bootstrap_sandbox_manager_mac.h"
-#include "content/browser/mach_broker_mac.h"
#endif
#if defined(OS_POSIX)
@@ -608,19 +605,6 @@ RenderProcessHostImpl::RenderProcessHostImpl(
if (BootstrapSandboxManager::ShouldEnable())
AddObserver(BootstrapSandboxManager::GetInstance());
#endif
-
-#if USE_ATTACHMENT_BROKER
- // Construct the privileged attachment broker early in the life cycle of a
- // render process. This ensures that when a test is being run in one of the
- // single process modes, the global attachment broker is the privileged
- // attachment broker, rather than an unprivileged attachment broker.
-#if defined(OS_MACOSX) && !defined(OS_IOS)
- IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded(
- MachBroker::GetInstance());
-#else
- IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded();
-#endif // defined(OS_MACOSX) && !defined(OS_IOS)
-#endif // USE_ATTACHMENT_BROKER
}
// static
@@ -1948,8 +1932,11 @@ void RenderProcessHostImpl::Cleanup() {
deleting_soon_ = true;
#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
// It's important not to wait for the DeleteTask to delete the channel
@@ -2422,8 +2409,11 @@ void RenderProcessHostImpl::ProcessDied(bool already_dead,
child_process_launcher_.reset();
#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
channel_.reset();
while (!queued_messages_.empty()) {
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/common/child_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698