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()) { |