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

Side by Side Diff: content/browser/browser_child_process_host_impl.cc

Issue 1801123004: Move attachment broker setup to browser startup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-mach-ports
Patch Set: Maybe fix tests. Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/browser_main_loop.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 15 matching lines...) Expand all
26 #include "content/common/child_process_host_impl.h" 26 #include "content/common/child_process_host_impl.h"
27 #include "content/common/child_process_messages.h" 27 #include "content/common/child_process_messages.h"
28 #include "content/public/browser/browser_child_process_host_delegate.h" 28 #include "content/public/browser/browser_child_process_host_delegate.h"
29 #include "content/public/browser/browser_child_process_observer.h" 29 #include "content/public/browser/browser_child_process_observer.h"
30 #include "content/public/browser/browser_thread.h" 30 #include "content/public/browser/browser_thread.h"
31 #include "content/public/browser/child_process_data.h" 31 #include "content/public/browser/child_process_data.h"
32 #include "content/public/browser/content_browser_client.h" 32 #include "content/public/browser/content_browser_client.h"
33 #include "content/public/common/content_switches.h" 33 #include "content/public/common/content_switches.h"
34 #include "content/public/common/process_type.h" 34 #include "content/public/common/process_type.h"
35 #include "content/public/common/result_codes.h" 35 #include "content/public/common/result_codes.h"
36 #include "ipc/attachment_broker.h"
37 #include "ipc/attachment_broker_privileged.h"
38 #include "mojo/edk/embedder/embedder.h" 36 #include "mojo/edk/embedder/embedder.h"
39 37
40 #if defined(OS_MACOSX) 38 #if defined(OS_MACOSX)
41 #include "content/browser/mach_broker_mac.h" 39 #include "content/browser/mach_broker_mac.h"
42 #endif 40 #endif
43 41
44 namespace content { 42 namespace content {
45 namespace { 43 namespace {
46 44
47 static base::LazyInstance<BrowserChildProcessHostImpl::BrowserChildProcessList> 45 static base::LazyInstance<BrowserChildProcessHostImpl::BrowserChildProcessList>
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 120
123 BrowserChildProcessHostImpl::BrowserChildProcessHostImpl( 121 BrowserChildProcessHostImpl::BrowserChildProcessHostImpl(
124 content::ProcessType process_type, 122 content::ProcessType process_type,
125 BrowserChildProcessHostDelegate* delegate) 123 BrowserChildProcessHostDelegate* delegate)
126 : data_(process_type), 124 : data_(process_type),
127 delegate_(delegate), 125 delegate_(delegate),
128 power_monitor_message_broadcaster_(this), 126 power_monitor_message_broadcaster_(this),
129 is_channel_connected_(false) { 127 is_channel_connected_(false) {
130 data_.id = ChildProcessHostImpl::GenerateChildProcessUniqueId(); 128 data_.id = ChildProcessHostImpl::GenerateChildProcessUniqueId();
131 129
132 #if USE_ATTACHMENT_BROKER
133 // Construct the privileged attachment broker early in the life cycle of a
134 // child process. This ensures that when a test is being run in one of the
135 // single process modes, the global attachment broker is the privileged
136 // attachment broker, rather than an unprivileged attachment broker.
137 #if defined(OS_MACOSX) && !defined(OS_IOS)
138 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded(
139 MachBroker::GetInstance());
140 #else
141 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded();
142 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
143 #endif // USE_ATTACHMENT_BROKER
144
145 child_process_host_.reset(ChildProcessHost::Create(this)); 130 child_process_host_.reset(ChildProcessHost::Create(this));
146 AddFilter(new TraceMessageFilter(data_.id)); 131 AddFilter(new TraceMessageFilter(data_.id));
147 AddFilter(new ProfilerMessageFilter(process_type)); 132 AddFilter(new ProfilerMessageFilter(process_type));
148 AddFilter(new HistogramMessageFilter); 133 AddFilter(new HistogramMessageFilter);
149 AddFilter(new MemoryMessageFilter(this, process_type)); 134 AddFilter(new MemoryMessageFilter(this, process_type));
150 135
151 g_child_process_list.Get().push_back(this); 136 g_child_process_list.Get().push_back(this);
152 GetContentClient()->browser()->BrowserChildProcessHostCreated(this); 137 GetContentClient()->browser()->BrowserChildProcessHostCreated(this);
153 138
154 power_monitor_message_broadcaster_.Init(); 139 power_monitor_message_broadcaster_.Init();
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 425
441 #if defined(OS_WIN) 426 #if defined(OS_WIN)
442 427
443 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { 428 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) {
444 OnChildDisconnected(); 429 OnChildDisconnected();
445 } 430 }
446 431
447 #endif 432 #endif
448 433
449 } // namespace content 434 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/browser_main_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698