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 bd420dfaf2cdacb9ee75bbe5285264b4f6ca1bdd..6b1da67ee2f0edea6f609e8a633f83d37d733217 100644 |
--- a/content/common/child_process_host_impl.cc |
+++ b/content/common/child_process_host_impl.cc |
@@ -149,12 +149,12 @@ base::FilePath ChildProcessHost::GetChildPath(int flags) { |
} |
// static |
-IPC::AttachmentBroker* ChildProcessHost::GetAttachmentBroker() { |
-#if defined(OS_WIN) |
+IPC::AttachmentBrokerPrivileged* ChildProcessHost::GetAttachmentBroker() { |
+#if USE_ATTACHMENT_BROKER |
return &g_attachment_broker.Get(); |
#else |
return nullptr; |
-#endif // defined(OS_WIN) |
+#endif // USE_ATTACHMENT_BROKER |
} |
ChildProcessHostImpl::ChildProcessHostImpl(ChildProcessHostDelegate* delegate) |
@@ -166,6 +166,9 @@ ChildProcessHostImpl::ChildProcessHostImpl(ChildProcessHostDelegate* delegate) |
} |
ChildProcessHostImpl::~ChildProcessHostImpl() { |
+#if USE_ATTACHMENT_BROKER |
+ g_attachment_broker.Get().DeregisterCommunicationChannel(channel_.get()); |
+#endif |
for (size_t i = 0; i < filters_.size(); ++i) { |
filters_[i]->OnChannelClosing(); |
filters_[i]->OnFilterRemoved(); |
@@ -189,6 +192,9 @@ std::string ChildProcessHostImpl::CreateChannel() { |
IPC::Channel::CreateServer(channel_id_, this, GetAttachmentBroker()); |
if (!channel_->Connect()) |
return std::string(); |
+#if USE_ATTACHMENT_BROKER |
+ g_attachment_broker.Get().RegisterCommunicationChannel(channel_.get()); |
+#endif |
for (size_t i = 0; i < filters_.size(); ++i) |
filters_[i]->OnFilterAdded(channel_.get()); |
@@ -279,6 +285,11 @@ bool ChildProcessHostImpl::OnMessageReceived(const IPC::Message& msg) { |
logger->OnPreDispatchMessage(msg); |
#endif |
+#if USE_ATTACHMENT_BROKER |
+ if (g_attachment_broker.Get().OnMessageReceived(msg)) |
+ return true; |
+#endif |
+ |
bool handled = false; |
for (size_t i = 0; i < filters_.size(); ++i) { |
if (filters_[i]->OnMessageReceived(msg)) { |