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

Side by Side Diff: content/browser/renderer_host/render_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 | « content/browser/browser_main_loop.cc ('k') | content/common/child_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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 // Represents the browser side of the browser <--> renderer communication 5 // Represents the browser side of the browser <--> renderer communication
6 // channel. There will be one RenderProcessHost per renderer process. 6 // channel. There will be one RenderProcessHost per renderer process.
7 7
8 #include "content/browser/renderer_host/render_process_host_impl.h" 8 #include "content/browser/renderer_host/render_process_host_impl.h"
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 #include "content/public/common/resource_type.h" 151 #include "content/public/common/resource_type.h"
152 #include "content/public/common/result_codes.h" 152 #include "content/public/common/result_codes.h"
153 #include "content/public/common/sandboxed_process_launcher_delegate.h" 153 #include "content/public/common/sandboxed_process_launcher_delegate.h"
154 #include "content/public/common/url_constants.h" 154 #include "content/public/common/url_constants.h"
155 #include "device/battery/battery_monitor_impl.h" 155 #include "device/battery/battery_monitor_impl.h"
156 #include "device/vibration/vibration_manager_impl.h" 156 #include "device/vibration/vibration_manager_impl.h"
157 #include "gpu/GLES2/gl2extchromium.h" 157 #include "gpu/GLES2/gl2extchromium.h"
158 #include "gpu/command_buffer/client/gpu_switches.h" 158 #include "gpu/command_buffer/client/gpu_switches.h"
159 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 159 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
160 #include "gpu/command_buffer/service/gpu_switches.h" 160 #include "gpu/command_buffer/service/gpu_switches.h"
161 #include "ipc/attachment_broker.h"
162 #include "ipc/attachment_broker_privileged.h"
163 #include "ipc/ipc_channel.h" 161 #include "ipc/ipc_channel.h"
164 #include "ipc/ipc_logging.h" 162 #include "ipc/ipc_logging.h"
165 #include "ipc/ipc_switches.h" 163 #include "ipc/ipc_switches.h"
166 #include "ipc/mojo/ipc_channel_mojo.h" 164 #include "ipc/mojo/ipc_channel_mojo.h"
167 #include "media/base/media_switches.h" 165 #include "media/base/media_switches.h"
168 #include "mojo/edk/embedder/embedder.h" 166 #include "mojo/edk/embedder/embedder.h"
169 #include "mojo/shell/runner/common/switches.h" 167 #include "mojo/shell/runner/common/switches.h"
170 #include "net/url_request/url_request_context_getter.h" 168 #include "net/url_request/url_request_context_getter.h"
171 #include "ppapi/shared_impl/ppapi_switches.h" 169 #include "ppapi/shared_impl/ppapi_switches.h"
172 #include "storage/browser/fileapi/sandbox_file_system_backend.h" 170 #include "storage/browser/fileapi/sandbox_file_system_backend.h"
(...skipping 18 matching lines...) Expand all
191 #include "base/win/windows_version.h" 189 #include "base/win/windows_version.h"
192 #include "content/browser/renderer_host/dwrite_font_proxy_message_filter_win.h" 190 #include "content/browser/renderer_host/dwrite_font_proxy_message_filter_win.h"
193 #include "content/common/font_cache_dispatcher_win.h" 191 #include "content/common/font_cache_dispatcher_win.h"
194 #include "content/common/sandbox_win.h" 192 #include "content/common/sandbox_win.h"
195 #include "sandbox/win/src/sandbox_policy.h" 193 #include "sandbox/win/src/sandbox_policy.h"
196 #include "ui/gfx/win/dpi.h" 194 #include "ui/gfx/win/dpi.h"
197 #endif 195 #endif
198 196
199 #if defined(OS_MACOSX) && !defined(OS_IOS) 197 #if defined(OS_MACOSX) && !defined(OS_IOS)
200 #include "content/browser/bootstrap_sandbox_manager_mac.h" 198 #include "content/browser/bootstrap_sandbox_manager_mac.h"
201 #include "content/browser/mach_broker_mac.h"
202 #endif 199 #endif
203 200
204 #if defined(OS_POSIX) 201 #if defined(OS_POSIX)
205 #include "content/browser/zygote_host/zygote_communication_linux.h" 202 #include "content/browser/zygote_host/zygote_communication_linux.h"
206 #include "content/browser/zygote_host/zygote_host_impl_linux.h" 203 #include "content/browser/zygote_host/zygote_host_impl_linux.h"
207 #include "content/public/browser/zygote_handle_linux.h" 204 #include "content/public/browser/zygote_handle_linux.h"
208 #endif // defined(OS_POSIX) 205 #endif // defined(OS_POSIX)
209 206
210 #if defined(USE_OZONE) 207 #if defined(USE_OZONE)
211 #include "ui/ozone/public/client_native_pixmap_factory.h" 208 #include "ui/ozone/public/client_native_pixmap_factory.h"
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 storage_partition_impl_->GetPath())); 598 storage_partition_impl_->GetPath()));
602 } 599 }
603 subscribe_uniform_enabled_ = 600 subscribe_uniform_enabled_ =
604 base::CommandLine::ForCurrentProcess()->HasSwitch( 601 base::CommandLine::ForCurrentProcess()->HasSwitch(
605 switches::kEnableSubscribeUniformExtension); 602 switches::kEnableSubscribeUniformExtension);
606 603
607 #if defined(OS_MACOSX) 604 #if defined(OS_MACOSX)
608 if (BootstrapSandboxManager::ShouldEnable()) 605 if (BootstrapSandboxManager::ShouldEnable())
609 AddObserver(BootstrapSandboxManager::GetInstance()); 606 AddObserver(BootstrapSandboxManager::GetInstance());
610 #endif 607 #endif
611
612 #if USE_ATTACHMENT_BROKER
613 // Construct the privileged attachment broker early in the life cycle of a
614 // render process. This ensures that when a test is being run in one of the
615 // single process modes, the global attachment broker is the privileged
616 // attachment broker, rather than an unprivileged attachment broker.
617 #if defined(OS_MACOSX) && !defined(OS_IOS)
618 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded(
619 MachBroker::GetInstance());
620 #else
621 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded();
622 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
623 #endif // USE_ATTACHMENT_BROKER
624 } 608 }
625 609
626 // static 610 // static
627 void RenderProcessHostImpl::ShutDownInProcessRenderer() { 611 void RenderProcessHostImpl::ShutDownInProcessRenderer() {
628 DCHECK(g_run_renderer_in_process_); 612 DCHECK(g_run_renderer_in_process_);
629 613
630 switch (g_all_hosts.Pointer()->size()) { 614 switch (g_all_hosts.Pointer()->size()) {
631 case 0: 615 case 0:
632 return; 616 return;
633 case 1: { 617 case 1: {
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 NOTIFICATION_RENDERER_PROCESS_TERMINATED, 1925 NOTIFICATION_RENDERER_PROCESS_TERMINATED,
1942 Source<RenderProcessHost>(this), NotificationService::NoDetails()); 1926 Source<RenderProcessHost>(this), NotificationService::NoDetails());
1943 1927
1944 #ifndef NDEBUG 1928 #ifndef NDEBUG
1945 is_self_deleted_ = true; 1929 is_self_deleted_ = true;
1946 #endif 1930 #endif
1947 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); 1931 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
1948 deleting_soon_ = true; 1932 deleting_soon_ = true;
1949 1933
1950 #if USE_ATTACHMENT_BROKER 1934 #if USE_ATTACHMENT_BROKER
1951 IPC::AttachmentBroker::GetGlobal()->DeregisterCommunicationChannel( 1935 // In unit tests, the attachment broker may not have been initialized.
1952 channel_.get()); 1936 if (IPC::AttachmentBroker::GetGlobal()) {
1937 IPC::AttachmentBroker::GetGlobal()->DeregisterCommunicationChannel(
1938 channel_.get());
1939 }
1953 #endif 1940 #endif
1954 1941
1955 // It's important not to wait for the DeleteTask to delete the channel 1942 // It's important not to wait for the DeleteTask to delete the channel
1956 // proxy. Kill it off now. That way, in case the profile is going away, the 1943 // proxy. Kill it off now. That way, in case the profile is going away, the
1957 // rest of the objects attached to this RenderProcessHost start going 1944 // rest of the objects attached to this RenderProcessHost start going
1958 // away first, since deleting the channel proxy will post a 1945 // away first, since deleting the channel proxy will post a
1959 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread. 1946 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread.
1960 channel_.reset(); 1947 channel_.reset();
1961 1948
1962 // The following members should be cleared in ProcessDied() as well! 1949 // The following members should be cleared in ProcessDied() as well!
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
2415 // TERMINATION_STATUS_STILL_RUNNING, since this will break WebContentsImpl 2402 // TERMINATION_STATUS_STILL_RUNNING, since this will break WebContentsImpl
2416 // logic. 2403 // logic.
2417 status = base::TERMINATION_STATUS_PROCESS_CRASHED; 2404 status = base::TERMINATION_STATUS_PROCESS_CRASHED;
2418 } 2405 }
2419 } 2406 }
2420 2407
2421 RendererClosedDetails details(status, exit_code); 2408 RendererClosedDetails details(status, exit_code);
2422 2409
2423 child_process_launcher_.reset(); 2410 child_process_launcher_.reset();
2424 #if USE_ATTACHMENT_BROKER 2411 #if USE_ATTACHMENT_BROKER
2425 IPC::AttachmentBroker::GetGlobal()->DeregisterCommunicationChannel( 2412 // In unit tests, the attachment broker may not have been initialized.
2426 channel_.get()); 2413 if (IPC::AttachmentBroker::GetGlobal()) {
2414 IPC::AttachmentBroker::GetGlobal()->DeregisterCommunicationChannel(
2415 channel_.get());
2416 }
2427 #endif 2417 #endif
2428 channel_.reset(); 2418 channel_.reset();
2429 while (!queued_messages_.empty()) { 2419 while (!queued_messages_.empty()) {
2430 delete queued_messages_.front(); 2420 delete queued_messages_.front();
2431 queued_messages_.pop(); 2421 queued_messages_.pop();
2432 } 2422 }
2433 UpdateProcessPriority(); 2423 UpdateProcessPriority();
2434 DCHECK(!is_process_backgrounded_); 2424 DCHECK(!is_process_backgrounded_);
2435 2425
2436 // RenderProcessExited observers and RenderProcessGone handlers might 2426 // RenderProcessExited observers and RenderProcessGone handlers might
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
2813 2803
2814 // Skip widgets in other processes. 2804 // Skip widgets in other processes.
2815 if (rvh->GetProcess()->GetID() != GetID()) 2805 if (rvh->GetProcess()->GetID() != GetID())
2816 continue; 2806 continue;
2817 2807
2818 rvh->OnWebkitPreferencesChanged(); 2808 rvh->OnWebkitPreferencesChanged();
2819 } 2809 }
2820 } 2810 }
2821 2811
2822 } // namespace content 2812 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/common/child_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698