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

Side by Side Diff: content/browser/browser_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, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/browser_child_process_host_impl.h" 5 #include "content/browser/browser_child_process_host_impl.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/dump_without_crashing.h" 10 #include "base/debug/dump_without_crashing.h"
(...skipping 12 matching lines...) Expand all
23 #include "content/browser/tracing/trace_message_filter.h" 23 #include "content/browser/tracing/trace_message_filter.h"
24 #include "content/common/child_process_host_impl.h" 24 #include "content/common/child_process_host_impl.h"
25 #include "content/public/browser/browser_child_process_host_delegate.h" 25 #include "content/public/browser/browser_child_process_host_delegate.h"
26 #include "content/public/browser/browser_child_process_observer.h" 26 #include "content/public/browser/browser_child_process_observer.h"
27 #include "content/public/browser/browser_thread.h" 27 #include "content/public/browser/browser_thread.h"
28 #include "content/public/browser/child_process_data.h" 28 #include "content/public/browser/child_process_data.h"
29 #include "content/public/browser/content_browser_client.h" 29 #include "content/public/browser/content_browser_client.h"
30 #include "content/public/common/content_switches.h" 30 #include "content/public/common/content_switches.h"
31 #include "content/public/common/process_type.h" 31 #include "content/public/common/process_type.h"
32 #include "content/public/common/result_codes.h" 32 #include "content/public/common/result_codes.h"
33 #include "ipc/attachment_broker.h"
34 #include "ipc/attachment_broker_privileged.h"
33 35
34 #if defined(OS_MACOSX) 36 #if defined(OS_MACOSX)
35 #include "content/browser/mach_broker_mac.h" 37 #include "content/browser/mach_broker_mac.h"
36 #endif 38 #endif
37 39
38 namespace content { 40 namespace content {
39 namespace { 41 namespace {
40 42
41 static base::LazyInstance<BrowserChildProcessHostImpl::BrowserChildProcessList> 43 static base::LazyInstance<BrowserChildProcessHostImpl::BrowserChildProcessList>
42 g_child_process_list = LAZY_INSTANCE_INITIALIZER; 44 g_child_process_list = LAZY_INSTANCE_INITIALIZER;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 112 }
111 113
112 BrowserChildProcessHostImpl::BrowserChildProcessHostImpl( 114 BrowserChildProcessHostImpl::BrowserChildProcessHostImpl(
113 content::ProcessType process_type, 115 content::ProcessType process_type,
114 BrowserChildProcessHostDelegate* delegate) 116 BrowserChildProcessHostDelegate* delegate)
115 : data_(process_type), 117 : data_(process_type),
116 delegate_(delegate), 118 delegate_(delegate),
117 power_monitor_message_broadcaster_(this) { 119 power_monitor_message_broadcaster_(this) {
118 data_.id = ChildProcessHostImpl::GenerateChildProcessUniqueId(); 120 data_.id = ChildProcessHostImpl::GenerateChildProcessUniqueId();
119 121
122 #if USE_ATTACHMENT_BROKER
123 // Construct the privileged attachment broker early in the life cycle of a
124 // child process. This ensures that when a test is being run in one of the
125 // single process modes, the global attachment broker is the privileged
126 // attachment broker, rather than an unprivileged attachment broker.
127 #if defined(OS_MACOSX) && !defined(OS_IOS)
128 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded(
129 MachBroker::GetInstance());
130 #else
131 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded();
132 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
133 #endif // USE_ATTACHMENT_BROKER
134
120 child_process_host_.reset(ChildProcessHost::Create(this)); 135 child_process_host_.reset(ChildProcessHost::Create(this));
121 AddFilter(new TraceMessageFilter(data_.id)); 136 AddFilter(new TraceMessageFilter(data_.id));
122 AddFilter(new ProfilerMessageFilter(process_type)); 137 AddFilter(new ProfilerMessageFilter(process_type));
123 AddFilter(new HistogramMessageFilter); 138 AddFilter(new HistogramMessageFilter);
124 AddFilter(new MemoryMessageFilter); 139 AddFilter(new MemoryMessageFilter);
125 140
126 g_child_process_list.Get().push_back(this); 141 g_child_process_list.Get().push_back(this);
127 GetContentClient()->browser()->BrowserChildProcessHostCreated(this); 142 GetContentClient()->browser()->BrowserChildProcessHostCreated(this);
128 143
129 power_monitor_message_broadcaster_.Init(); 144 power_monitor_message_broadcaster_.Init();
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 404
390 #if defined(OS_WIN) 405 #if defined(OS_WIN)
391 406
392 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { 407 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) {
393 OnChildDisconnected(); 408 OnChildDisconnected();
394 } 409 }
395 410
396 #endif 411 #endif
397 412
398 } // namespace content 413 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698