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

Unified Diff: content/common/child_process_host_impl.cc

Issue 1414603003: ipc: Move AttachmentBrokerPrivileged singleton logic into ipc/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor formatting. Created 5 years, 2 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') | ipc/attachment_broker.h » ('j') | 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 71b5d6e29b102bccbb11bb3f0877c964b0ade05d..1ae2cc06437143803d0b12fe35796c8a5f774d2b 100644
--- a/content/common/child_process_host_impl.cc
+++ b/content/common/child_process_host_impl.cc
@@ -10,7 +10,6 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/hash.h"
-#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/metrics/histogram.h"
#include "base/numerics/safe_math.h"
@@ -38,33 +37,6 @@
namespace {
-#if USE_ATTACHMENT_BROKER
-// This class is wrapped in a singleton to ensure that its constructor is only
-// called once. The constructor creates an attachment broker and
-// sets it as the global broker.
-class AttachmentBrokerWrapper {
- public:
- AttachmentBrokerWrapper() {
- attachment_broker_.reset(
- IPC::AttachmentBrokerPrivileged::CreateBroker().release());
- }
-
- IPC::AttachmentBrokerPrivileged* GetAttachmentBroker() {
- return attachment_broker_.get();
- }
-
- private:
- scoped_ptr<IPC::AttachmentBrokerPrivileged> attachment_broker_;
-};
-
-base::LazyInstance<AttachmentBrokerWrapper>::Leaky
- g_attachment_broker_wrapper = LAZY_INSTANCE_INITIALIZER;
-
-IPC::AttachmentBrokerPrivileged* GetAttachmentBroker() {
- return g_attachment_broker_wrapper.Get().GetAttachmentBroker();
-}
-#endif // USE_ATTACHMENT_BROKER
-
// Global atomic to generate child process unique IDs.
base::StaticAtomicSequenceNumber g_unique_id;
@@ -112,18 +84,12 @@ ChildProcessHostImpl::ChildProcessHostImpl(ChildProcessHostDelegate* delegate)
#if defined(OS_WIN)
AddFilter(new FontCacheDispatcher());
#endif
-#if USE_ATTACHMENT_BROKER
- // Construct the privileged attachment broker early in the life cycle of a
- // child 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.
- GetAttachmentBroker();
-#endif
}
ChildProcessHostImpl::~ChildProcessHostImpl() {
#if USE_ATTACHMENT_BROKER
- GetAttachmentBroker()->DeregisterCommunicationChannel(channel_.get());
+ IPC::AttachmentBroker::GetGlobal()->DeregisterCommunicationChannel(
+ channel_.get());
#endif
for (size_t i = 0; i < filters_.size(); ++i) {
filters_[i]->OnChannelClosing();
@@ -148,7 +114,8 @@ std::string ChildProcessHostImpl::CreateChannel() {
if (!channel_->Connect())
return std::string();
#if USE_ATTACHMENT_BROKER
- GetAttachmentBroker()->RegisterCommunicationChannel(channel_.get());
+ 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') | ipc/attachment_broker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698