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

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 1738663002: Hook embedded shell up to MojoShellConnection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h" 73 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h"
74 #include "content/browser/loader/resource_message_filter.h" 74 #include "content/browser/loader/resource_message_filter.h"
75 #include "content/browser/loader/resource_scheduler_filter.h" 75 #include "content/browser/loader/resource_scheduler_filter.h"
76 #include "content/browser/media/capture/audio_mirroring_manager.h" 76 #include "content/browser/media/capture/audio_mirroring_manager.h"
77 #include "content/browser/media/media_internals.h" 77 #include "content/browser/media/media_internals.h"
78 #include "content/browser/media/midi_host.h" 78 #include "content/browser/media/midi_host.h"
79 #include "content/browser/memory/memory_message_filter.h" 79 #include "content/browser/memory/memory_message_filter.h"
80 #include "content/browser/message_port_message_filter.h" 80 #include "content/browser/message_port_message_filter.h"
81 #include "content/browser/mime_registry_message_filter.h" 81 #include "content/browser/mime_registry_message_filter.h"
82 #include "content/browser/mojo/mojo_application_host.h" 82 #include "content/browser/mojo/mojo_application_host.h"
83 #include "content/browser/mojo/mojo_shell_client_host.h"
83 #include "content/browser/navigator_connect/service_port_service_impl.h" 84 #include "content/browser/navigator_connect/service_port_service_impl.h"
84 #include "content/browser/notifications/notification_message_filter.h" 85 #include "content/browser/notifications/notification_message_filter.h"
85 #include "content/browser/permissions/permission_service_context.h" 86 #include "content/browser/permissions/permission_service_context.h"
86 #include "content/browser/permissions/permission_service_impl.h" 87 #include "content/browser/permissions/permission_service_impl.h"
87 #include "content/browser/profiler_message_filter.h" 88 #include "content/browser/profiler_message_filter.h"
88 #include "content/browser/push_messaging/push_messaging_message_filter.h" 89 #include "content/browser/push_messaging/push_messaging_message_filter.h"
89 #include "content/browser/quota_dispatcher_host.h" 90 #include "content/browser/quota_dispatcher_host.h"
90 #include "content/browser/renderer_host/clipboard_message_filter.h" 91 #include "content/browser/renderer_host/clipboard_message_filter.h"
91 #include "content/browser/renderer_host/database_message_filter.h" 92 #include "content/browser/renderer_host/database_message_filter.h"
92 #include "content/browser/renderer_host/file_utilities_message_filter.h" 93 #include "content/browser/renderer_host/file_utilities_message_filter.h"
(...skipping 24 matching lines...) Expand all
117 #include "content/browser/tracing/trace_message_filter.h" 118 #include "content/browser/tracing/trace_message_filter.h"
118 #include "content/browser/webui/web_ui_controller_factory_registry.h" 119 #include "content/browser/webui/web_ui_controller_factory_registry.h"
119 #include "content/common/child_process_host_impl.h" 120 #include "content/common/child_process_host_impl.h"
120 #include "content/common/child_process_messages.h" 121 #include "content/common/child_process_messages.h"
121 #include "content/common/content_switches_internal.h" 122 #include "content/common/content_switches_internal.h"
122 #include "content/common/frame_messages.h" 123 #include "content/common/frame_messages.h"
123 #include "content/common/gpu/gpu_host_messages.h" 124 #include "content/common/gpu/gpu_host_messages.h"
124 #include "content/common/in_process_child_thread_params.h" 125 #include "content/common/in_process_child_thread_params.h"
125 #include "content/common/mojo/channel_init.h" 126 #include "content/common/mojo/channel_init.h"
126 #include "content/common/mojo/mojo_messages.h" 127 #include "content/common/mojo/mojo_messages.h"
128 #include "content/common/mojo/mojo_shell_connection_impl.h"
127 #include "content/common/render_process_messages.h" 129 #include "content/common/render_process_messages.h"
128 #include "content/common/resource_messages.h" 130 #include "content/common/resource_messages.h"
129 #include "content/common/site_isolation_policy.h" 131 #include "content/common/site_isolation_policy.h"
130 #include "content/common/view_messages.h" 132 #include "content/common/view_messages.h"
131 #include "content/public/browser/browser_context.h" 133 #include "content/public/browser/browser_context.h"
132 #include "content/public/browser/content_browser_client.h" 134 #include "content/public/browser/content_browser_client.h"
133 #include "content/public/browser/navigator_connect_context.h" 135 #include "content/public/browser/navigator_connect_context.h"
134 #include "content/public/browser/notification_service.h" 136 #include "content/public/browser/notification_service.h"
135 #include "content/public/browser/notification_types.h" 137 #include "content/public/browser/notification_types.h"
136 #include "content/public/browser/render_process_host_factory.h" 138 #include "content/public/browser/render_process_host_factory.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 225
224 #if defined(ENABLE_WEBRTC) 226 #if defined(ENABLE_WEBRTC)
225 #include "content/browser/media/webrtc/webrtc_internals.h" 227 #include "content/browser/media/webrtc/webrtc_internals.h"
226 #include "content/browser/renderer_host/media/media_stream_track_metrics_host.h" 228 #include "content/browser/renderer_host/media/media_stream_track_metrics_host.h"
227 #include "content/browser/renderer_host/media/webrtc_identity_service_host.h" 229 #include "content/browser/renderer_host/media/webrtc_identity_service_host.h"
228 #include "content/browser/renderer_host/p2p/socket_dispatcher_host.h" 230 #include "content/browser/renderer_host/p2p/socket_dispatcher_host.h"
229 #include "content/common/media/aec_dump_messages.h" 231 #include "content/common/media/aec_dump_messages.h"
230 #include "content/common/media/media_stream_messages.h" 232 #include "content/common/media/media_stream_messages.h"
231 #endif 233 #endif
232 234
233 #if defined(MOJO_SHELL_CLIENT)
234 #include "content/browser/mojo/mojo_shell_client_host.h"
235 #include "content/common/mojo/mojo_shell_connection_impl.h"
236 #endif
237
238 #if defined(OS_WIN) 235 #if defined(OS_WIN)
239 #define IntToStringType base::IntToString16 236 #define IntToStringType base::IntToString16
240 #else 237 #else
241 #define IntToStringType base::IntToString 238 #define IntToStringType base::IntToString
242 #endif 239 #endif
243 240
244 namespace content { 241 namespace content {
245 namespace { 242 namespace {
246 243
247 const char kSiteProcessMapKeyName[] = "content_site_process_map"; 244 const char kSiteProcessMapKeyName[] = "content_site_process_map";
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 // single process modes, the global attachment broker is the privileged 617 // single process modes, the global attachment broker is the privileged
621 // attachment broker, rather than an unprivileged attachment broker. 618 // attachment broker, rather than an unprivileged attachment broker.
622 #if defined(OS_MACOSX) && !defined(OS_IOS) 619 #if defined(OS_MACOSX) && !defined(OS_IOS)
623 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded( 620 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded(
624 MachBroker::GetInstance()); 621 MachBroker::GetInstance());
625 #else 622 #else
626 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded(); 623 IPC::AttachmentBrokerPrivileged::CreateBrokerIfNeeded();
627 #endif // defined(OS_MACOSX) && !defined(OS_IOS) 624 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
628 #endif // USE_ATTACHMENT_BROKER 625 #endif // USE_ATTACHMENT_BROKER
629 626
630 #if defined(MOJO_SHELL_CLIENT)
631 RegisterChildWithExternalShell(id_, this); 627 RegisterChildWithExternalShell(id_, this);
632 #endif
633 } 628 }
634 629
635 // static 630 // static
636 void RenderProcessHostImpl::ShutDownInProcessRenderer() { 631 void RenderProcessHostImpl::ShutDownInProcessRenderer() {
637 DCHECK(g_run_renderer_in_process_); 632 DCHECK(g_run_renderer_in_process_);
638 633
639 switch (g_all_hosts.Pointer()->size()) { 634 switch (g_all_hosts.Pointer()->size()) {
640 case 0: 635 case 0:
641 return; 636 return;
642 case 1: { 637 case 1: {
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after
1611 1606
1612 // Add kWaitForDebugger to let renderer process wait for a debugger. 1607 // Add kWaitForDebugger to let renderer process wait for a debugger.
1613 if (browser_cmd.HasSwitch(switches::kWaitForDebuggerChildren)) { 1608 if (browser_cmd.HasSwitch(switches::kWaitForDebuggerChildren)) {
1614 // Look to pass-on the kWaitForDebugger flag. 1609 // Look to pass-on the kWaitForDebugger flag.
1615 std::string value = 1610 std::string value =
1616 browser_cmd.GetSwitchValueASCII(switches::kWaitForDebuggerChildren); 1611 browser_cmd.GetSwitchValueASCII(switches::kWaitForDebuggerChildren);
1617 if (value.empty() || value == switches::kRendererProcess) { 1612 if (value.empty() || value == switches::kRendererProcess) {
1618 renderer_cmd->AppendSwitch(switches::kWaitForDebugger); 1613 renderer_cmd->AppendSwitch(switches::kWaitForDebugger);
1619 } 1614 }
1620 } 1615 }
1621
1622 #if defined(MOJO_SHELL_CLIENT)
1623 if (IsRunningInMojoShell())
1624 renderer_cmd->AppendSwitch(switches::kEnableMojoShellConnection);
1625 #endif
1626 } 1616 }
1627 1617
1628 base::ProcessHandle RenderProcessHostImpl::GetHandle() const { 1618 base::ProcessHandle RenderProcessHostImpl::GetHandle() const {
1629 if (run_renderer_in_process()) 1619 if (run_renderer_in_process())
1630 return base::GetCurrentProcessHandle(); 1620 return base::GetCurrentProcessHandle();
1631 1621
1632 if (!child_process_launcher_.get() || child_process_launcher_->IsStarting()) 1622 if (!child_process_launcher_.get() || child_process_launcher_->IsStarting())
1633 return base::kNullProcessHandle; 1623 return base::kNullProcessHandle;
1634 1624
1635 return child_process_launcher_->GetProcess().Handle(); 1625 return child_process_launcher_->GetProcess().Handle();
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after
2568 if (child_process_launcher_.get()) { 2558 if (child_process_launcher_.get()) {
2569 base::ProcessHandle process_handle = 2559 base::ProcessHandle process_handle =
2570 child_process_launcher_->GetProcess().Handle(); 2560 child_process_launcher_->GetProcess().Handle();
2571 mojo::edk::ScopedPlatformHandle client_pipe = 2561 mojo::edk::ScopedPlatformHandle client_pipe =
2572 mojo::edk::ChildProcessLaunched(process_handle); 2562 mojo::edk::ChildProcessLaunched(process_handle);
2573 Send(new ChildProcessMsg_SetMojoParentPipeHandle( 2563 Send(new ChildProcessMsg_SetMojoParentPipeHandle(
2574 IPC::GetFileHandleForProcess(client_pipe.release().handle, 2564 IPC::GetFileHandleForProcess(client_pipe.release().handle,
2575 process_handle, true))); 2565 process_handle, true)));
2576 } 2566 }
2577 2567
2578 #if defined(MOJO_SHELL_CLIENT)
2579 // Send the mojo shell handle to the renderer. 2568 // Send the mojo shell handle to the renderer.
2580 SendExternalMojoShellHandleToChild(GetHandle(), this); 2569 SendExternalMojoShellHandleToChild(GetHandle(), this);
2581 #endif
2582 2570
2583 // Allow Mojo to be setup before the renderer sees any Chrome IPC messages. 2571 // Allow Mojo to be setup before the renderer sees any Chrome IPC messages.
2584 // This way, Mojo can be safely used from the renderer in response to any 2572 // This way, Mojo can be safely used from the renderer in response to any
2585 // Chrome IPC message. 2573 // Chrome IPC message.
2586 mojo_application_host_->Activate(this, GetHandle()); 2574 mojo_application_host_->Activate(this, GetHandle());
2587 2575
2588 while (!queued_messages_.empty()) { 2576 while (!queued_messages_.empty()) {
2589 Send(queued_messages_.front()); 2577 Send(queued_messages_.front());
2590 queued_messages_.pop(); 2578 queued_messages_.pop();
2591 } 2579 }
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
2793 2781
2794 // Skip widgets in other processes. 2782 // Skip widgets in other processes.
2795 if (rvh->GetProcess()->GetID() != GetID()) 2783 if (rvh->GetProcess()->GetID() != GetID())
2796 continue; 2784 continue;
2797 2785
2798 rvh->OnWebkitPreferencesChanged(); 2786 rvh->OnWebkitPreferencesChanged();
2799 } 2787 }
2800 } 2788 }
2801 2789
2802 } // namespace content 2790 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698