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

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: 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
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..a2fb3fa44f9cebe193533530cfd5a298666f1b1a 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"
@@ -26,6 +25,7 @@
#include "content/public/common/content_paths.h"
#include "content/public/common/content_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/message_filter.h"
@@ -38,33 +38,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;
@@ -117,7 +90,7 @@ ChildProcessHostImpl::ChildProcessHostImpl(ChildProcessHostDelegate* delegate)
// 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();
+ IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded();
#endif
}

Powered by Google App Engine
This is Rietveld 408576698